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/run_loop.h" 6 #include "base/task/single_thread_task_executor.h" 7 #include "base/threading/platform_thread.h" 8 #include "build/build_config.h" 9 #include "content/child/child_process.h" 10 #include "content/common/content_constants_internal.h" 11 #include "content/common/content_switches_internal.h" 12 #include "content/ppapi_plugin/ppapi_thread.h" 13 #include "content/public/common/content_switches.h" 14 #include "content/public/common/main_function_params.h" 15 16 namespace content { 17 18 // Main function for starting the PPAPI broker process. PpapiBrokerMain(const MainFunctionParams & parameters)19int PpapiBrokerMain(const MainFunctionParams& parameters) { 20 const base::CommandLine& command_line = parameters.command_line; 21 if (command_line.HasSwitch(switches::kPpapiStartupDialog)) 22 WaitForDebugger("PpapiBroker"); 23 24 base::SingleThreadTaskExecutor main_thread_task_executor; 25 base::PlatformThread::SetName("CrPPAPIBrokerMain"); 26 base::trace_event::TraceLog::GetInstance()->set_process_name( 27 "PPAPI Broker Process"); 28 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( 29 kTraceEventPpapiBrokerProcessSortIndex); 30 31 ChildProcess ppapi_broker_process; 32 base::RunLoop run_loop; 33 ppapi_broker_process.set_main_thread(new PpapiThread( 34 run_loop.QuitClosure(), parameters.command_line, true /* Broker */)); 35 36 run_loop.Run(); 37 DVLOG(1) << "PpapiBrokerMain exiting"; 38 return 0; 39 } 40 41 } // namespace content 42