diff options
author | mseaborn <mseaborn@chromium.org> | 2015-07-21 09:37:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-21 16:39:16 +0000 |
commit | 770b328e9f6812f4695e92963e0246ffd4f701a4 (patch) | |
tree | 4bc478f8f86ff060b9ce1b9c66e238647bc87710 /ppapi | |
parent | 1595fa25f05bb1f2bcbb73aefeceeb6329db299c (diff) | |
download | chromium_src-770b328e9f6812f4695e92963e0246ffd4f701a4.zip chromium_src-770b328e9f6812f4695e92963e0246ffd4f701a4.tar.gz chromium_src-770b328e9f6812f4695e92963e0246ffd4f701a4.tar.bz2 |
Reland of NaCl cleanup: Split out irt_interfaces.cc from irt_ppapi.cc (patchset #1 id:1 of https://codereview.chromium.org/1249473003/)
Reason for reland:
The size increase was caused by a Skia DEPS roll (https://codereview.chromium.org/1245793002/), not by this change.
Original issue's description:
> Revert of NaCl cleanup: Split out irt_interfaces.cc from irt_ppapi.cc (patchset #1 id:1 of https://codereview.chromium.org/1244533006/)
>
> Reason for revert:
> Regressed Linux sizes - 4.5% is a bit of a hit to take to bump sizes. If you're absolutely sure this is acceptable, update sizes as well.
>
> Original issue's description:
> > 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
> >
> > Committed: https://crrev.com/5e662010c1f7881970de6de19bcbd50f2726ea00
> > Cr-Commit-Position: refs/heads/master@{#339508}
>
> TBR=jvoung@chromium.org,bbudge@chromium.org,mseaborn@chromium.org
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=302078
>
> Committed: https://crrev.com/db9f0a6b277a39d2f2b70d99e17801a18a6d79a6
> Cr-Commit-Position: refs/heads/master@{#339559}
BUG=302078
TBR=jvoung@chromium.org
Review URL: https://codereview.chromium.org/1245893002
Cr-Commit-Position: refs/heads/master@{#339666}
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/nacl_irt/irt_interfaces.cc | 70 | ||||
-rw-r--r-- | ppapi/nacl_irt/irt_interfaces.h | 15 | ||||
-rw-r--r-- | ppapi/nacl_irt/irt_ppapi.cc | 65 | ||||
-rw-r--r-- | ppapi/nacl_irt/irt_ppapi.h | 3 | ||||
-rw-r--r-- | ppapi/nacl_irt/irt_start.cc | 2 | ||||
-rw-r--r-- | ppapi/ppapi_proxy.gypi | 2 | ||||
-rw-r--r-- | ppapi/proxy/BUILD.gn | 2 |
7 files changed, 92 insertions, 67 deletions
diff --git a/ppapi/nacl_irt/irt_interfaces.cc b/ppapi/nacl_irt/irt_interfaces.cc new file mode 100644 index 0000000..77ce9d8 --- /dev/null +++ b/ppapi/nacl_irt/irt_interfaces.cc @@ -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); +} diff --git a/ppapi/nacl_irt/irt_interfaces.h b/ppapi/nacl_irt/irt_interfaces.h new file mode 100644 index 0000000..0971900 --- /dev/null +++ b/ppapi/nacl_irt/irt_interfaces.h @@ -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_ diff --git a/ppapi/nacl_irt/irt_ppapi.cc b/ppapi/nacl_irt/irt_ppapi.cc index a9c13eb..7cdf589 100644 --- a/ppapi/nacl_irt/irt_ppapi.cc +++ b/ppapi/nacl_irt/irt_ppapi.cc @@ -2,17 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#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/irt_interfaces.h" #include "ppapi/nacl_irt/irt_ppapi.h" #include "ppapi/nacl_irt/plugin_main.h" #include "ppapi/nacl_irt/public/irt_ppapi.h" -#include "ppapi/native_client/src/untrusted/pnacl_irt_shim/irt_shim_ppapi.h" static struct PP_StartFunctions g_pp_functions; @@ -34,62 +28,7 @@ const void* PPP_GetInterface(const char* interface_name) { return g_pp_functions.PPP_GetInterface(interface_name); } -static const struct nacl_irt_ppapihook nacl_irt_ppapihook = { +const struct nacl_irt_ppapihook nacl_irt_ppapihook = { irt_ppapi_start, PpapiPluginRegisterThreadCreator, }; - -#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); -} diff --git a/ppapi/nacl_irt/irt_ppapi.h b/ppapi/nacl_irt/irt_ppapi.h index bc2e74c..d65bede2 100644 --- a/ppapi/nacl_irt/irt_ppapi.h +++ b/ppapi/nacl_irt/irt_ppapi.h @@ -7,7 +7,4 @@ extern "C" int irt_ppapi_start(const struct PP_StartFunctions* funcs); -size_t chrome_irt_query(const char* interface_ident, - void* table, size_t tablesize); - #endif // PPAPI_NACL_IRT_IRT_PPAPI_H_ diff --git a/ppapi/nacl_irt/irt_start.cc b/ppapi/nacl_irt/irt_start.cc index f199de1..82765c8 100644 --- a/ppapi/nacl_irt/irt_start.cc +++ b/ppapi/nacl_irt/irt_start.cc @@ -11,7 +11,7 @@ #include "base/at_exit.h" #include "native_client/src/public/chrome_main.h" #include "native_client/src/public/irt_core.h" -#include "ppapi/nacl_irt/irt_ppapi.h" +#include "ppapi/nacl_irt/irt_interfaces.h" #include "ppapi/nacl_irt/plugin_startup.h" void nacl_irt_start(uint32_t* info) { diff --git a/ppapi/ppapi_proxy.gypi b/ppapi/ppapi_proxy.gypi index d099e0a..bfb3b5c 100644 --- a/ppapi/ppapi_proxy.gypi +++ b/ppapi/ppapi_proxy.gypi @@ -253,6 +253,8 @@ 'target_conditions': [ ['>(nacl_untrusted_build)==1', { 'sources': [ + 'nacl_irt/irt_interfaces.cc', + 'nacl_irt/irt_interfaces.h', 'nacl_irt/irt_ppapi.cc', 'nacl_irt/irt_ppapi.h', 'nacl_irt/irt_start.cc', diff --git a/ppapi/proxy/BUILD.gn b/ppapi/proxy/BUILD.gn index 8e26008..c9de244 100644 --- a/ppapi/proxy/BUILD.gn +++ b/ppapi/proxy/BUILD.gn @@ -196,6 +196,8 @@ component("proxy") { if (is_nacl) { sources += [ + "../nacl_irt/irt_interfaces.cc", + "../nacl_irt/irt_interfaces.h", "../nacl_irt/irt_ppapi.cc", "../nacl_irt/irt_ppapi.h", "../nacl_irt/irt_start.cc", |