forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NaCl cleanup: Split out irt_interfaces.cc from irt_ppapi.cc
The intention here is that irt_interfaces.{cc,h} should list the NaCl IRT interfaces that we implement in Chromium but that other files (like irt_ppapi.cc) should implement them. This matches how the files are organised in native_client/src/untrusted/irt/. This is in preparation for copying the PNaCl translator IRT interfaces to the Chromium side. That will add a couple more interfaces to irt_interfaces.cc (rather than to irt_ppapi.cc). BUG=302078 TEST=NaCl tests in browser_tests Review URL: https://codereview.chromium.org/1244533006 Cr-Commit-Position: refs/heads/master@{#339508}
- Loading branch information
mseaborn
authored and
Commit bot
committed
Jul 20, 2015
1 parent
92701ee
commit 5e66201
Showing
8 changed files
with
93 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ppapi/nacl_irt/irt_interfaces.h" | ||
|
||
#include <unistd.h> | ||
|
||
#include "build/build_config.h" | ||
#include "native_client/src/public/irt_core.h" | ||
#include "native_client/src/trusted/service_runtime/include/sys/unistd.h" | ||
#include "native_client/src/untrusted/irt/irt.h" | ||
#include "ppapi/nacl_irt/irt_manifest.h" | ||
#include "ppapi/nacl_irt/public/irt_ppapi.h" | ||
#include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h" | ||
|
||
#if defined(OS_NACL_SFI) | ||
static int ppapihook_pnacl_private_filter(void) { | ||
int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE); | ||
if (pnacl_mode == -1) | ||
return 0; | ||
return pnacl_mode; | ||
} | ||
#endif | ||
|
||
static const nacl_irt_resource_open kIrtResourceOpen = { | ||
ppapi::IrtOpenResource, | ||
}; | ||
|
||
#if defined(OS_NACL_SFI) | ||
static int not_pnacl_filter(void) { | ||
int pnacl_mode = sysconf(NACL_ABI__SC_NACL_PNACL_MODE); | ||
if (pnacl_mode == -1) | ||
return 0; | ||
return !pnacl_mode; | ||
} | ||
#endif | ||
|
||
static const struct nacl_irt_interface irt_interfaces[] = { | ||
{ NACL_IRT_PPAPIHOOK_v0_1, &nacl_irt_ppapihook, sizeof(nacl_irt_ppapihook), | ||
NULL }, | ||
#if defined(OS_NACL_SFI) | ||
{ NACL_IRT_PPAPIHOOK_PNACL_PRIVATE_v0_1, | ||
&nacl_irt_ppapihook_pnacl_private, sizeof(nacl_irt_ppapihook_pnacl_private), | ||
ppapihook_pnacl_private_filter }, | ||
#endif | ||
{ NACL_IRT_RESOURCE_OPEN_v0_1, &kIrtResourceOpen, | ||
sizeof(kIrtResourceOpen), | ||
#if defined(OS_NACL_SFI) | ||
not_pnacl_filter, | ||
#else | ||
// If we change PNaCl to use Non-SFI Mode on the open web, | ||
// we should add a filter here. | ||
NULL, | ||
#endif | ||
}, | ||
}; | ||
|
||
size_t chrome_irt_query(const char* interface_ident, | ||
void* table, size_t tablesize) { | ||
size_t result = nacl_irt_query_list(interface_ident, | ||
table, | ||
tablesize, | ||
irt_interfaces, | ||
sizeof(irt_interfaces)); | ||
if (result != 0) | ||
return result; | ||
|
||
return nacl_irt_query_core(interface_ident, table, tablesize); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2015 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef PPAPI_NACL_IRT_IRT_INTERFACES_H_ | ||
#define PPAPI_NACL_IRT_IRT_INTERFACES_H_ | ||
|
||
#include <stdlib.h> | ||
|
||
extern const struct nacl_irt_ppapihook nacl_irt_ppapihook; | ||
|
||
size_t chrome_irt_query(const char* interface_ident, | ||
void* table, size_t tablesize); | ||
|
||
#endif // PPAPI_NACL_IRT_IRT_INTERFACES_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters