Moved DBus workaround to the run_gpu_test.py
[chromium-blink-merge.git] / ppapi / nacl_irt / plugin_main.cc
blob244bcbff4d7042aa1673e0c7aa9ca88e02db1425
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/message_loop/message_loop.h"
14 #include "base/threading/thread.h"
15 #include "ipc/ipc_logging.h"
16 #include "ppapi/nacl_irt/plugin_startup.h"
17 #include "ppapi/nacl_irt/ppapi_dispatcher.h"
18 #include "ppapi/proxy/plugin_globals.h"
19 #include "ppapi/shared_impl/ppb_audio_shared.h"
21 #if defined(__native_client__)
22 #include "native_client/src/shared/srpc/nacl_srpc_ppapi_plugin_internal.h"
23 #endif
25 void PpapiPluginRegisterThreadCreator(
26 const struct PP_ThreadFunctions* thread_functions) {
27 // Initialize all classes that need to create threads that call back into
28 // user code.
29 ppapi::PPB_Audio_Shared::SetThreadFunctions(thread_functions);
32 int PpapiPluginMain() {
33 base::MessageLoop loop;
34 ppapi::proxy::PluginGlobals plugin_globals;
36 #if defined(OS_NACL_SFI)
37 // This is currently needed so that the NaCl reverse service calls the
38 // StartupInitializationComplete() SRPC method, which unblocks plugin
39 // startup on the Chromium side.
40 // TODO(mseaborn): Remove the need to call this.
41 NaClPluginLowLevelInitializationComplete();
42 #endif
44 ppapi::PpapiDispatcher ppapi_dispatcher(
45 ppapi::GetIOThread()->message_loop_proxy(),
46 ppapi::GetShutdownEvent(),
47 ppapi::GetBrowserIPCFileDescriptor(),
48 ppapi::GetRendererIPCFileDescriptor());
49 plugin_globals.SetPluginProxyDelegate(&ppapi_dispatcher);
51 loop.Run();
53 return 0;