Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/nacl_irt/plugin_main.h" | 5 #include "ppapi/nacl_irt/plugin_main.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 // Need to include this before most other files because it defines | 8 // Need to include this before most other files because it defines |
| 9 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define | 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 | 10 // IPC_MESSAGE_MACROS_LOG_ENABLED so ppapi_messages.h will generate the |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 const struct PP_ThreadFunctions* thread_functions) { | 26 const struct PP_ThreadFunctions* thread_functions) { |
| 27 // Initialize all classes that need to create threads that call back into | 27 // Initialize all classes that need to create threads that call back into |
| 28 // user code. | 28 // user code. |
| 29 ppapi::PPB_Audio_Shared::SetThreadFunctions(thread_functions); | 29 ppapi::PPB_Audio_Shared::SetThreadFunctions(thread_functions); |
| 30 } | 30 } |
| 31 | 31 |
| 32 int PpapiPluginMain() { | 32 int PpapiPluginMain() { |
| 33 base::MessageLoop loop; | 33 base::MessageLoop loop; |
| 34 ppapi::proxy::PluginGlobals plugin_globals; | 34 ppapi::proxy::PluginGlobals plugin_globals; |
| 35 | 35 |
| 36 #if defined(__native_client__) | 36 #if defined(__native_client__) && !defined(__native_client_nonsfi__) |
|
Mark Seaborn
2014/10/27 18:59:07
Similarly, OS_NACL_SFI. You might as well commit
hidehiko
2014/10/28 20:14:00
Done.
| |
| 37 // Currently on non-SFI mode, we don't use SRPC server on plugin. | 37 // Currently on non-SFI mode, we don't use SRPC server on plugin. |
| 38 // TODO(hidehiko): Make sure this SRPC is actually used on SFI-mode. | 38 // TODO(hidehiko): Make sure this SRPC is actually used on SFI-mode. |
| 39 | 39 |
| 40 // Start up the SRPC server on another thread. Otherwise, when it blocks | 40 // Start up the SRPC server on another thread. Otherwise, when it blocks |
| 41 // on an RPC, the PPAPI proxy will hang. Do this before we initialize the | 41 // on an RPC, the PPAPI proxy will hang. Do this before we initialize the |
| 42 // module and start the PPAPI proxy so that the NaCl plugin can continue | 42 // module and start the PPAPI proxy so that the NaCl plugin can continue |
| 43 // loading the app. | 43 // loading the app. |
| 44 static struct NaClSrpcHandlerDesc srpc_methods[] = { { NULL, NULL } }; | 44 static struct NaClSrpcHandlerDesc srpc_methods[] = { { NULL, NULL } }; |
| 45 if (!NaClSrpcAcceptClientOnThread(srpc_methods)) { | 45 if (!NaClSrpcAcceptClientOnThread(srpc_methods)) { |
| 46 return 1; | 46 return 1; |
| 47 } | 47 } |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 ppapi::PpapiDispatcher ppapi_dispatcher( | 50 ppapi::PpapiDispatcher ppapi_dispatcher( |
| 51 ppapi::GetIOThread()->message_loop_proxy(), | 51 ppapi::GetIOThread()->message_loop_proxy(), |
| 52 ppapi::GetShutdownEvent(), | 52 ppapi::GetShutdownEvent(), |
| 53 ppapi::GetBrowserIPCFileDescriptor(), | 53 ppapi::GetBrowserIPCFileDescriptor(), |
| 54 ppapi::GetRendererIPCFileDescriptor()); | 54 ppapi::GetRendererIPCFileDescriptor()); |
| 55 plugin_globals.SetPluginProxyDelegate(&ppapi_dispatcher); | 55 plugin_globals.SetPluginProxyDelegate(&ppapi_dispatcher); |
| 56 | 56 |
| 57 loop.Run(); | 57 loop.Run(); |
| 58 | 58 |
| 59 return 0; | 59 return 0; |
| 60 } | 60 } |
| OLD | NEW |