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

Side by Side Diff: ppapi/proxy/irt_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: cleanups and rebase Created 6 years, 9 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
« no previous file with comments | « ppapi/proxy/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 The Chromium Authors. All rights reserved. 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 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/public/irt_core.h" 7 #include "native_client/src/public/irt_core.h"
8 #include "native_client/src/trusted/service_runtime/include/sys/unistd.h"
dmichael (off chromium) 2014/02/27 23:14:59 It seems wrong to include something from "trusted"
Mark Seaborn 2014/02/27 23:28:08 That's covered by: https://code.google.com/p/nativ
8 #include "native_client/src/untrusted/irt/irt.h" 9 #include "native_client/src/untrusted/irt/irt.h"
9 #include "native_client/src/untrusted/irt/irt_private.h" 10 #include "native_client/src/untrusted/irt/irt_private.h"
10 #include "ppapi/nacl_irt/irt_ppapi.h" 11 #include "ppapi/nacl_irt/irt_ppapi.h"
12 #include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h"
11 #include "ppapi/proxy/plugin_main_irt.h" 13 #include "ppapi/proxy/plugin_main_irt.h"
12 14
13 struct PP_StartFunctions g_pp_functions; 15 static struct PP_StartFunctions g_pp_functions;
14 16
15 static int irt_ppapi_start(const struct PP_StartFunctions* funcs) { 17 int irt_ppapi_start(const struct PP_StartFunctions* funcs) {
16 /* Disable NaCl's open_resource() interface on this thread. */ 18 /* Disable NaCl's open_resource() interface on this thread. */
17 g_is_main_thread = 1; 19 g_is_main_thread = 1;
18 20
19 g_pp_functions = *funcs; 21 g_pp_functions = *funcs;
20 return PpapiPluginMain(); 22 return PpapiPluginMain();
21 } 23 }
22 24
23 int32_t PPP_InitializeModule(PP_Module module_id, 25 int32_t PPP_InitializeModule(PP_Module module_id,
24 PPB_GetInterface get_browser_interface) { 26 PPB_GetInterface get_browser_interface) {
25 return g_pp_functions.PPP_InitializeModule(module_id, get_browser_interface); 27 return g_pp_functions.PPP_InitializeModule(module_id, get_browser_interface);
26 } 28 }
27 29
28 void PPP_ShutdownModule(void) { 30 void PPP_ShutdownModule(void) {
29 g_pp_functions.PPP_ShutdownModule(); 31 g_pp_functions.PPP_ShutdownModule();
30 } 32 }
31 33
32 const void* PPP_GetInterface(const char* interface_name) { 34 const void* PPP_GetInterface(const char* interface_name) {
33 return g_pp_functions.PPP_GetInterface(interface_name); 35 return g_pp_functions.PPP_GetInterface(interface_name);
34 } 36 }
35 37
36 static const struct nacl_irt_ppapihook nacl_irt_ppapihook = { 38 static const struct nacl_irt_ppapihook nacl_irt_ppapihook = {
37 irt_ppapi_start, 39 irt_ppapi_start,
38 PpapiPluginRegisterThreadCreator, 40 PpapiPluginRegisterThreadCreator,
39 }; 41 };
40 42
43 static int ppapihook_pnacl_private_filter(void) {
44 int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE);
45 if (pnacl_mode == -1)
46 return 0;
47 return pnacl_mode;
48 }
49
41 static const struct nacl_irt_interface irt_interfaces[] = { 50 static const struct nacl_irt_interface irt_interfaces[] = {
42 { NACL_IRT_PPAPIHOOK_v0_1, &nacl_irt_ppapihook, sizeof(nacl_irt_ppapihook), 51 { NACL_IRT_PPAPIHOOK_v0_1, &nacl_irt_ppapihook, sizeof(nacl_irt_ppapihook),
43 NULL }, 52 NULL },
53 { NACL_IRT_PPAPIHOOK_PNACL_PRIVATE_v0_1,
54 &nacl_irt_ppapihook_pnacl_private, sizeof(nacl_irt_ppapihook_pnacl_private),
55 ppapihook_pnacl_private_filter },
44 }; 56 };
45 57
46 static size_t chrome_irt_query(const char* interface_ident, 58 static size_t chrome_irt_query(const char* interface_ident,
47 void* table, size_t tablesize) { 59 void* table, size_t tablesize) {
48 size_t result = nacl_irt_query_core(interface_ident, table, tablesize); 60 size_t result = nacl_irt_query_core(interface_ident, table, tablesize);
49 if (result != 0) 61 if (result != 0)
50 return result; 62 return result;
51 return nacl_irt_query_list(interface_ident, table, tablesize, 63 return nacl_irt_query_list(interface_ident, table, tablesize,
52 irt_interfaces, sizeof(irt_interfaces)); 64 irt_interfaces, sizeof(irt_interfaces));
53 } 65 }
54 66
55 void nacl_irt_start(uint32_t* info) { 67 void nacl_irt_start(uint32_t* info) {
56 nacl_irt_init(info); 68 nacl_irt_init(info);
57 nacl_irt_enter_user_code(info, chrome_irt_query); 69 nacl_irt_enter_user_code(info, chrome_irt_query);
58 } 70 }
OLDNEW
« no previous file with comments | « ppapi/proxy/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698