diff options
author | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-08 20:49:43 +0000 |
---|---|---|
committer | mseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-08 20:49:43 +0000 |
commit | 08cf125f544b93da1ca4c3ed2840bce7fc9ff3fb (patch) | |
tree | 4a9efc495cec1225f7b4d75ec709676b83bc322e /chrome/renderer | |
parent | 44b94b8f2d7a1b9a4990f0ad5c0805397215813a (diff) | |
download | chromium_src-08cf125f544b93da1ca4c3ed2840bce7fc9ff3fb.zip chromium_src-08cf125f544b93da1ca4c3ed2840bce7fc9ff3fb.tar.gz chromium_src-08cf125f544b93da1ca4c3ed2840bce7fc9ff3fb.tar.bz2 |
NaCl: Supply MakeSharedMemorySegmentViaIPC() via dependency injection
This will allow NaCl's #include of a Chromium header to be removed.
The extra "executable" argument is in preparation for implementing
this function for Mac OS X.
BUG=http://code.google.com/p/nativeclient/issues/detail?id=469
BUG=http://code.google.com/p/nativeclient/issues/detail?id=583
TEST=NaCl's test_runner.html with NaCl-side change applied
Review URL: http://codereview.chromium.org/4361001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_process_impl.cc | 9 | ||||
-rw-r--r-- | chrome/renderer/renderer_sandbox_support_linux.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/renderer_sandbox_support_linux.h | 6 |
3 files changed, 19 insertions, 0 deletions
diff --git a/chrome/renderer/render_process_impl.cc b/chrome/renderer/render_process_impl.cc index e084000..058758c 100644 --- a/chrome/renderer/render_process_impl.cc +++ b/chrome/renderer/render_process_impl.cc @@ -32,6 +32,7 @@ #include "ipc/ipc_message_utils.h" #include "media/base/media.h" #include "media/base/media_switches.h" +#include "native_client/src/shared/imc/nacl_imc.h" #include "native_client/src/trusted/plugin/nacl_entry_points.h" #include "skia/ext/platform_canvas.h" #include "webkit/glue/plugins/plugin_instance.h" @@ -44,6 +45,10 @@ #include "app/win/iat_patch_function.h" #endif +#if defined(OS_LINUX) +#include "chrome/renderer/renderer_sandbox_support_linux.h" +#endif + namespace { #if !defined(DISABLE_NACL) @@ -168,6 +173,10 @@ RenderProcessImpl::RenderProcessImpl() funcs["launch_nacl_process_multi_fd"] = reinterpret_cast<uintptr_t>(LaunchNaClProcessMultiFD); RegisterInternalNaClPlugin(funcs); +#if defined(OS_LINUX) + nacl::SetCreateMemoryObjectFunc( + renderer_sandbox_support::MakeSharedMemorySegmentViaIPCExecutable); +#endif } #endif diff --git a/chrome/renderer/renderer_sandbox_support_linux.cc b/chrome/renderer/renderer_sandbox_support_linux.cc index 6733f75..283afe6 100644 --- a/chrome/renderer/renderer_sandbox_support_linux.cc +++ b/chrome/renderer/renderer_sandbox_support_linux.cc @@ -92,6 +92,10 @@ int MakeSharedMemorySegmentViaIPC(size_t length) { return result_fd; } +int MakeSharedMemorySegmentViaIPCExecutable(size_t length, bool executable) { + return MakeSharedMemorySegmentViaIPC(length); +} + int MatchFontWithFallback(const std::string& face, bool bold, bool italic, int charset) { Pickle request; diff --git a/chrome/renderer/renderer_sandbox_support_linux.h b/chrome/renderer/renderer_sandbox_support_linux.h index 5f253c9..1b71f38 100644 --- a/chrome/renderer/renderer_sandbox_support_linux.h +++ b/chrome/renderer/renderer_sandbox_support_linux.h @@ -29,8 +29,14 @@ void getRenderStyleForStrike(const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out); // Returns a file descriptor for a shared memory segment. +// TODO(mseaborn): Remove this when the call site is gone from native_client. int MakeSharedMemorySegmentViaIPC(size_t length); +// Returns a file descriptor for a shared memory segment. +// The second argument is ignored because SHM segments are always +// mappable with PROT_EXEC on Linux. +int MakeSharedMemorySegmentViaIPCExecutable(size_t length, bool executable); + // Return a read-only file descriptor to the font which best matches the given // properties or -1 on failure. // charset: specifies the language(s) that the font must cover. See |