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 27 matching lines...) Expand all Loading... |
38 // will get terminated at browser shutdown. | 38 // will get terminated at browser shutdown. |
39 class CONTENT_EXPORT BrowserChildProcessHost : public IPC::Sender { | 39 class CONTENT_EXPORT BrowserChildProcessHost : public IPC::Sender { |
40 public: | 40 public: |
41 // Used to create a child process host. The delegate must outlive this object. | 41 // Used to create a child process host. The delegate must outlive this object. |
42 // |process_type| needs to be either an enum value from ProcessType or an | 42 // |process_type| needs to be either an enum value from ProcessType or an |
43 // embedder-defined value. | 43 // embedder-defined value. |
44 static BrowserChildProcessHost* Create( | 44 static BrowserChildProcessHost* Create( |
45 content::ProcessType process_type, | 45 content::ProcessType process_type, |
46 BrowserChildProcessHostDelegate* delegate); | 46 BrowserChildProcessHostDelegate* delegate); |
47 | 47 |
48 // Used to create a child process host, connecting the process to the shell | 48 // Used to create a child process host, with a unique token to identify the |
49 // as a new service instance identified by |service_name| and (optional) | 49 // child process to Mojo. |mojo_child_token| should be a unique string |
50 // |instance_id|. | 50 // generated using mojo::edk::GenerateRandomToken(). |
51 static BrowserChildProcessHost* Create( | 51 static BrowserChildProcessHost* Create( |
52 content::ProcessType process_type, | 52 content::ProcessType process_type, |
53 BrowserChildProcessHostDelegate* delegate, | 53 BrowserChildProcessHostDelegate* delegate, |
54 const std::string& service_name); | 54 const std::string& mojo_child_token); |
55 | 55 |
56 // Returns the child process host with unique id |child_process_id|, or | 56 // Returns the child process host with unique id |child_process_id|, or |
57 // nullptr if it doesn't exist. |child_process_id| is NOT the process ID, but | 57 // nullptr if it doesn't exist. |child_process_id| is NOT the process ID, but |
58 // is the same unique ID as |ChildProcessData::id|. | 58 // is the same unique ID as |ChildProcessData::id|. |
59 static BrowserChildProcessHost* FromID(int child_process_id); | 59 static BrowserChildProcessHost* FromID(int child_process_id); |
60 | 60 |
61 ~BrowserChildProcessHost() override {} | 61 ~BrowserChildProcessHost() override {} |
62 | 62 |
63 // Derived classes call this to launch the child process asynchronously. | 63 // Derived classes call this to launch the child process asynchronously. |
64 // Takes ownership of |cmd_line| and |delegate|. | 64 // Takes ownership of |cmd_line| and |delegate|. |
(...skipping 20 matching lines...) Expand all Loading... |
85 // Sets the user-visible name of the process. | 85 // Sets the user-visible name of the process. |
86 virtual void SetName(const base::string16& name) = 0; | 86 virtual void SetName(const base::string16& name) = 0; |
87 | 87 |
88 // Set the handle of the process. BrowserChildProcessHost will do this when | 88 // Set the handle of the process. BrowserChildProcessHost will do this when |
89 // the Launch method is used to start the process. However if the owner | 89 // the Launch method is used to start the process. However if the owner |
90 // of this object doesn't call Launch and starts the process in another way, | 90 // of this object doesn't call Launch and starts the process in another way, |
91 // they need to call this method so that the process handle is associated with | 91 // they need to call this method so that the process handle is associated with |
92 // this object. | 92 // this object. |
93 virtual void SetHandle(base::ProcessHandle handle) = 0; | 93 virtual void SetHandle(base::ProcessHandle handle) = 0; |
94 | 94 |
| 95 // Returns the shell::InterfaceProvider the browser process can use to bind |
| 96 // interfaces exposed to it from the child. |
| 97 virtual shell::InterfaceProvider* GetRemoteInterfaces() = 0; |
| 98 |
95 #if defined(OS_MACOSX) | 99 #if defined(OS_MACOSX) |
96 // Returns a PortProvider used to get the task port for child processes. | 100 // Returns a PortProvider used to get the task port for child processes. |
97 static base::PortProvider* GetPortProvider(); | 101 static base::PortProvider* GetPortProvider(); |
98 #endif | 102 #endif |
99 }; | 103 }; |
100 | 104 |
101 }; // namespace content | 105 }; // namespace content |
102 | 106 |
103 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 107 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
OLD | NEW |