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