[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" |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 9 | #include "content/ppapi_plugin/ppapi_thread.h" |
[email protected] | c08950d2 | 2011-10-13 22:20:29 | [diff] [blame] | 10 | #include "content/public/common/content_switches.h" |
[email protected] | 4573fbd | 2011-10-31 20:25:18 | [diff] [blame^] | 11 | #include "content/public/common/main_function_params.h" |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 12 | |
13 | // Main function for starting the PPAPI broker process. | ||||
[email protected] | 4573fbd | 2011-10-31 20:25:18 | [diff] [blame^] | 14 | int PpapiBrokerMain(const content::MainFunctionParams& parameters) { |
[email protected] | badf5cf | 2011-10-29 03:44:44 | [diff] [blame] | 15 | const CommandLine& command_line = parameters.command_line; |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 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(); | ||||
[email protected] | 1977348dd | 2011-10-26 22:27:41 | [diff] [blame] | 27 | DVLOG(1) << "PpapiBrokerMain exiting"; |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 28 | return 0; |
29 | } |