| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/process/kill.h" | 9 #include "base/process/kill.h" |
| 10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // will get terminated at browser shutdown. | 35 // will get terminated at browser shutdown. |
| 36 class CONTENT_EXPORT BrowserChildProcessHost : public IPC::Sender { | 36 class CONTENT_EXPORT BrowserChildProcessHost : public IPC::Sender { |
| 37 public: | 37 public: |
| 38 // Used to create a child process host. The delegate must outlive this object. | 38 // Used to create a child process host. The delegate must outlive this object. |
| 39 // |process_type| needs to be either an enum value from ProcessType or an | 39 // |process_type| needs to be either an enum value from ProcessType or an |
| 40 // embedder-defined value. | 40 // embedder-defined value. |
| 41 static BrowserChildProcessHost* Create( | 41 static BrowserChildProcessHost* Create( |
| 42 content::ProcessType process_type, | 42 content::ProcessType process_type, |
| 43 BrowserChildProcessHostDelegate* delegate); | 43 BrowserChildProcessHostDelegate* delegate); |
| 44 | 44 |
| 45 // Used to create a child process host, with a unique token to identify the |
| 46 // child process to Mojo. |mojo_child_token| should be a unique string |
| 47 // generated using mojo::edk::GenerateRandomToken(). |
| 48 static BrowserChildProcessHost* Create( |
| 49 content::ProcessType process_type, |
| 50 BrowserChildProcessHostDelegate* delegate, |
| 51 const std::string& mojo_child_token); |
| 52 |
| 45 // Returns the child process host with unique id |child_process_id|, or | 53 // Returns the child process host with unique id |child_process_id|, or |
| 46 // nullptr if it doesn't exist. |child_process_id| is NOT the process ID, but | 54 // nullptr if it doesn't exist. |child_process_id| is NOT the process ID, but |
| 47 // is the same unique ID as |ChildProcessData::id|. | 55 // is the same unique ID as |ChildProcessData::id|. |
| 48 static BrowserChildProcessHost* FromID(int child_process_id); | 56 static BrowserChildProcessHost* FromID(int child_process_id); |
| 49 | 57 |
| 50 ~BrowserChildProcessHost() override {} | 58 ~BrowserChildProcessHost() override {} |
| 51 | 59 |
| 52 // Derived classes call this to launch the child process asynchronously. | 60 // Derived classes call this to launch the child process asynchronously. |
| 53 // Takes ownership of |cmd_line| and |delegate|. | 61 // Takes ownership of |cmd_line| and |delegate|. |
| 54 virtual void Launch( | 62 virtual void Launch( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 95 |
| 88 #if defined(OS_MACOSX) | 96 #if defined(OS_MACOSX) |
| 89 // Returns a PortProvider used to get the task port for child processes. | 97 // Returns a PortProvider used to get the task port for child processes. |
| 90 static base::PortProvider* GetPortProvider(); | 98 static base::PortProvider* GetPortProvider(); |
| 91 #endif | 99 #endif |
| 92 }; | 100 }; |
| 93 | 101 |
| 94 }; // namespace content | 102 }; // namespace content |
| 95 | 103 |
| 96 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 104 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
| OLD | NEW |