[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "base/message_loop.h" | ||||
6 | #include "base/threading/platform_thread.h" | ||||
7 | #include "build/build_config.h" | ||||
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 8 | #include "content/common/child_process.h" |
9 | #include "content/common/main_function_params.h" | ||||
10 | #include "content/ppapi_plugin/ppapi_thread.h" | ||||
[email protected] | c08950d2 | 2011-10-13 22:20:29 | [diff] [blame^] | 11 | #include "content/public/common/content_switches.h" |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 12 | |
13 | // Main function for starting the PPAPI broker process. | ||||
14 | int PpapiBrokerMain(const MainFunctionParams& parameters) { | ||||
15 | const CommandLine& command_line = parameters.command_line_; | ||||
16 | if (command_line.HasSwitch(switches::kPpapiStartupDialog)) { | ||||
[email protected] | 6407f289 | 2011-04-14 02:41:09 | [diff] [blame] | 17 | ChildProcess::WaitForDebugger("PpapiBroker"); |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 18 | } |
19 | |||||
20 | MessageLoop main_message_loop(MessageLoop::TYPE_DEFAULT); | ||||
21 | base::PlatformThread::SetName("CrPPAPIBrokerMain"); | ||||
22 | |||||
23 | ChildProcess ppapi_broker_process; | ||||
[email protected] | 6407f289 | 2011-04-14 02:41:09 | [diff] [blame] | 24 | ppapi_broker_process.set_main_thread(new PpapiThread(true)); // Broker. |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 25 | |
26 | main_message_loop.Run(); | ||||
27 | return 0; | ||||
28 | } |