Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/debug/debugger.h" | |
| 5 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 6 #include "base/threading/platform_thread.h" | 7 #include "base/threading/platform_thread.h" |
| 7 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 8 #include "content/common/child_process.h" | 9 #include "content/common/child_process.h" |
| 9 #include "content/common/content_switches.h" | 10 #include "content/common/content_switches.h" |
| 10 #include "content/common/main_function_params.h" | 11 #include "content/common/main_function_params.h" |
| 11 #include "content/ppapi_plugin/ppapi_thread.h" | 12 #include "content/ppapi_plugin/ppapi_thread.h" |
| 12 | 13 |
| 14 #if defined(OS_WIN) | |
| 15 #include "sandbox/src/sandbox.h" | |
| 16 #endif | |
| 17 | |
| 18 #if defined(OS_WIN) | |
| 19 sandbox::TargetServices* g_target_services; | |
|
brettw
2011/05/06 04:30:52
It's weird you initialize the void* below and not
| |
| 20 #else | |
| 21 void* g_target_services = 0; | |
| 22 #endif | |
| 23 | |
| 13 // Main function for starting the PPAPI plugin process. | 24 // Main function for starting the PPAPI plugin process. |
| 14 int PpapiPluginMain(const MainFunctionParams& parameters) { | 25 int PpapiPluginMain(const MainFunctionParams& parameters) { |
| 15 const CommandLine& command_line = parameters.command_line_; | 26 const CommandLine& command_line = parameters.command_line_; |
| 27 | |
| 28 #if defined(OS_WIN) | |
| 29 g_target_services = parameters.sandbox_info_.TargetServices(); | |
| 30 #endif | |
| 31 | |
| 32 // If |g_target_services| is not null this process is sandboxed. One side | |
| 33 // effect is that we can't pop dialogs like ChildProcess::WaitForDebugger() | |
| 34 // does. | |
| 16 if (command_line.HasSwitch(switches::kPpapiStartupDialog)) { | 35 if (command_line.HasSwitch(switches::kPpapiStartupDialog)) { |
| 17 ChildProcess::WaitForDebugger("Ppapi"); | 36 if (g_target_services) |
| 37 base::debug::WaitForDebugger(2*60, false); | |
| 38 else | |
| 39 ChildProcess::WaitForDebugger("Ppapi"); | |
| 18 } | 40 } |
| 19 | 41 |
| 20 MessageLoop main_message_loop(MessageLoop::TYPE_UI); | 42 MessageLoop main_message_loop(MessageLoop::TYPE_UI); |
| 21 base::PlatformThread::SetName("CrPPAPIMain"); | 43 base::PlatformThread::SetName("CrPPAPIMain"); |
| 22 | 44 |
| 23 ChildProcess ppapi_process; | 45 ChildProcess ppapi_process; |
| 24 ppapi_process.set_main_thread(new PpapiThread(false)); // Not a broker. | 46 ppapi_process.set_main_thread(new PpapiThread(false)); // Not a broker. |
| 25 | 47 |
| 26 main_message_loop.Run(); | 48 main_message_loop.Run(); |
| 27 return 0; | 49 return 0; |
| 28 } | 50 } |
| OLD | NEW |