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

Side by Side Diff: ppapi/nacl_irt/irt_interfaces.cc

Issue 1245893002: Reland of NaCl cleanup: Split out irt_interfaces.cc from irt_ppapi.cc (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « ppapi/nacl_irt/irt_interfaces.h ('k') | ppapi/nacl_irt/irt_ppapi.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/nacl_irt/irt_interfaces.h"
6
7 #include <unistd.h>
8
9 #include "build/build_config.h"
10 #include "native_client/src/public/irt_core.h"
11 #include "native_client/src/trusted/service_runtime/include/sys/unistd.h"
12 #include "native_client/src/untrusted/irt/irt.h"
13 #include "ppapi/nacl_irt/irt_manifest.h"
14 #include "ppapi/nacl_irt/public/irt_ppapi.h"
15 #include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h"
16
17 #if defined(OS_NACL_SFI)
18 static int ppapihook_pnacl_private_filter(void) {
19 int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE);
20 if (pnacl_mode == -1)
21 return 0;
22 return pnacl_mode;
23 }
24 #endif
25
26 static const nacl_irt_resource_open kIrtResourceOpen = {
27 ppapi::IrtOpenResource,
28 };
29
30 #if defined(OS_NACL_SFI)
31 static int not_pnacl_filter(void) {
32 int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE);
33 if (pnacl_mode == -1)
34 return 0;
35 return !pnacl_mode;
36 }
37 #endif
38
39 static const struct nacl_irt_interface irt_interfaces[] = {
40 { NACL_IRT_PPAPIHOOK_v0_1, &nacl_irt_ppapihook, sizeof(nacl_irt_ppapihook),
41 NULL },
42 #if defined(OS_NACL_SFI)
43 { NACL_IRT_PPAPIHOOK_PNACL_PRIVATE_v0_1,
44 &nacl_irt_ppapihook_pnacl_private, sizeof(nacl_irt_ppapihook_pnacl_private),
45 ppapihook_pnacl_private_filter },
46 #endif
47 { NACL_IRT_RESOURCE_OPEN_v0_1, &kIrtResourceOpen,
48 sizeof(kIrtResourceOpen),
49 #if defined(OS_NACL_SFI)
50 not_pnacl_filter,
51 #else
52 // If we change PNaCl to use Non-SFI Mode on the open web,
53 // we should add a filter here.
54 NULL,
55 #endif
56 },
57 };
58
59 size_t chrome_irt_query(const char* interface_ident,
60 void* table, size_t tablesize) {
61 size_t result = nacl_irt_query_list(interface_ident,
62 table,
63 tablesize,
64 irt_interfaces,
65 sizeof(irt_interfaces));
66 if (result != 0)
67 return result;
68
69 return nacl_irt_query_core(interface_ident, table, tablesize);
70 }
OLDNEW
« no previous file with comments | « ppapi/nacl_irt/irt_interfaces.h ('k') | ppapi/nacl_irt/irt_ppapi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698