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 COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ | 5 #ifndef COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
6 #define COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ | 6 #define COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 void OnProcessLaunchedByBroker(base::ProcessHandle handle); | 113 void OnProcessLaunchedByBroker(base::ProcessHandle handle); |
114 void OnDebugExceptionHandlerLaunchedByBroker(bool success); | 114 void OnDebugExceptionHandlerLaunchedByBroker(bool success); |
115 #endif | 115 #endif |
116 | 116 |
117 bool Send(IPC::Message* msg); | 117 bool Send(IPC::Message* msg); |
118 | 118 |
119 content::BrowserChildProcessHost* process() { return process_.get(); } | 119 content::BrowserChildProcessHost* process() { return process_.get(); } |
120 content::BrowserPpapiHost* browser_ppapi_host() { return ppapi_host_.get(); } | 120 content::BrowserPpapiHost* browser_ppapi_host() { return ppapi_host_.get(); } |
121 | 121 |
122 private: | 122 private: |
123 class ScopedChannelHandle; | |
124 | |
125 void LaunchNaClGdb(); | 123 void LaunchNaClGdb(); |
126 | 124 |
127 // Mark the process as using a particular GDB debug stub port and notify | 125 // Mark the process as using a particular GDB debug stub port and notify |
128 // listeners (if the port is not kGdbDebugStubPortUnknown). | 126 // listeners (if the port is not kGdbDebugStubPortUnknown). |
129 void SetDebugStubPort(int port); | 127 void SetDebugStubPort(int port); |
130 | 128 |
131 #if defined(OS_POSIX) | 129 #if defined(OS_POSIX) |
132 // Create bound TCP socket in the browser process so that the NaCl GDB debug | 130 // Create bound TCP socket in the browser process so that the NaCl GDB debug |
133 // stub can use it to accept incoming connections even when the Chrome sandbox | 131 // stub can use it to accept incoming connections even when the Chrome sandbox |
134 // is enabled. | 132 // is enabled. |
135 net::SocketDescriptor GetDebugStubSocketHandle(); | 133 net::SocketDescriptor GetDebugStubSocketHandle(); |
136 #endif | 134 #endif |
137 | 135 |
138 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
139 // Called when the debug stub port has been selected. | 137 // Called when the debug stub port has been selected. |
140 void OnDebugStubPortSelected(uint16_t debug_stub_port); | 138 void OnDebugStubPortSelected(uint16_t debug_stub_port); |
141 #endif | 139 #endif |
142 | 140 |
143 bool LaunchSelLdr(); | 141 bool LaunchSelLdr(); |
144 | 142 |
145 // BrowserChildProcessHostDelegate implementation: | 143 // BrowserChildProcessHostDelegate implementation: |
146 bool OnMessageReceived(const IPC::Message& msg) override; | 144 bool OnMessageReceived(const IPC::Message& msg) override; |
147 void OnProcessLaunched() override; | 145 void OnProcessLaunched() override; |
148 | 146 |
149 void OnResourcesReady(); | 147 void OnResourcesReady(); |
150 | 148 |
151 // Sends the reply message to the renderer who is waiting for the plugin | 149 // Sends the reply message to the renderer who is waiting for the plugin |
152 // to load. Returns true on success. | 150 // to load. Returns true on success. |
153 void ReplyToRenderer( | 151 void ReplyToRenderer( |
154 ScopedChannelHandle ppapi_channel_handle, | 152 mojo::ScopedMessagePipeHandle ppapi_channel_handle, |
155 ScopedChannelHandle trusted_channel_handle, | 153 mojo::ScopedMessagePipeHandle trusted_channel_handle, |
156 ScopedChannelHandle manifest_service_channel_handle); | 154 mojo::ScopedMessagePipeHandle manifest_service_channel_handle); |
157 | 155 |
158 // Sends the reply with error message to the renderer. | 156 // Sends the reply with error message to the renderer. |
159 void SendErrorToRenderer(const std::string& error_message); | 157 void SendErrorToRenderer(const std::string& error_message); |
160 | 158 |
161 // Sends the reply message to the renderer. Either result or | 159 // Sends the reply message to the renderer. Either result or |
162 // error message must be empty. | 160 // error message must be empty. |
163 void SendMessageToRenderer(const NaClLaunchResult& result, | 161 void SendMessageToRenderer(const NaClLaunchResult& result, |
164 const std::string& error_message); | 162 const std::string& error_message); |
165 | 163 |
166 // Sends the message to the NaCl process to load the plugin. Returns true | 164 // Sends the message to the NaCl process to load the plugin. Returns true |
167 // on success. | 165 // on success. |
168 bool StartNaClExecution(); | 166 bool StartNaClExecution(); |
169 | 167 |
170 void StartNaClFileResolved( | 168 void StartNaClFileResolved( |
171 NaClStartParams params, | 169 NaClStartParams params, |
172 const base::FilePath& file_path, | 170 const base::FilePath& file_path, |
173 base::File nexe_file); | 171 base::File nexe_file); |
174 | 172 |
175 #if defined(OS_LINUX) | |
176 // Creates a pair of IPC::ChannelHandle. Returns true on success. | |
177 static bool CreateChannelHandlePair(ScopedChannelHandle* channel_handle1, | |
178 ScopedChannelHandle* channel_handle2); | |
179 #endif | |
180 | |
181 // Starts browser PPAPI proxy. Returns true on success. | 173 // Starts browser PPAPI proxy. Returns true on success. |
182 bool StartPPAPIProxy(ScopedChannelHandle channel_handle); | 174 bool StartPPAPIProxy(mojo::ScopedMessagePipeHandle channel_handle); |
183 | 175 |
184 // Does post-process-launching tasks for starting the NaCl process once | 176 // Does post-process-launching tasks for starting the NaCl process once |
185 // we have a connection. | 177 // we have a connection. |
186 // | 178 // |
187 // Returns false on failure. | 179 // Returns false on failure. |
188 bool StartWithLaunchedProcess(); | 180 bool StartWithLaunchedProcess(); |
189 | 181 |
190 // Message handlers for validation caching. | 182 // Message handlers for validation caching. |
191 void OnQueryKnownToValidate(const std::string& signature, bool* result); | 183 void OnQueryKnownToValidate(const std::string& signature, bool* result); |
192 void OnSetKnownToValidate(const std::string& signature); | 184 void OnSetKnownToValidate(const std::string& signature); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 std::string mojo_child_token_; | 261 std::string mojo_child_token_; |
270 | 262 |
271 base::WeakPtrFactory<NaClProcessHost> weak_factory_; | 263 base::WeakPtrFactory<NaClProcessHost> weak_factory_; |
272 | 264 |
273 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); | 265 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
274 }; | 266 }; |
275 | 267 |
276 } // namespace nacl | 268 } // namespace nacl |
277 | 269 |
278 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ | 270 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
OLD | NEW |