summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-17 18:43:33 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-17 18:43:33 +0000
commitf174efdeef740d594124f820abb18ed1185cc57d (patch)
treeeaff8f7f18edb072d1ef2c780d5b74e03b90dc4a /content
parentc63cedf228f9390647cafed05b64d0fc1fdf3e54 (diff)
downloadchromium_src-f174efdeef740d594124f820abb18ed1185cc57d.zip
chromium_src-f174efdeef740d594124f820abb18ed1185cc57d.tar.gz
chromium_src-f174efdeef740d594124f820abb18ed1185cc57d.tar.bz2
Group BrowserChildProcesshost methods that will be part of the interface together, and make sure they're all CamelCase.
BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9228012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/browser_child_process_host.cc17
-rw-r--r--content/browser/browser_child_process_host.h36
-rw-r--r--content/browser/plugin_process_host.cc2
-rw-r--r--content/browser/ppapi_plugin_process_host.cc4
-rw-r--r--content/browser/utility_process_host.cc2
-rw-r--r--content/browser/worker_host/worker_process_host.cc2
6 files changed, 42 insertions, 21 deletions
diff --git a/content/browser/browser_child_process_host.cc b/content/browser/browser_child_process_host.cc
index 38861aa..9bd3b21 100644
--- a/content/browser/browser_child_process_host.cc
+++ b/content/browser/browser_child_process_host.cc
@@ -39,8 +39,8 @@ using content::ChildProcessHostImpl;
namespace {
-typedef std::list<BrowserChildProcessHost*> ChildProcessList;
-static base::LazyInstance<ChildProcessList> g_child_process_list =
+typedef std::list<BrowserChildProcessHost*> BrowserChildProcessList;
+static base::LazyInstance<BrowserChildProcessList> g_child_process_list =
LAZY_INSTANCE_INITIALIZER;
// Helper functions since the child process related notifications happen on the
@@ -77,8 +77,9 @@ BrowserChildProcessHost::~BrowserChildProcessHost() {
// static
void BrowserChildProcessHost::TerminateAll() {
- // Make a copy since the ChildProcessHost dtor mutates the original list.
- ChildProcessList copy = g_child_process_list.Get();
+ // Make a copy since the BrowserChildProcessHost dtor mutates the original
+ // list.
+ BrowserChildProcessList copy = g_child_process_list.Get();
STLDeleteElements(&copy);
}
@@ -114,6 +115,14 @@ base::ProcessHandle BrowserChildProcessHost::GetChildProcessHandle() const {
return child_process_->GetHandle();
}
+void BrowserChildProcessHost::SetName(const string16& name) {
+ data_.name = name;
+}
+
+void BrowserChildProcessHost::SetHandle(base::ProcessHandle handle) {
+ data_.handle = handle;
+}
+
void BrowserChildProcessHost::ForceShutdown() {
g_child_process_list.Get().remove(this);
child_process_host_->ForceShutdown();
diff --git a/content/browser/browser_child_process_host.h b/content/browser/browser_child_process_host.h
index f24e6ad..3fac085 100644
--- a/content/browser/browser_child_process_host.h
+++ b/content/browser/browser_child_process_host.h
@@ -43,7 +43,8 @@ class CONTENT_EXPORT BrowserChildProcessHost :
virtual void OnWaitableEventSignaled(
base::WaitableEvent* waitable_event) OVERRIDE;
- // Terminates all child processes and deletes each ChildProcessHost instance.
+ // Terminates all child processes and deletes each BrowserChildProcessHost
+ // instance.
static void TerminateAll();
// The Iterator class allows iteration through either all child processes, or
@@ -85,9 +86,8 @@ class CONTENT_EXPORT BrowserChildProcessHost :
#endif
CommandLine* cmd_line);
- // Returns the handle of the child process. This can be called only after
- // OnProcessLaunched is called or it will be invalid and may crash.
- base::ProcessHandle GetChildProcessHandle() const;
+ // TODO(jam): below is what will be in the BrowserChildProcessHostDelegate
+ // interface.
// ChildProcessLauncher::Client implementation.
virtual void OnProcessLaunched() OVERRIDE {}
@@ -98,12 +98,6 @@ class CONTENT_EXPORT BrowserChildProcessHost :
// GetExitCodeProcess()).
virtual void OnProcessCrashed(int exit_code) {}
- // Returns the termination status of a child. |exit_code| is the
- // status returned when the process exited (for posix, as returned
- // from waitpid(), for Windows, as returned from
- // GetExitCodeProcess()). |exit_code| may be NULL.
- base::TerminationStatus GetChildTerminationStatus(int* exit_code);
-
// Overrides from ChildProcessHostDelegate
virtual bool CanShutdown() OVERRIDE;
virtual void OnChildDisconnected() OVERRIDE;
@@ -111,6 +105,26 @@ class CONTENT_EXPORT BrowserChildProcessHost :
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
+ // Returns the termination status of a child. |exit_code| is the
+ // status returned when the process exited (for posix, as returned
+ // from waitpid(), for Windows, as returned from
+ // GetExitCodeProcess()). |exit_code| may be NULL.
+ base::TerminationStatus GetChildTerminationStatus(int* exit_code);
+
+ // Returns the handle of the child process. This can be called only after
+ // OnProcessLaunched is called or it will be invalid and may crash.
+ base::ProcessHandle GetChildProcessHandle() const;
+
+ // Sets the user-visible name of the process.
+ void SetName(const string16& name);
+
+ // Set the handle of the process. BrowserChildProcessHost will do this when
+ // the Launch method is used to start the process. However if the owner
+ // of this object doesn't call Launch and starts the process in another way,
+ // they need to call this method so that the process handle is associated with
+ // this object.
+ void SetHandle(base::ProcessHandle handle);
+
// Removes this host from the host list. Calls ChildProcessHost::ForceShutdown
void ForceShutdown();
@@ -124,8 +138,6 @@ class CONTENT_EXPORT BrowserChildProcessHost :
content::ChildProcessHost* child_process_host() const {
return child_process_host_.get();
}
- void set_name(const string16& name) { data_.name = name; }
- void set_handle(base::ProcessHandle handle) { data_.handle = handle; }
private:
// By using an internal class as the ChildProcessLauncher::Client, we can
diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc
index dcfe740..cd8fb88 100644
--- a/content/browser/plugin_process_host.cc
+++ b/content/browser/plugin_process_host.cc
@@ -166,7 +166,7 @@ PluginProcessHost::~PluginProcessHost() {
bool PluginProcessHost::Init(const webkit::WebPluginInfo& info) {
info_ = info;
- set_name(info_.name);
+ SetName(info_.name);
std::string channel_id = child_process_host()->CreateChannel();
if (channel_id.empty())
diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc
index 0178ed6..96b5029 100644
--- a/content/browser/ppapi_plugin_process_host.cc
+++ b/content/browser/ppapi_plugin_process_host.cc
@@ -118,9 +118,9 @@ PpapiPluginProcessHost::PpapiPluginProcessHost()
bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) {
plugin_path_ = info.path;
if (info.name.empty()) {
- set_name(plugin_path_.BaseName().LossyDisplayName());
+ SetName(plugin_path_.BaseName().LossyDisplayName());
} else {
- set_name(UTF8ToUTF16(info.name));
+ SetName(UTF8ToUTF16(info.name));
}
std::string channel_id = child_process_host()->CreateChannel();
diff --git a/content/browser/utility_process_host.cc b/content/browser/utility_process_host.cc
index 097cb93..68db20a 100644
--- a/content/browser/utility_process_host.cc
+++ b/content/browser/utility_process_host.cc
@@ -87,7 +87,7 @@ bool UtilityProcessHost::StartProcess() {
return true;
// Name must be set or metrics_service will crash in any test which
// launches a UtilityProcessHost.
- set_name(ASCIIToUTF16("utility process"));
+ SetName(ASCIIToUTF16("utility process"));
std::string channel_id = child_process_host()->CreateChannel();
if (channel_id.empty())
diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc
index d0d685b6..f25ce53 100644
--- a/content/browser/worker_host/worker_process_host.cc
+++ b/content/browser/worker_host/worker_process_host.cc
@@ -490,7 +490,7 @@ void WorkerProcessHost::UpdateTitle() {
display_title += *i;
}
- set_name(ASCIIToUTF16(display_title));
+ SetName(ASCIIToUTF16(display_title));
}
void WorkerProcessHost::DocumentDetached(WorkerMessageFilter* filter,