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 "chrome/common/chrome_descriptors.h" | 26 #include "chrome/common/chrome_descriptors.h" |
27 #include "base/global_descriptors_posix.h" | 27 #include "base/global_descriptors_posix.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 UI. | 32 // The main thread of the plugin services IO. |
33 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 33 MessageLoopForIO main_message_loop; |
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; | 83 ChildProcess plugin_process(new PluginThread()); |
84 plugin_process.set_main_thread(new PluginThread()); | |
85 #if defined(OS_WIN) | 84 #if defined(OS_WIN) |
86 if (!no_sandbox && target_services) | 85 if (!no_sandbox && target_services) |
87 target_services->LowerToken(); | 86 target_services->LowerToken(); |
88 | 87 |
89 if (sandbox_test_module) { | 88 if (sandbox_test_module) { |
90 RunRendererTests run_security_tests = | 89 RunRendererTests run_security_tests = |
91 reinterpret_cast<RunPluginTests>(GetProcAddress(sandbox_test_module, | 90 reinterpret_cast<RunPluginTests>(GetProcAddress(sandbox_test_module, |
92 kPluginTestCall)); | 91 kPluginTestCall)); |
93 DCHECK(run_security_tests); | 92 DCHECK(run_security_tests); |
94 if (run_security_tests) { | 93 if (run_security_tests) { |
(...skipping 10 matching lines...) Expand all Loading... |
105 | 104 |
106 MessageLoop::current()->Run(); | 105 MessageLoop::current()->Run(); |
107 } | 106 } |
108 | 107 |
109 #if defined(OS_WIN) | 108 #if defined(OS_WIN) |
110 CoUninitialize(); | 109 CoUninitialize(); |
111 #endif | 110 #endif |
112 | 111 |
113 return 0; | 112 return 0; |
114 } | 113 } |
OLD | NEW |