Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include "native_client/src/shared/ppapi_proxy/ppruntime.h" | 7 #include "native_client/src/shared/ppapi_proxy/ppruntime.h" |
| 8 #include "native_client/src/untrusted/irt/irt.h" | 8 #include "native_client/src/untrusted/irt/irt.h" |
| 9 #include "native_client/src/untrusted/irt/irt_ppapi.h" | 9 #include "native_client/src/untrusted/irt/irt_ppapi.h" |
| 10 | 10 |
| 11 struct PP_StartFunctions g_pp_functions; | 11 struct PP_StartFunctions g_pp_functions; |
| 12 int ppapi_pre_initialized = 0; | |
| 13 | |
| 14 static void irt_ppapi_pre_start() { | |
|
pasko-google - do not use
2011/08/10 21:16:33
blah_pre_start is not a self descriptive name, I w
halyavin
2011/08/12 08:52:07
This code is rewritten.
| |
| 15 ppapi_pre_initialized = 1; | |
| 16 PpapiPluginPreInit(); | |
| 17 } | |
| 12 | 18 |
| 13 static int irt_ppapi_start(const struct PP_StartFunctions *funcs) { | 19 static int irt_ppapi_start(const struct PP_StartFunctions *funcs) { |
| 14 g_pp_functions = *funcs; | 20 g_pp_functions = *funcs; |
| 15 return PpapiPluginMain(); | 21 if (!ppapi_pre_initialized) { |
| 22 irt_ppapi_pre_start(); | |
| 23 } | |
| 24 return PpapiPluginPostInit(); | |
| 16 } | 25 } |
| 17 | 26 |
| 18 int32_t PPP_InitializeModule(PP_Module module_id, | 27 int32_t PPP_InitializeModule(PP_Module module_id, |
| 19 PPB_GetInterface get_browser_interface) { | 28 PPB_GetInterface get_browser_interface) { |
| 20 return g_pp_functions.PPP_InitializeModule(module_id, get_browser_interface); | 29 return g_pp_functions.PPP_InitializeModule(module_id, get_browser_interface); |
| 21 } | 30 } |
| 22 | 31 |
| 23 void PPP_ShutdownModule() { | 32 void PPP_ShutdownModule() { |
| 24 g_pp_functions.PPP_ShutdownModule(); | 33 g_pp_functions.PPP_ShutdownModule(); |
| 25 } | 34 } |
| 26 | 35 |
| 27 const void *PPP_GetInterface(const char *interface_name) { | 36 const void *PPP_GetInterface(const char *interface_name) { |
| 28 return g_pp_functions.PPP_GetInterface(interface_name); | 37 return g_pp_functions.PPP_GetInterface(interface_name); |
| 29 } | 38 } |
| 30 | 39 |
| 31 /* | 40 /* |
| 32 * This overrides the definition in ppapi_proxy/plugin_threading.cc. | 41 * This overrides the definition in ppapi_proxy/plugin_threading.cc. |
| 33 * TODO(mseaborn): Remove this when PPAPI is only supported via the IRT. | 42 * TODO(mseaborn): Remove this when PPAPI is only supported via the IRT. |
| 34 * See http://code.google.com/p/nativeclient/issues/detail?id=1691 | 43 * See http://code.google.com/p/nativeclient/issues/detail?id=1691 |
| 35 */ | 44 */ |
| 36 void PpapiPluginRegisterDefaultThreadCreator() { | 45 void PpapiPluginRegisterDefaultThreadCreator() { |
| 37 } | 46 } |
| 38 | 47 |
| 39 const struct nacl_irt_ppapihook nacl_irt_ppapihook = { | 48 const struct nacl_irt_ppapihook nacl_irt_ppapihook = { |
| 40 irt_ppapi_start, | 49 irt_ppapi_start, |
| 41 PpapiPluginRegisterThreadCreator, | 50 PpapiPluginRegisterThreadCreator, |
| 42 }; | 51 }; |
| 52 | |
| 53 const struct nacl_irt_ppapihook_0_2 nacl_irt_ppapihook_0_2 = { | |
| 54 irt_ppapi_start, | |
| 55 PpapiPluginRegisterThreadCreator, | |
| 56 irt_ppapi_pre_start, | |
| 57 }; | |
| OLD | NEW |