| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_COMMON_CHILD_PROCESS_INFO_H_ | 5 #ifndef CHROME_COMMON_CHILD_PROCESS_INFO_H_ |
| 6 #define CHROME_COMMON_CHILD_PROCESS_INFO_H_ | 6 #define CHROME_COMMON_CHILD_PROCESS_INFO_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // Returns the type of the process. | 23 // Returns the type of the process. |
| 24 ProcessType type() const { return type_; } | 24 ProcessType type() const { return type_; } |
| 25 | 25 |
| 26 // Returns the name of the process. i.e. for plugins it might be Flash, while | 26 // Returns the name of the process. i.e. for plugins it might be Flash, while |
| 27 // for workers it might be the domain that it's from. | 27 // for workers it might be the domain that it's from. |
| 28 std::wstring name() const { return name_; } | 28 std::wstring name() const { return name_; } |
| 29 | 29 |
| 30 // Getter to the process handle. | 30 // Getter to the process handle. |
| 31 base::ProcessHandle handle() const { return process_.handle(); } | 31 base::ProcessHandle handle() const { return process_.handle(); } |
| 32 | 32 |
| 33 int pid() const { | 33 virtual int GetProcessId() const { |
| 34 if (pid_ != -1) | 34 if (pid_ != -1) |
| 35 return pid_; | 35 return pid_; |
| 36 | 36 |
| 37 pid_ = process_.pid(); | 37 pid_ = process_.pid(); |
| 38 return pid_; | 38 return pid_; |
| 39 } | 39 } |
| 40 void SetProcessBackgrounded() const { process_.SetProcessBackgrounded(true); } | 40 void SetProcessBackgrounded() const { process_.SetProcessBackgrounded(true); } |
| 41 void ReduceWorkingSet() const { process_.ReduceWorkingSet(); } | 41 void ReduceWorkingSet() const { process_.ReduceWorkingSet(); } |
| 42 | 42 |
| 43 // Returns an English name of the process type, should only be used for non | 43 // Returns an English name of the process type, should only be used for non |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 void set_name(const std::wstring& name) { name_ = name; } | 88 void set_name(const std::wstring& name) { name_ = name; } |
| 89 void set_handle(base::ProcessHandle handle) { | 89 void set_handle(base::ProcessHandle handle) { |
| 90 process_.set_handle(handle); | 90 process_.set_handle(handle); |
| 91 pid_ = -1; | 91 pid_ = -1; |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Derived objects need to use this constructor so we know what type we are. | 94 // Derived objects need to use this constructor so we know what type we are. |
| 95 ChildProcessInfo(ProcessType type); | 95 ChildProcessInfo(ProcessType type); |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 friend class ResourceDispatcherHostTest; | |
| 99 | |
| 100 ProcessType type_; | 98 ProcessType type_; |
| 101 std::wstring name_; | 99 std::wstring name_; |
| 102 mutable int pid_; // Cache of the process id. | 100 mutable int pid_; // Cache of the process id. |
| 103 | 101 |
| 104 // The handle to the process. | 102 // The handle to the process. |
| 105 mutable base::Process process_; | 103 mutable base::Process process_; |
| 106 }; | 104 }; |
| 107 | 105 |
| 108 #endif // CHROME_COMMON_CHILD_PROCESS_INFO_H_ | 106 #endif // CHROME_COMMON_CHILD_PROCESS_INFO_H_ |
| OLD | NEW |