[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 | |||||
[email protected] | e55f564 | 2013-07-18 00:22:54 | [diff] [blame] | 5 | #include "base/message_loop/message_loop.h" |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 6 | #include "base/threading/platform_thread.h" |
7 | #include "build/build_config.h" | ||||
[email protected] | 10208ea | 2013-06-06 20:08:03 | [diff] [blame] | 8 | #include "content/child/child_process.h" |
[email protected] | 91a2aea | 2013-07-08 23:14:39 | [diff] [blame] | 9 | #include "content/common/content_constants_internal.h" |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 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] | 4573fbd | 2011-10-31 20:25:18 | [diff] [blame] | 12 | #include "content/public/common/main_function_params.h" |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 13 | |
[email protected] | 91355a8 | 2012-10-21 19:52:47 | [diff] [blame] | 14 | namespace content { |
15 | |||||
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 16 | // Main function for starting the PPAPI broker process. |
[email protected] | 91355a8 | 2012-10-21 19:52:47 | [diff] [blame] | 17 | int PpapiBrokerMain(const MainFunctionParams& parameters) { |
avi | 83883c8 | 2014-12-23 00:08:49 | [diff] [blame] | 18 | const base::CommandLine& command_line = parameters.command_line; |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 19 | if (command_line.HasSwitch(switches::kPpapiStartupDialog)) { |
[email protected] | 6407f289 | 2011-04-14 02:41:09 | [diff] [blame] | 20 | ChildProcess::WaitForDebugger("PpapiBroker"); |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 21 | } |
22 | |||||
[email protected] | 1ef9001 | 2014-01-15 22:24:33 | [diff] [blame] | 23 | base::MessageLoop main_message_loop; |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 24 | base::PlatformThread::SetName("CrPPAPIBrokerMain"); |
ssid | b2e3ece | 2015-02-09 16:02:20 | [diff] [blame] | 25 | base::trace_event::TraceLog::GetInstance()->SetProcessName( |
26 | "PPAPI Broker Process"); | ||||
27 | base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( | ||||
[email protected] | 91a2aea | 2013-07-08 23:14:39 | [diff] [blame] | 28 | kTraceEventPpapiBrokerProcessSortIndex); |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 29 | |
30 | ChildProcess ppapi_broker_process; | ||||
[email protected] | a085aed7 | 2012-04-24 05:32:04 | [diff] [blame] | 31 | ppapi_broker_process.set_main_thread( |
32 | new PpapiThread(parameters.command_line, true)); // Broker. | ||||
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 33 | |
34 | main_message_loop.Run(); | ||||
[email protected] | 1977348dd | 2011-10-26 22:27:41 | [diff] [blame] | 35 | DVLOG(1) << "PpapiBrokerMain exiting"; |
[email protected] | 36254f73 | 2011-04-07 16:32:53 | [diff] [blame] | 36 | return 0; |
37 | } | ||||
[email protected] | 91355a8 | 2012-10-21 19:52:47 | [diff] [blame] | 38 | |
39 | } // namespace content |