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 <stdio.h> | |
dmichael (off chromium)
2014/08/05 16:04:04
^^^ I'm assuming this is leftover from debugging?
teravest
2014/08/05 18:15:29
Removed.
| |
6 | |
5 #include "native_client/src/public/irt_core.h" | 7 #include "native_client/src/public/irt_core.h" |
6 #include "native_client/src/trusted/service_runtime/include/sys/unistd.h" | 8 #include "native_client/src/trusted/service_runtime/include/sys/unistd.h" |
7 #include "native_client/src/untrusted/irt/irt.h" | 9 #include "native_client/src/untrusted/irt/irt.h" |
8 #include "native_client/src/untrusted/irt/irt_private.h" | 10 #include "native_client/src/untrusted/irt/irt_private.h" |
11 #include "ppapi/nacl_irt/irt_manifest.h" | |
9 #include "ppapi/nacl_irt/irt_ppapi.h" | 12 #include "ppapi/nacl_irt/irt_ppapi.h" |
10 #include "ppapi/nacl_irt/plugin_main.h" | 13 #include "ppapi/nacl_irt/plugin_main.h" |
11 #include "ppapi/nacl_irt/public/irt_ppapi.h" | 14 #include "ppapi/nacl_irt/public/irt_ppapi.h" |
12 #include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h" | 15 #include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h" |
13 | 16 |
14 static struct PP_StartFunctions g_pp_functions; | 17 static struct PP_StartFunctions g_pp_functions; |
15 | 18 |
16 int irt_ppapi_start(const struct PP_StartFunctions* funcs) { | 19 int irt_ppapi_start(const struct PP_StartFunctions* funcs) { |
17 // Disable NaCl's open_resource() interface on this thread. | 20 // Disable NaCl's open_resource() interface on this thread. |
18 g_is_main_thread = 1; | 21 g_is_main_thread = 1; |
(...skipping 20 matching lines...) Expand all Loading... | |
39 PpapiPluginRegisterThreadCreator, | 42 PpapiPluginRegisterThreadCreator, |
40 }; | 43 }; |
41 | 44 |
42 static int ppapihook_pnacl_private_filter(void) { | 45 static int ppapihook_pnacl_private_filter(void) { |
43 int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE); | 46 int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE); |
44 if (pnacl_mode == -1) | 47 if (pnacl_mode == -1) |
45 return 0; | 48 return 0; |
46 return pnacl_mode; | 49 return pnacl_mode; |
47 } | 50 } |
48 | 51 |
52 const nacl_irt_resource_open kIrtResourceOpen = { | |
53 ppapi::IrtOpenResource, | |
54 }; | |
55 | |
56 static int not_pnacl_filter(void) { | |
57 int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE); | |
58 if (pnacl_mode == -1) | |
59 return 0; | |
60 return !pnacl_mode; | |
dmichael (off chromium)
2014/08/05 16:04:04
I assume it's idiomatic C to apply ! to an int? Th
teravest
2014/08/05 18:15:29
I think !pnacl_mode looks more natural than pnacl_
| |
61 } | |
62 | |
49 static const struct nacl_irt_interface irt_interfaces[] = { | 63 static const struct nacl_irt_interface irt_interfaces[] = { |
50 { NACL_IRT_PPAPIHOOK_v0_1, &nacl_irt_ppapihook, sizeof(nacl_irt_ppapihook), | 64 { NACL_IRT_PPAPIHOOK_v0_1, &nacl_irt_ppapihook, sizeof(nacl_irt_ppapihook), |
51 NULL }, | 65 NULL }, |
52 { NACL_IRT_PPAPIHOOK_PNACL_PRIVATE_v0_1, | 66 { NACL_IRT_PPAPIHOOK_PNACL_PRIVATE_v0_1, |
53 &nacl_irt_ppapihook_pnacl_private, sizeof(nacl_irt_ppapihook_pnacl_private), | 67 &nacl_irt_ppapihook_pnacl_private, sizeof(nacl_irt_ppapihook_pnacl_private), |
54 ppapihook_pnacl_private_filter }, | 68 ppapihook_pnacl_private_filter }, |
69 { NACL_IRT_RESOURCE_OPEN_v0_1, &kIrtResourceOpen, | |
70 sizeof(kIrtResourceOpen), not_pnacl_filter }, | |
55 }; | 71 }; |
56 | 72 |
57 size_t chrome_irt_query(const char* interface_ident, | 73 size_t chrome_irt_query(const char* interface_ident, |
58 void* table, size_t tablesize) { | 74 void* table, size_t tablesize) { |
dmichael (off chromium)
2014/08/05 16:04:04
chromium style nit: In a function declaration or d
teravest
2014/08/05 18:15:29
Done.
| |
59 size_t result = nacl_irt_query_core(interface_ident, table, tablesize); | 75 size_t result = nacl_irt_query_list(interface_ident, table, tablesize, |
76 irt_interfaces, sizeof(irt_interfaces)); | |
60 if (result != 0) | 77 if (result != 0) |
61 return result; | 78 return result; |
62 return nacl_irt_query_list(interface_ident, table, tablesize, | 79 return nacl_irt_query_core(interface_ident, table, tablesize); |
63 irt_interfaces, sizeof(irt_interfaces)); | |
64 } | 80 } |
OLD | NEW |