blob: b441d7a6b9f6451edef4ce75c92c72d391dded2c [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"
[email protected]36254f732011-04-07 16:32:536#include "base/threading/platform_thread.h"
7#include "build/build_config.h"
[email protected]10208ea2013-06-06 20:08:038#include "content/child/child_process.h"
[email protected]91a2aea2013-07-08 23:14:399#include "content/common/content_constants_internal.h"
[email protected]36254f732011-04-07 16:32:5310#include "content/ppapi_plugin/ppapi_thread.h"
[email protected]c08950d22011-10-13 22:20:2911#include "content/public/common/content_switches.h"
[email protected]4573fbd2011-10-31 20:25:1812#include "content/public/common/main_function_params.h"
[email protected]36254f732011-04-07 16:32:5313
[email protected]91355a82012-10-21 19:52:4714namespace content {
15
[email protected]36254f732011-04-07 16:32:5316// Main function for starting the PPAPI broker process.
[email protected]91355a82012-10-21 19:52:4717int PpapiBrokerMain(const MainFunctionParams& parameters) {
avi83883c82014-12-23 00:08:4918 const base::CommandLine& command_line = parameters.command_line;
[email protected]36254f732011-04-07 16:32:5319 if (command_line.HasSwitch(switches::kPpapiStartupDialog)) {
[email protected]6407f2892011-04-14 02:41:0920 ChildProcess::WaitForDebugger("PpapiBroker");
[email protected]36254f732011-04-07 16:32:5321 }
22
[email protected]1ef90012014-01-15 22:24:3323 base::MessageLoop main_message_loop;
[email protected]36254f732011-04-07 16:32:5324 base::PlatformThread::SetName("CrPPAPIBrokerMain");
ssidb2e3ece2015-02-09 16:02:2025 base::trace_event::TraceLog::GetInstance()->SetProcessName(
26 "PPAPI Broker Process");
27 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex(
[email protected]91a2aea2013-07-08 23:14:3928 kTraceEventPpapiBrokerProcessSortIndex);
[email protected]36254f732011-04-07 16:32:5329
30 ChildProcess ppapi_broker_process;
[email protected]a085aed72012-04-24 05:32:0431 ppapi_broker_process.set_main_thread(
32 new PpapiThread(parameters.command_line, true)); // Broker.
[email protected]36254f732011-04-07 16:32:5333
34 main_message_loop.Run();
[email protected]1977348dd2011-10-26 22:27:4135 DVLOG(1) << "PpapiBrokerMain exiting";
[email protected]36254f732011-04-07 16:32:5336 return 0;
37}
[email protected]91355a82012-10-21 19:52:4738
39} // namespace content