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

Side by Side Diff: chrome/browser/nacl_process_host.cc

Issue 257029: Add an option to disable NaCl at compile time for platforms where it doesn't build yet (Closed)
Patch Set: Created 11 years, 2 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
« no previous file with comments | « chrome/app/chrome_dll_main.cc ('k') | chrome/browser/plugin_service.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/nacl_process_host.h" 7 #include "chrome/browser/nacl_process_host.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 21 matching lines...) Expand all
32 32
33 NaClProcessHost::NaClProcessHost( 33 NaClProcessHost::NaClProcessHost(
34 ResourceDispatcherHost *resource_dispatcher_host) 34 ResourceDispatcherHost *resource_dispatcher_host)
35 : ChildProcessHost(NACL_PROCESS, resource_dispatcher_host), 35 : ChildProcessHost(NACL_PROCESS, resource_dispatcher_host),
36 resource_dispatcher_host_(resource_dispatcher_host) { 36 resource_dispatcher_host_(resource_dispatcher_host) {
37 } 37 }
38 38
39 bool NaClProcessHost::Launch(ResourceMessageFilter* renderer_msg_filter, 39 bool NaClProcessHost::Launch(ResourceMessageFilter* renderer_msg_filter,
40 const int descriptor, 40 const int descriptor,
41 nacl::FileDescriptor* handle) { 41 nacl::FileDescriptor* handle) {
42 #ifdef DISABLE_NACL
43 NOTIMPLEMENTED() << "Native Client disabled at build time";
44 return false;
45 #else
42 nacl::Handle pair[2]; 46 nacl::Handle pair[2];
43 bool success = false; 47 bool success = false;
44 // Create a connected socket 48 // Create a connected socket
45 if (nacl::SocketPair(pair) == -1) { 49 if (nacl::SocketPair(pair) == -1) {
46 NATIVE_HANDLE(*handle) = nacl::kInvalidHandle; 50 NATIVE_HANDLE(*handle) = nacl::kInvalidHandle;
47 return false; 51 return false;
48 } 52 }
49 53
50 // Launch the process 54 // Launch the process
51 success = LaunchSelLdr(renderer_msg_filter, descriptor, pair[1]); 55 success = LaunchSelLdr(renderer_msg_filter, descriptor, pair[1]);
(...skipping 21 matching lines...) Expand all
73 flags |= FD_CLOEXEC; 77 flags |= FD_CLOEXEC;
74 fcntl(duplicate_handle, F_SETFD, flags); 78 fcntl(duplicate_handle, F_SETFD, flags);
75 } 79 }
76 // No need to dup the handle - we don't pass it anywhere else so 80 // No need to dup the handle - we don't pass it anywhere else so
77 // it cannot be closed. 81 // it cannot be closed.
78 handle->fd = duplicate_handle; 82 handle->fd = duplicate_handle;
79 handle->auto_close = true; 83 handle->auto_close = true;
80 #endif 84 #endif
81 85
82 return true; 86 return true;
87 #endif // DISABLE_NACL
83 } 88 }
84 89
85 bool NaClProcessHost::LaunchSelLdr(ResourceMessageFilter* renderer_msg_filter, 90 bool NaClProcessHost::LaunchSelLdr(ResourceMessageFilter* renderer_msg_filter,
86 const int descriptor, 91 const int descriptor,
87 const nacl::Handle handle) { 92 const nacl::Handle handle) {
88 if (!CreateChannel()) 93 if (!CreateChannel())
89 return false; 94 return false;
90 95
91 // Build command line for nacl. 96 // Build command line for nacl.
92 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 97 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 182
178 void NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { 183 void NaClProcessHost::OnMessageReceived(const IPC::Message& msg) {
179 NOTREACHED() << "Invalid message with type = " << msg.type(); 184 NOTREACHED() << "Invalid message with type = " << msg.type();
180 } 185 }
181 186
182 URLRequestContext* NaClProcessHost::GetRequestContext( 187 URLRequestContext* NaClProcessHost::GetRequestContext(
183 uint32 request_id, 188 uint32 request_id,
184 const ViewHostMsg_Resource_Request& request_data) { 189 const ViewHostMsg_Resource_Request& request_data) {
185 return NULL; 190 return NULL;
186 } 191 }
187
OLDNEW
« no previous file with comments | « chrome/app/chrome_dll_main.cc ('k') | chrome/browser/plugin_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698