[andorid_webview] Don't 'jiggle' on overscroll
[chromium-blink-merge.git] / chrome / nacl / nacl_exe_win_64.cc
blob47e19c69591dab3c195956c3a3c18d0e99737adf
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
3 // found in the LICENSE file.
5 #include "base/at_exit.h"
6 #include "base/command_line.h"
7 #include "base/lazy_instance.h"
8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h"
10 #include "base/power_monitor/power_monitor.h"
11 #include "base/power_monitor/power_monitor_device_source.h"
12 #include "base/process/launch.h"
13 #include "base/process/memory.h"
14 #include "base/strings/string_util.h"
15 #include "base/timer/hi_res_timer_manager.h"
16 #include "chrome/app/breakpad_win.h"
17 #include "chrome/app/chrome_breakpad_client.h"
18 #include "chrome/common/chrome_result_codes.h"
19 #include "chrome/common/logging_chrome.h"
20 #include "components/breakpad/breakpad_client.h"
21 #include "components/nacl/broker/nacl_broker_listener.h"
22 #include "components/nacl/common/nacl_switches.h"
23 #include "components/nacl/loader/nacl_listener.h"
24 #include "components/nacl/loader/nacl_main_platform_delegate.h"
25 #include "content/public/app/startup_helper_win.h"
26 #include "content/public/common/content_switches.h"
27 #include "content/public/common/main_function_params.h"
28 #include "content/public/common/sandbox_init.h"
29 #include "sandbox/win/src/sandbox_types.h"
31 extern int NaClMain(const content::MainFunctionParams&);
33 namespace {
35 base::LazyInstance<chrome::ChromeBreakpadClient>::Leaky
36 g_chrome_breakpad_client = LAZY_INSTANCE_INITIALIZER;
38 } // namespace
40 // main() routine for the NaCl broker process.
41 // This is necessary for supporting NaCl in Chrome on Win64.
42 int NaClBrokerMain(const content::MainFunctionParams& parameters) {
43 base::MessageLoopForIO main_message_loop;
44 base::PlatformThread::SetName("CrNaClBrokerMain");
46 scoped_ptr<base::PowerMonitorSource> power_monitor_source(
47 new base::PowerMonitorDeviceSource());
48 base::PowerMonitor power_monitor(power_monitor_source.Pass());
49 base::HighResolutionTimerManager hi_res_timer_manager;
51 NaClBrokerListener listener;
52 listener.Listen();
54 return 0;
57 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
58 sandbox::SandboxInterfaceInfo sandbox_info = {0};
59 content::InitializeSandboxInfo(&sandbox_info);
61 base::AtExitManager exit_manager;
62 CommandLine::Init(0, NULL);
64 breakpad::SetBreakpadClient(g_chrome_breakpad_client.Pointer());
65 InitCrashReporter();
67 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
68 std::string process_type =
69 command_line.GetSwitchValueASCII(switches::kProcessType);
71 // Copy what ContentMain() does.
72 base::EnableTerminationOnHeapCorruption();
73 base::EnableTerminationOnOutOfMemory();
74 content::RegisterInvalidParamHandler();
75 content::SetupCRT(command_line);
76 // Route stdio to parent console (if any) or create one.
77 if (command_line.HasSwitch(switches::kEnableLogging))
78 base::RouteStdioToConsole();
80 // Initialize the sandbox for this process.
81 bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info);
82 // Die if the sandbox can't be enabled.
83 CHECK(sandbox_initialized_ok) << "Error initializing sandbox for "
84 << process_type;
85 content::MainFunctionParams main_params(command_line);
86 main_params.sandbox_info = &sandbox_info;
88 if (process_type == switches::kNaClLoaderProcess)
89 return NaClMain(main_params);
91 if (process_type == switches::kNaClBrokerProcess)
92 return NaClBrokerMain(main_params);
94 CHECK(false) << "Unknown NaCl 64 process.";
95 return -1;