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

Side by Side Diff: components/nacl/broker/nacl_exe_win_64.cc

Issue 16881004: Move chrome/nacl to components/nacl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows build fix Created 7 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
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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/hi_res_timer_manager.h" 7 #include "base/hi_res_timer_manager.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/power_monitor/power_monitor.h" 10 #include "base/power_monitor/power_monitor.h"
11 #include "base/process_util.h" 11 #include "base/process_util.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "chrome/app/breakpad_win.h" 13 #include "components/nacl/broker/nacl_broker_listener.h"
14 #include "chrome/common/chrome_result_codes.h" 14 #include "components/nacl/common/nacl_delegate.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "components/nacl/common/nacl_switches.h"
16 #include "chrome/common/logging_chrome.h" 16 #include "components/nacl/loader/nacl_listener.h"
17 #include "chrome/nacl/nacl_broker_listener.h" 17 #include "components/nacl/loader/nacl_main_platform_delegate.h"
18 #include "chrome/nacl/nacl_listener.h"
19 #include "chrome/nacl/nacl_main_platform_delegate.h"
20 #include "content/public/app/startup_helper_win.h" 18 #include "content/public/app/startup_helper_win.h"
19 #include "content/public/common/content_switches.h"
21 #include "content/public/common/main_function_params.h" 20 #include "content/public/common/main_function_params.h"
22 #include "content/public/common/sandbox_init.h" 21 #include "content/public/common/sandbox_init.h"
23 #include "sandbox/win/src/sandbox_types.h" 22 #include "sandbox/win/src/sandbox_types.h"
24 23
25 extern int NaClMain(const content::MainFunctionParams&); 24 extern int NaClMain(const content::MainFunctionParams&);
25 extern void InitCrashReporter();
jam 2013/06/17 20:10:43 again, you can not forward declare code from chrom
yael.aharon1 2013/06/18 17:16:30 jochen is in the process of moving this code to co
jam 2013/06/19 17:55:53 you should wait for that to happen first then. it'
yael.aharon1 2013/06/19 20:38:52 Since I could not find an immediate solution, I mo
26 26
27 // main() routine for the NaCl broker process. 27 // main() routine for the NaCl broker process.
28 // This is necessary for supporting NaCl in Chrome on Win64. 28 // This is necessary for supporting NaCl in Chrome on Win64.
29 int NaClBrokerMain(const content::MainFunctionParams& parameters) { 29 int NaClBrokerMain(const content::MainFunctionParams& parameters) {
30 const CommandLine& parsed_command_line = parameters.command_line; 30 const CommandLine& parsed_command_line = parameters.command_line;
31 31
32 base::MessageLoopForIO main_message_loop; 32 base::MessageLoopForIO main_message_loop;
33 base::PlatformThread::SetName("CrNaClBrokerMain"); 33 base::PlatformThread::SetName("CrNaClBrokerMain");
34 34
35 base::PowerMonitor power_monitor; 35 base::PowerMonitor power_monitor;
36 HighResolutionTimerManager hi_res_timer_manager; 36 HighResolutionTimerManager hi_res_timer_manager;
37 37
38 NaClBrokerListener listener; 38 NaClBrokerListener listener;
39 listener.Listen(); 39 listener.Listen();
40 40
41 return 0; 41 return 0;
42 } 42 }
43 43
44 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { 44 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
45 sandbox::SandboxInterfaceInfo sandbox_info = {0}; 45 sandbox::SandboxInterfaceInfo sandbox_info = {0};
46 content::InitializeSandboxInfo(&sandbox_info); 46 content::InitializeSandboxInfo(&sandbox_info);
47 47
48 base::AtExitManager exit_manager; 48 base::AtExitManager exit_manager;
49 CommandLine::Init(0, NULL); 49 CommandLine::Init(0, NULL);
50 50
51 InitCrashReporter(); 51 InitCrashReporter();
52 52
53 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 53 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
54 std::string process_type = 54 std::string process_type = command_line.GetSwitchValueASCII(
55 command_line.GetSwitchValueASCII(switches::kProcessType); 55 switches::kProcessType);
56 56
57 // Copy what ContentMain() does. 57 // Copy what ContentMain() does.
58 base::EnableTerminationOnHeapCorruption(); 58 base::EnableTerminationOnHeapCorruption();
59 base::EnableTerminationOnOutOfMemory(); 59 base::EnableTerminationOnOutOfMemory();
60 content::RegisterInvalidParamHandler(); 60 content::RegisterInvalidParamHandler();
61 content::SetupCRT(command_line); 61 content::SetupCRT(command_line);
62 // Route stdio to parent console (if any) or create one. 62 // Route stdio to parent console (if any) or create one.
63 if (command_line.HasSwitch(switches::kEnableLogging)) 63 if (command_line.HasSwitch(switches::kEnableLogging))
64 base::RouteStdioToConsole(); 64 base::RouteStdioToConsole();
65 65
66 // Initialize the sandbox for this process. 66 // Initialize the sandbox for this process.
67 bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info); 67 bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info);
68 // Die if the sandbox can't be enabled. 68 // Die if the sandbox can't be enabled.
69 CHECK(sandbox_initialized_ok) << "Error initializing sandbox for " 69 CHECK(sandbox_initialized_ok) << "Error initializing sandbox for "
70 << process_type; 70 << process_type;
71 content::MainFunctionParams main_params(command_line); 71 content::MainFunctionParams main_params(command_line);
72 main_params.sandbox_info = &sandbox_info; 72 main_params.sandbox_info = &sandbox_info;
73 73
74 if (process_type == switches::kNaClLoaderProcess) 74 if (process_type == switches::kNaClLoaderProcess)
75 return NaClMain(main_params); 75 return NaClMain(main_params);
76 76
77 if (process_type == switches::kNaClBrokerProcess) 77 if (process_type == switches::kNaClBrokerProcess)
78 return NaClBrokerMain(main_params); 78 return NaClBrokerMain(main_params);
79 79
80 CHECK(false) << "Unknown NaCl 64 process."; 80 CHECK(false) << "Unknown NaCl 64 process.";
81 return -1; 81 return -1;
82 } 82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698