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

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

Issue 171093002: NaCl: Move definition of the "ppapihook" IRT interface to the Chromium repo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use Chrome * style 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
« no previous file with comments | « no previous file | 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/untrusted/irt/irt.h" 8 #include "native_client/src/untrusted/irt/irt.h"
8 #include "native_client/src/untrusted/irt/irt_private.h" 9 #include "native_client/src/untrusted/irt/irt_private.h"
9 #include "ppapi/nacl_irt/irt_ppapi.h" 10 #include "ppapi/nacl_irt/irt_ppapi.h"
10 #include "ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h" 11 #include "ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h"
11 12
12 struct PP_StartFunctions g_pp_functions; 13 struct PP_StartFunctions g_pp_functions;
13 14
14 static int irt_ppapi_start(const struct PP_StartFunctions* funcs) { 15 static int irt_ppapi_start(const struct PP_StartFunctions* funcs) {
15 /* Disable NaCl's open_resource() interface on this thread. */ 16 /* Disable NaCl's open_resource() interface on this thread. */
16 g_is_main_thread = 1; 17 g_is_main_thread = 1;
17 18
18 g_pp_functions = *funcs; 19 g_pp_functions = *funcs;
19 return PpapiPluginMain(); 20 return PpapiPluginMain();
20 } 21 }
21 22
22 int32_t PPP_InitializeModule(PP_Module module_id, 23 int32_t PPP_InitializeModule(PP_Module module_id,
23 PPB_GetInterface get_browser_interface) { 24 PPB_GetInterface get_browser_interface) {
24 return g_pp_functions.PPP_InitializeModule(module_id, get_browser_interface); 25 return g_pp_functions.PPP_InitializeModule(module_id, get_browser_interface);
25 } 26 }
26 27
27 void PPP_ShutdownModule(void) { 28 void PPP_ShutdownModule(void) {
28 g_pp_functions.PPP_ShutdownModule(); 29 g_pp_functions.PPP_ShutdownModule();
29 } 30 }
30 31
31 const void* PPP_GetInterface(const char* interface_name) { 32 const void* PPP_GetInterface(const char* interface_name) {
32 return g_pp_functions.PPP_GetInterface(interface_name); 33 return g_pp_functions.PPP_GetInterface(interface_name);
33 } 34 }
34 35
36 /*
37 * TODO(mseaborn): This can be made static when the NaCl side no
38 * longer refers to it.
39 */
35 const struct nacl_irt_ppapihook nacl_irt_ppapihook = { 40 const struct nacl_irt_ppapihook nacl_irt_ppapihook = {
36 irt_ppapi_start, 41 irt_ppapi_start,
37 PpapiPluginRegisterThreadCreator, 42 PpapiPluginRegisterThreadCreator,
38 }; 43 };
44
45 static const struct nacl_irt_interface irt_interfaces[] = {
46 { NACL_IRT_PPAPIHOOK_v0_1, &nacl_irt_ppapihook, sizeof(nacl_irt_ppapihook),
47 NULL },
48 };
49
50 static size_t chrome_irt_query(const char* interface_ident,
51 void* table, size_t tablesize) {
52 size_t result = nacl_irt_query_core(interface_ident, table, tablesize);
53 if (result != 0)
54 return result;
55 return nacl_irt_query_list(interface_ident, table, tablesize,
56 irt_interfaces, sizeof(irt_interfaces));
57 }
58
59 void nacl_irt_start(uint32_t* info) {
60 nacl_irt_init(info);
61 nacl_irt_enter_user_code(info, chrome_irt_query);
62 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698