blob: edaaa103f87cbea7ae3dc3c1dbcac166d72adf34 [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
5#include "base/message_loop.h"
6#include "base/threading/platform_thread.h"
7#include "build/build_config.h"
8#include "chrome/common/chrome_switches.h"
9#include "content/common/child_process.h"
10#include "content/common/main_function_params.h"
11#include "content/ppapi_plugin/ppapi_thread.h"
12
13// Main function for starting the PPAPI broker process.
14int PpapiBrokerMain(const MainFunctionParams& parameters) {
15 const CommandLine& command_line = parameters.command_line_;
16 if (command_line.HasSwitch(switches::kPpapiStartupDialog)) {
17 ChildProcess::WaitForDebugger("Ppapi");
18 }
19
20 MessageLoop main_message_loop(MessageLoop::TYPE_DEFAULT);
21 base::PlatformThread::SetName("CrPPAPIBrokerMain");
22
23 ChildProcess ppapi_broker_process;
24 //TODO:(ddorwin): Parameterize PpapiThread so the broker can reuse it.
25 ppapi_broker_process.set_main_thread(new PpapiThread());
26
27 main_message_loop.Run();
28 return 0;
29}