Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: ppapi/proxy/irt_shim_ppapi.c

Issue 164373010: Split the PNaCl IRT shim into 3 pieces, and include one piece into IRT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix headers Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 #include "native_client/src/untrusted/irt/irt.h"
8 #include "ppapi/nacl_irt/irt_ppapi.h"
9 #include "ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h"
10 #include "ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.h"
11
12 /*
13 * Defines a version of the version irt_ppapi_start and of the irt_ppapihook
14 * that returns a shimmed GetInterface for PNaCl.
15 *
16 * The hook will be linked into the IRT but it is considered unstable,
17 * should not use that IRT hook. Instead PNaCl nexes should embed the
18 * irt_shim_ppapi_start and the shim functions directly into the nexe
19 * for stability.
20 */
21
22 static struct PP_StartFunctions user_start_functions;
23
24 static int32_t shim_PPPInitializeModule(PP_Module module_id,
25 PPB_GetInterface get_browser_intf) {
26 /* Record the original PPB_GetInterface and provide a shimmed one. */
27 __set_real_Pnacl_PPBGetInterface(get_browser_intf);
28 return (*user_start_functions.PPP_InitializeModule)(module_id,
29 &__Pnacl_PPBGetInterface);
30 }
31
32 static void shim_PPPShutdownModule() {
33 (*user_start_functions.PPP_ShutdownModule)();
34 }
35
36 #if PNACL_SHIM_AOT
37 /*
38 * This will be overridden by the shim.
39 */
40 int (*real_irt_ppapi_start)(const struct PP_StartFunctions *) = NULL;
41 #else
42 /*
43 * Otherwise, when linking directly into the IRT, we can refer to the
44 * real irt_ppapi_start.
45 */
46 extern int irt_ppapi_start(const struct PP_StartFunctions *);
47 static int (* const real_irt_ppapi_start)(const struct PP_StartFunctions *) =
48 &irt_ppapi_start;
49 #endif
50
51 int irt_shim_ppapi_start(const struct PP_StartFunctions *funcs) {
52 user_start_functions = *funcs;
53 /*
54 * Record the original PPP_GetInterface and provide a shimmed one
55 * via wrapped_ppapi_methods.
56 */
57 const struct PP_StartFunctions wrapped_ppapi_methods = {
58 shim_PPPInitializeModule,
59 shim_PPPShutdownModule,
60 __Pnacl_PPPGetInterface
61 };
62 __set_real_Pnacl_PPPGetInterface(user_start_functions.PPP_GetInterface);
63 /*
64 * Invoke the IRT's ppapi_start interface with the wrapped interface.
65 */
66 return (*real_irt_ppapi_start)(&wrapped_ppapi_methods);
67 }
68
69 #if !PNACL_SHIM_AOT
70 const struct nacl_irt_ppapihook nacl_irt_shim_ppapihook = {
71 irt_shim_ppapi_start,
72 PpapiPluginRegisterThreadCreator,
73 };
74 #endif
OLDNEW
« ppapi/native_client/native_client.gyp ('K') | « ppapi/proxy/irt_ppapi.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698