| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include "app/win_util.h" | 8 #include "app/win_util.h" |
| 9 #endif | 9 #endif |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 23 #include "chrome/test/injection_test_dll.h" | 23 #include "chrome/test/injection_test_dll.h" |
| 24 #include "sandbox/src/sandbox.h" | 24 #include "sandbox/src/sandbox.h" |
| 25 #elif defined(OS_LINUX) | 25 #elif defined(OS_LINUX) |
| 26 #include "base/global_descriptors_posix.h" | 26 #include "base/global_descriptors_posix.h" |
| 27 #include "ipc/ipc_descriptors.h" | 27 #include "ipc/ipc_descriptors.h" |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 // main() routine for running as the plugin process. | 30 // main() routine for running as the plugin process. |
| 31 int PluginMain(const MainFunctionParams& parameters) { | 31 int PluginMain(const MainFunctionParams& parameters) { |
| 32 // The main thread of the plugin services IO. | 32 // The main thread of the plugin services UI. |
| 33 MessageLoopForIO main_message_loop; | 33 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
| 34 std::wstring app_name = chrome::kBrowserAppName; | 34 std::wstring app_name = chrome::kBrowserAppName; |
| 35 PlatformThread::SetName(WideToASCII(app_name + L"_PluginMain").c_str()); | 35 PlatformThread::SetName(WideToASCII(app_name + L"_PluginMain").c_str()); |
| 36 | 36 |
| 37 // Initialize the SystemMonitor | 37 // Initialize the SystemMonitor |
| 38 base::SystemMonitor::Start(); | 38 base::SystemMonitor::Start(); |
| 39 | 39 |
| 40 const CommandLine& parsed_command_line = parameters.command_line_; | 40 const CommandLine& parsed_command_line = parameters.command_line_; |
| 41 | 41 |
| 42 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
| 43 sandbox::TargetServices* target_services = | 43 sandbox::TargetServices* target_services = |
| (...skipping 29 matching lines...) Expand all Loading... |
| 73 LOG(WARNING) << "Plugin (" | 73 LOG(WARNING) << "Plugin (" |
| 74 << getpid() | 74 << getpid() |
| 75 << ") paused waiting for debugger to attach @ pid"; | 75 << ") paused waiting for debugger to attach @ pid"; |
| 76 pause(); | 76 pause(); |
| 77 #else | 77 #else |
| 78 NOTIMPLEMENTED() << " non-windows startup, plugin startup dialog etc."; | 78 NOTIMPLEMENTED() << " non-windows startup, plugin startup dialog etc."; |
| 79 #endif | 79 #endif |
| 80 } | 80 } |
| 81 | 81 |
| 82 { | 82 { |
| 83 ChildProcess plugin_process(new PluginThread()); | 83 ChildProcess plugin_process; |
| 84 plugin_process.set_main_thread(new PluginThread()); |
| 84 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
| 85 if (!no_sandbox && target_services) | 86 if (!no_sandbox && target_services) |
| 86 target_services->LowerToken(); | 87 target_services->LowerToken(); |
| 87 | 88 |
| 88 if (sandbox_test_module) { | 89 if (sandbox_test_module) { |
| 89 RunRendererTests run_security_tests = | 90 RunRendererTests run_security_tests = |
| 90 reinterpret_cast<RunPluginTests>(GetProcAddress(sandbox_test_module, | 91 reinterpret_cast<RunPluginTests>(GetProcAddress(sandbox_test_module, |
| 91 kPluginTestCall)); | 92 kPluginTestCall)); |
| 92 DCHECK(run_security_tests); | 93 DCHECK(run_security_tests); |
| 93 if (run_security_tests) { | 94 if (run_security_tests) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 104 | 105 |
| 105 MessageLoop::current()->Run(); | 106 MessageLoop::current()->Run(); |
| 106 } | 107 } |
| 107 | 108 |
| 108 #if defined(OS_WIN) | 109 #if defined(OS_WIN) |
| 109 CoUninitialize(); | 110 CoUninitialize(); |
| 110 #endif | 111 #endif |
| 111 | 112 |
| 112 return 0; | 113 return 0; |
| 113 } | 114 } |
| OLD | NEW |