Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: chrome/nacl/nacl_listener.cc

Issue 10912011: Change NaCl IPC PPAPI proxy startup to support a NaCl-Browser process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/nacl/nacl_ipc_adapter.cc ('k') | ppapi/proxy/plugin_main_nacl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/nacl/nacl_listener.h" 5 #include "chrome/nacl/nacl_listener.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 191 }
192 192
193 void NaClListener::OnMsgStart(const nacl::NaClStartParams& params) { 193 void NaClListener::OnMsgStart(const nacl::NaClStartParams& params) {
194 struct NaClChromeMainArgs *args = NaClChromeMainArgsCreate(); 194 struct NaClChromeMainArgs *args = NaClChromeMainArgsCreate();
195 if (args == NULL) { 195 if (args == NULL) {
196 LOG(ERROR) << "NaClChromeMainArgsCreate() failed"; 196 LOG(ERROR) << "NaClChromeMainArgsCreate() failed";
197 return; 197 return;
198 } 198 }
199 199
200 if (params.enable_ipc_proxy) { 200 if (params.enable_ipc_proxy) {
201 // Create the server side of the channel and notify the process host so it 201 // Create the initial PPAPI IPC channel between the NaCl IRT and the
202 // can reply to the renderer, which will connect as client. 202 // browser process. The IRT uses this channel to communicate with the
203 IPC::ChannelHandle channel_handle = 203 // browser and to create additional IPC channels to renderer processes.
204 IPC::ChannelHandle handle =
204 IPC::Channel::GenerateVerifiedChannelID("nacl"); 205 IPC::Channel::GenerateVerifiedChannelID("nacl");
205 206 scoped_refptr<NaClIPCAdapter> ipc_adapter(
206 scoped_refptr<NaClIPCAdapter> ipc_adapter(new NaClIPCAdapter( 207 new NaClIPCAdapter(handle, io_thread_.message_loop_proxy()));
207 channel_handle, io_thread_.message_loop_proxy())); 208 // Pass a NaClDesc to the untrusted side. This will hold a ref to the
208 args->initial_ipc_desc = ipc_adapter.get()->MakeNaClDesc(); 209 // NaClIPCAdapter.
209 210 args->initial_ipc_desc = ipc_adapter->MakeNaClDesc();
210 #if defined(OS_POSIX) 211 #if defined(OS_POSIX)
211 channel_handle.socket = base::FileDescriptor( 212 handle.socket = base::FileDescriptor(
212 ipc_adapter.get()->TakeClientFileDescriptor(), true); 213 ipc_adapter->TakeClientFileDescriptor(), true);
213 #endif 214 #endif
214 215 if (!Send(new NaClProcessHostMsg_PpapiChannelCreated(handle)))
215 if (!Send(new NaClProcessHostMsg_PpapiChannelCreated(channel_handle))) 216 LOG(ERROR) << "Failed to send IPC channel handle to NaClProcessHost.";
216 LOG(ERROR) << "Failed to send IPC channel handle to renderer.";
217 } 217 }
218 218
219 std::vector<nacl::FileDescriptor> handles = params.handles; 219 std::vector<nacl::FileDescriptor> handles = params.handles;
220 220
221 #if defined(OS_LINUX) || defined(OS_MACOSX) 221 #if defined(OS_LINUX) || defined(OS_MACOSX)
222 args->urandom_fd = dup(base::GetUrandomFD()); 222 args->urandom_fd = dup(base::GetUrandomFD());
223 if (args->urandom_fd < 0) { 223 if (args->urandom_fd < 0) {
224 LOG(ERROR) << "Failed to dup() the urandom FD"; 224 LOG(ERROR) << "Failed to dup() the urandom FD";
225 return; 225 return;
226 } 226 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 #if defined(OS_WIN) 263 #if defined(OS_WIN)
264 args->broker_duplicate_handle_func = BrokerDuplicateHandle; 264 args->broker_duplicate_handle_func = BrokerDuplicateHandle;
265 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; 265 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler;
266 #endif 266 #endif
267 #if defined(OS_LINUX) 267 #if defined(OS_LINUX)
268 args->prereserved_sandbox_size = prereserved_sandbox_size_; 268 args->prereserved_sandbox_size = prereserved_sandbox_size_;
269 #endif 269 #endif
270 NaClChromeMainStart(args); 270 NaClChromeMainStart(args);
271 NOTREACHED(); 271 NOTREACHED();
272 } 272 }
OLDNEW
« no previous file with comments | « chrome/nacl/nacl_ipc_adapter.cc ('k') | ppapi/proxy/plugin_main_nacl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698