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

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

Issue 6995121: New NaCl zygote implementation 2 (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Use IPC::Channel directly instead of ChildProcess Created 9 years, 6 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/system_monitor/system_monitor.h" 14 #include "base/system_monitor/system_monitor.h"
15 #include "chrome/common/chrome_constants.h" 15 #include "chrome/common/chrome_constants.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/logging_chrome.h" 17 #include "chrome/common/logging_chrome.h"
18 #include "chrome/nacl/nacl_launcher_thread.h" 18 #include "chrome/nacl/nacl_listener.h"
19 #include "chrome/nacl/nacl_main_platform_delegate.h" 19 #include "chrome/nacl/nacl_main_platform_delegate.h"
20 #include "content/common/child_process.h" 20 #include "content/common/child_process.h"
21 #include "content/common/hi_res_timer_manager.h" 21 #include "content/common/hi_res_timer_manager.h"
22 #include "content/common/main_function_params.h" 22 #include "content/common/main_function_params.h"
23 #include "content/common/result_codes.h" 23 #include "content/common/result_codes.h"
24 #include "content/common/sandbox_policy.h" 24 #include "content/common/sandbox_policy.h"
25 25
26 #if defined(OS_WIN) 26 #if defined(OS_WIN)
27 #include "chrome/nacl/broker_thread.h" 27 #include "chrome/nacl/broker_thread.h"
28 #include "sandbox/src/sandbox.h" 28 #include "sandbox/src/sandbox.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 platform.PlatformInitialize(); 110 platform.PlatformInitialize();
111 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox); 111 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox);
112 platform.InitSandboxTests(no_sandbox); 112 platform.InitSandboxTests(no_sandbox);
113 113
114 if (!no_sandbox) { 114 if (!no_sandbox) {
115 platform.EnableSandbox(); 115 platform.EnableSandbox();
116 } 116 }
117 bool sandbox_test_result = platform.RunSandboxTests(); 117 bool sandbox_test_result = platform.RunSandboxTests();
118 118
119 if (sandbox_test_result) { 119 if (sandbox_test_result) {
120 ChildProcess nacl_process; 120 NaClListener listener;
121 bool debug = parsed_command_line.HasSwitch(switches::kEnableNaClDebug); 121 IPC::Channel chan(kNaClListenerHandle,
jam 2011/06/21 20:54:08 nit: channel not chan per style guide
Brad Chen 2011/06/21 23:43:48 Done.
122 nacl_process.set_main_thread(new NaClLauncherThread(debug)); 122 IPC::Channel::MODE_CLIENT, &listener);
123 CHECK(chan.Connect());
123 MessageLoop::current()->Run(); 124 MessageLoop::current()->Run();
124 } else { 125 } else {
125 // This indirectly prevents the test-harness-success-cookie from being set, 126 // This indirectly prevents the test-harness-success-cookie from being set,
126 // as a way of communicating test failure, because the nexe won't reply. 127 // as a way of communicating test failure, because the nexe won't reply.
127 // TODO(jvoung): find a better way to indicate failure that doesn't 128 // TODO(jvoung): find a better way to indicate failure that doesn't
128 // require waiting for a timeout. 129 // require waiting for a timeout.
129 VLOG(1) << "Sandbox test failed: Not launching NaCl process"; 130 VLOG(1) << "Sandbox test failed: Not launching NaCl process";
130 } 131 }
131 #else 132 #else
132 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc."; 133 NOTIMPLEMENTED() << " not implemented startup, plugin startup dialog etc.";
133 #endif 134 #endif
134 135
135 platform.PlatformUninitialize(); 136 platform.PlatformUninitialize();
136 return 0; 137 return 0;
137 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698