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

Side by Side Diff: components/nacl/loader/nacl_helper_win_64.cc

Issue 1387963006: Adding error handlers to setup.exe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix lint errors/warnings Created 5 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 | « components/nacl/loader/DEPS ('k') | content/BUILD.gn » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/nacl/loader/nacl_helper_win_64.h"
6
7 #include <string>
8
5 #include "base/command_line.h" 9 #include "base/command_line.h"
6 #include "base/logging.h" 10 #include "base/logging.h"
7 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
8 #include "base/power_monitor/power_monitor.h" 12 #include "base/power_monitor/power_monitor.h"
9 #include "base/power_monitor/power_monitor_device_source.h" 13 #include "base/power_monitor/power_monitor_device_source.h"
10 #include "base/process/launch.h" 14 #include "base/process/launch.h"
11 #include "base/process/memory.h" 15 #include "base/process/memory.h"
12 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
13 #include "base/timer/hi_res_timer_manager.h" 17 #include "base/timer/hi_res_timer_manager.h"
18 #include "base/win/process_startup_helper.h"
14 #include "components/nacl/broker/nacl_broker_listener.h" 19 #include "components/nacl/broker/nacl_broker_listener.h"
15 #include "components/nacl/common/nacl_switches.h" 20 #include "components/nacl/common/nacl_switches.h"
16 #include "components/nacl/loader/nacl_listener.h" 21 #include "components/nacl/loader/nacl_listener.h"
17 #include "components/nacl/loader/nacl_main_platform_delegate.h" 22 #include "components/nacl/loader/nacl_main_platform_delegate.h"
18 #include "content/public/app/startup_helper_win.h" 23 #include "content/public/app/sandbox_helper_win.h"
19 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
20 #include "content/public/common/main_function_params.h" 25 #include "content/public/common/main_function_params.h"
21 #include "content/public/common/sandbox_init.h" 26 #include "content/public/common/sandbox_init.h"
22 #include "sandbox/win/src/sandbox_types.h" 27 #include "sandbox/win/src/sandbox_types.h"
23 28
24 extern int NaClMain(const content::MainFunctionParams&); 29 extern int NaClMain(const content::MainFunctionParams&);
25 30
26 namespace { 31 namespace {
27 // main() routine for the NaCl broker process. 32 // main() routine for the NaCl broker process.
28 // This is necessary for supporting NaCl in Chrome on Win64. 33 // This is necessary for supporting NaCl in Chrome on Win64.
(...skipping 21 matching lines...) Expand all
50 content::InitializeSandboxInfo(&sandbox_info); 55 content::InitializeSandboxInfo(&sandbox_info);
51 56
52 const base::CommandLine& command_line = 57 const base::CommandLine& command_line =
53 *base::CommandLine::ForCurrentProcess(); 58 *base::CommandLine::ForCurrentProcess();
54 std::string process_type = 59 std::string process_type =
55 command_line.GetSwitchValueASCII(switches::kProcessType); 60 command_line.GetSwitchValueASCII(switches::kProcessType);
56 61
57 // Copy what ContentMain() does. 62 // Copy what ContentMain() does.
58 base::EnableTerminationOnHeapCorruption(); 63 base::EnableTerminationOnHeapCorruption();
59 base::EnableTerminationOnOutOfMemory(); 64 base::EnableTerminationOnOutOfMemory();
60 content::RegisterInvalidParamHandler(); 65 base::win::RegisterInvalidParamHandler();
61 content::SetupCRT(command_line); 66 base::win::SetupCRT(command_line);
62 // Route stdio to parent console (if any) or create one. 67 // Route stdio to parent console (if any) or create one.
63 if (command_line.HasSwitch(switches::kEnableLogging)) 68 if (command_line.HasSwitch(switches::kEnableLogging))
64 base::RouteStdioToConsole(true); 69 base::RouteStdioToConsole(true);
65 70
66 // Initialize the sandbox for this process. 71 // Initialize the sandbox for this process.
67 bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info); 72 bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info);
68 // Die if the sandbox can't be enabled. 73 // Die if the sandbox can't be enabled.
69 CHECK(sandbox_initialized_ok) << "Error initializing sandbox for " 74 CHECK(sandbox_initialized_ok) << "Error initializing sandbox for "
70 << process_type; 75 << process_type;
71 content::MainFunctionParams main_params(command_line); 76 content::MainFunctionParams main_params(command_line);
72 main_params.sandbox_info = &sandbox_info; 77 main_params.sandbox_info = &sandbox_info;
73 78
74 if (process_type == switches::kNaClLoaderProcess) 79 if (process_type == switches::kNaClLoaderProcess)
75 return NaClMain(main_params); 80 return NaClMain(main_params);
76 81
77 if (process_type == switches::kNaClBrokerProcess) 82 if (process_type == switches::kNaClBrokerProcess)
78 return NaClBrokerMain(main_params); 83 return NaClBrokerMain(main_params);
79 84
80 CHECK(false) << "Unknown NaCl 64 process."; 85 CHECK(false) << "Unknown NaCl 64 process.";
81 return -1; 86 return -1;
82 } 87 }
83 88
84 } // namespace nacl 89 } // namespace nacl
OLDNEW
« no previous file with comments | « components/nacl/loader/DEPS ('k') | content/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698