diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-17 00:52:35 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-17 00:52:35 +0000 |
commit | dabe607133c5b62e6b0134017f35cb87d0d4f3b6 (patch) | |
tree | db5d35947dcfa2810c7e7e19364ecaae37aa0912 /chrome/common/child_process_info.h | |
parent | a91baaa1bab5fe3de395aad464015a098290a46b (diff) | |
download | chromium_src-dabe607133c5b62e6b0134017f35cb87d0d4f3b6.zip chromium_src-dabe607133c5b62e6b0134017f35cb87d0d4f3b6.tar.gz chromium_src-dabe607133c5b62e6b0134017f35cb87d0d4f3b6.tar.bz2 |
Hide the details about ResourceDispatcherHost messages from child processes. The usage of RDH is now like RD, the client sends the message to RDH to see if it should handle it. I added methods to the Receiver interface so that RDH can get to the process id/handle/type when starting requests.
Review URL: http://codereview.chromium.org/42202
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11816 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/child_process_info.h')
-rw-r--r-- | chrome/common/child_process_info.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/chrome/common/child_process_info.h b/chrome/common/child_process_info.h index eee468d..2af3e10 100644 --- a/chrome/common/child_process_info.h +++ b/chrome/common/child_process_info.h @@ -30,7 +30,13 @@ class ChildProcessInfo { // Getter to the process handle. base::ProcessHandle handle() const { return process_.handle(); } - int pid() const { return process_.pid(); } + int pid() const { + if (pid_ != -1) + return pid_; + + pid_ = process_.pid(); + return pid_; + } void SetProcessBackgrounded() const { process_.SetProcessBackgrounded(true); } void ReduceWorkingSet() const { process_.ReduceWorkingSet(); } @@ -46,6 +52,7 @@ class ChildProcessInfo { type_ = original.type_; name_ = original.name_; process_ = original.process_; + pid_ = original.pid_; } ChildProcessInfo& operator=(const ChildProcessInfo& original) { @@ -53,6 +60,7 @@ class ChildProcessInfo { type_ = original.type_; name_ = original.name_; process_ = original.process_; + pid_ = original.pid_; } return *this; } @@ -78,20 +86,20 @@ class ChildProcessInfo { protected: void set_type(ProcessType type) { type_ = type; } void set_name(const std::wstring& name) { name_ = name; } - void set_handle(base::ProcessHandle handle) { process_.set_handle(handle); } + void set_handle(base::ProcessHandle handle) { + process_.set_handle(handle); + pid_ = -1; + } // Derived objects need to use this constructor so we know what type we are. ChildProcessInfo(ProcessType type); private: - // By making the constructor private, we can ensure that ChildProcessInfo - // objects can only be created by creating objects derived from them (i.e. - // PluginProcessHost) or by using the copy constructor or assignment operator - // to create an object from the former. - ChildProcessInfo() { } + friend class ResourceDispatcherHostTest; ProcessType type_; std::wstring name_; + mutable int pid_; // Cache of the process id. // The handle to the process. mutable base::Process process_; |