Roll WebRTC 9745:9761, Libjingle 9742:9761
[chromium-blink-merge.git] / ppapi / nacl_irt / plugin_main.cc
blob8cd491ec68bc2d155163e05f52e397ab108a549d
1 // Copyright 2014 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.
5 #include "ppapi/nacl_irt/plugin_main.h"
7 #include "build/build_config.h"
8 // Need to include this before most other files because it defines
9 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define
10 // IPC_MESSAGE_MACROS_LOG_ENABLED so ppapi_messages.h will generate the
11 // ViewMsgLog et al. functions.
13 #include "base/threading/thread.h"
14 #include "ipc/ipc_logging.h"
15 #include "ppapi/nacl_irt/plugin_startup.h"
16 #include "ppapi/nacl_irt/ppapi_dispatcher.h"
17 #include "ppapi/proxy/plugin_globals.h"
18 #include "ppapi/shared_impl/ppb_audio_shared.h"
20 void PpapiPluginRegisterThreadCreator(
21 const struct PP_ThreadFunctions* thread_functions) {
22 // Initialize all classes that need to create threads that call back into
23 // user code.
24 ppapi::PPB_Audio_Shared::SetThreadFunctions(thread_functions);
27 int PpapiPluginMain() {
28 base::MessageLoop loop;
29 ppapi::proxy::PluginGlobals plugin_globals(
30 scoped_refptr<base::TaskRunner>(ppapi::GetIOThread()->task_runner()));
32 ppapi::PpapiDispatcher ppapi_dispatcher(
33 ppapi::GetIOThread()->task_runner(), ppapi::GetShutdownEvent(),
34 ppapi::GetBrowserIPCFileDescriptor(),
35 ppapi::GetRendererIPCFileDescriptor());
36 plugin_globals.SetPluginProxyDelegate(&ppapi_dispatcher);
38 loop.Run();
40 return 0;