blob: f0e107f717df36da0813805484b355dbf44ed272 [file] [log] [blame]
[email protected]36254f732011-04-07 16:32:531// 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]e55f5642013-07-18 00:22:545#include "base/message_loop/message_loop.h"
fdoraye716a902016-07-05 16:05:496#include "base/run_loop.h"
[email protected]36254f732011-04-07 16:32:537#include "base/threading/platform_thread.h"
8#include "build/build_config.h"
[email protected]10208ea2013-06-06 20:08:039#include "content/child/child_process.h"
[email protected]91a2aea2013-07-08 23:14:3910#include "content/common/content_constants_internal.h"
[email protected]36254f732011-04-07 16:32:5311#include "content/ppapi_plugin/ppapi_thread.h"
[email protected]c08950d22011-10-13 22:20:2912#include "content/public/common/content_switches.h"
[email protected]4573fbd2011-10-31 20:25:1813#include "content/public/common/main_function_params.h"
[email protected]36254f732011-04-07 16:32:5314
[email protected]91355a82012-10-21 19:52:4715namespace content {
16
[email protected]36254f732011-04-07 16:32:5317// Main function for starting the PPAPI broker process.
[email protected]91355a82012-10-21 19:52:4718int PpapiBrokerMain(const MainFunctionParams& parameters) {
avi83883c82014-12-23 00:08:4919 const base::CommandLine& command_line = parameters.command_line;
[email protected]36254f732011-04-07 16:32:5320 if (command_line.HasSwitch(switches::kPpapiStartupDialog)) {
[email protected]6407f2892011-04-14 02:41:0921 ChildProcess::WaitForDebugger("PpapiBroker");
[email protected]36254f732011-04-07 16:32:5322 }
23
[email protected]1ef90012014-01-15 22:24:3324 base::MessageLoop main_message_loop;
[email protected]36254f732011-04-07 16:32:5325 base::PlatformThread::SetName("CrPPAPIBrokerMain");
ssidb2e3ece2015-02-09 16:02:2026 base::trace_event::TraceLog::GetInstance()->SetProcessName(
27 "PPAPI Broker Process");
28 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex(
[email protected]91a2aea2013-07-08 23:14:3929 kTraceEventPpapiBrokerProcessSortIndex);
[email protected]36254f732011-04-07 16:32:5330
31 ChildProcess ppapi_broker_process;
[email protected]a085aed72012-04-24 05:32:0432 ppapi_broker_process.set_main_thread(
33 new PpapiThread(parameters.command_line, true)); // Broker.
[email protected]36254f732011-04-07 16:32:5334
fdoraye716a902016-07-05 16:05:4935 base::RunLoop().Run();
[email protected]1977348dd2011-10-26 22:27:4136 DVLOG(1) << "PpapiBrokerMain exiting";
[email protected]36254f732011-04-07 16:32:5337 return 0;
38}
[email protected]91355a82012-10-21 19:52:4739
40} // namespace content