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