OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/system_monitor.h" |
7 #include "chrome/common/chrome_constants.h" | 8 #include "chrome/common/chrome_constants.h" |
8 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/logging_chrome.h" | 10 #include "chrome/common/logging_chrome.h" |
10 #include "chrome/common/win_util.h" | 11 #include "chrome/common/win_util.h" |
11 #include "chrome/plugin/plugin_process.h" | 12 #include "chrome/plugin/plugin_process.h" |
12 #include "chrome/test/injection_test_dll.h" | 13 #include "chrome/test/injection_test_dll.h" |
13 #include "sandbox/src/sandbox.h" | 14 #include "sandbox/src/sandbox.h" |
14 | 15 |
15 // mainline routine for running as the plugin process | 16 // mainline routine for running as the plugin process |
16 int PluginMain(CommandLine &parsed_command_line, | 17 int PluginMain(CommandLine &parsed_command_line, |
17 sandbox::TargetServices* target_services) { | 18 sandbox::TargetServices* target_services) { |
18 // The main thread of the plugin services IO. | 19 // The main thread of the plugin services IO. |
19 MessageLoopForIO main_message_loop; | 20 MessageLoopForIO main_message_loop; |
20 std::wstring app_name = chrome::kBrowserAppName; | 21 std::wstring app_name = chrome::kBrowserAppName; |
21 PlatformThread::SetName(WideToASCII(app_name + L"_PluginMain").c_str()); | 22 PlatformThread::SetName(WideToASCII(app_name + L"_PluginMain").c_str()); |
22 | 23 |
| 24 // Initialize the SystemMonitor |
| 25 base::SystemMonitor::Start(); |
| 26 |
23 CoInitialize(NULL); | 27 CoInitialize(NULL); |
24 DLOG(INFO) << "Started plugin with " << | 28 DLOG(INFO) << "Started plugin with " << |
25 parsed_command_line.command_line_string(); | 29 parsed_command_line.command_line_string(); |
26 | 30 |
27 HMODULE sandbox_test_module = NULL; | 31 HMODULE sandbox_test_module = NULL; |
28 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox) || | 32 bool no_sandbox = parsed_command_line.HasSwitch(switches::kNoSandbox) || |
29 !parsed_command_line.HasSwitch(switches::kSafePlugins); | 33 !parsed_command_line.HasSwitch(switches::kSafePlugins); |
30 if (target_services && !no_sandbox) { | 34 if (target_services && !no_sandbox) { |
31 // The command line might specify a test dll to load. | 35 // The command line might specify a test dll to load. |
32 if (parsed_command_line.HasSwitch(switches::kTestSandbox)) { | 36 if (parsed_command_line.HasSwitch(switches::kTestSandbox)) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Load the accelerator table from the browser executable and tell the | 76 // Load the accelerator table from the browser executable and tell the |
73 // message loop to use it when translating messages. | 77 // message loop to use it when translating messages. |
74 MessageLoop::current()->Run(); | 78 MessageLoop::current()->Run(); |
75 } | 79 } |
76 PluginProcess::GlobalCleanup(); | 80 PluginProcess::GlobalCleanup(); |
77 | 81 |
78 CoUninitialize(); | 82 CoUninitialize(); |
79 return 0; | 83 return 0; |
80 } | 84 } |
81 | 85 |
OLD | NEW |