| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_COMMON_CHILD_PROCESS_INFO_H_ | 5 #ifndef CONTENT_COMMON_CHILD_PROCESS_INFO_H_ |
| 6 #define CONTENT_COMMON_CHILD_PROCESS_INFO_H_ | 6 #define CONTENT_COMMON_CHILD_PROCESS_INFO_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // process ID, and will be unique for all types of child process for | 42 // process ID, and will be unique for all types of child process for |
| 43 // one run of the browser. | 43 // one run of the browser. |
| 44 int id() const { return id_; } | 44 int id() const { return id_; } |
| 45 | 45 |
| 46 void SetProcessBackgrounded() const { process_.SetProcessBackgrounded(true); } | 46 void SetProcessBackgrounded() const { process_.SetProcessBackgrounded(true); } |
| 47 | 47 |
| 48 // Returns an English name of the process type, should only be used for non | 48 // Returns an English name of the process type, should only be used for non |
| 49 // user-visible strings, or debugging pages like about:memory. | 49 // user-visible strings, or debugging pages like about:memory. |
| 50 static std::string GetTypeNameInEnglish(content::ProcessType type); | 50 static std::string GetTypeNameInEnglish(content::ProcessType type); |
| 51 | 51 |
| 52 // We define the < operator so that the ChildProcessInfo can be used as a key | |
| 53 // in a std::map. | |
| 54 bool operator <(const ChildProcessInfo& rhs) const { | |
| 55 if (process_.handle() != rhs.process_.handle()) | |
| 56 return process_ .handle() < rhs.process_.handle(); | |
| 57 return false; | |
| 58 } | |
| 59 | |
| 60 bool operator ==(const ChildProcessInfo& rhs) const { | |
| 61 return process_.handle() == rhs.process_.handle(); | |
| 62 } | |
| 63 | |
| 64 // Generates a unique channel name for a child renderer/plugin process. | 52 // Generates a unique channel name for a child renderer/plugin process. |
| 65 // The "instance" pointer value is baked into the channel id. | 53 // The "instance" pointer value is baked into the channel id. |
| 66 static std::string GenerateRandomChannelID(void* instance); | 54 static std::string GenerateRandomChannelID(void* instance); |
| 67 | 55 |
| 68 // Returns a unique ID to identify a child process. On construction, this | 56 // Returns a unique ID to identify a child process. On construction, this |
| 69 // function will be used to generate the id_, but it is also used to generate | 57 // function will be used to generate the id_, but it is also used to generate |
| 70 // IDs for the RenderProcessHost, which doesn't inherit from us, and whose IDs | 58 // IDs for the RenderProcessHost, which doesn't inherit from us, and whose IDs |
| 71 // must be unique for all child processes. | 59 // must be unique for all child processes. |
| 72 // | 60 // |
| 73 // This function is threadsafe since RenderProcessHost is on the UI thread, | 61 // This function is threadsafe since RenderProcessHost is on the UI thread, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 90 content::ProcessType type_; | 78 content::ProcessType type_; |
| 91 string16 name_; | 79 string16 name_; |
| 92 string16 version_; | 80 string16 version_; |
| 93 int id_; | 81 int id_; |
| 94 | 82 |
| 95 // The handle to the process. | 83 // The handle to the process. |
| 96 mutable base::Process process_; | 84 mutable base::Process process_; |
| 97 }; | 85 }; |
| 98 | 86 |
| 99 #endif // CONTENT_COMMON_CHILD_PROCESS_INFO_H_ | 87 #endif // CONTENT_COMMON_CHILD_PROCESS_INFO_H_ |
| OLD | NEW |