diff options
author | Justin TerAvest <teravest@chromium.org> | 2015-04-03 10:15:32 -0600 |
---|---|---|
committer | Justin TerAvest <teravest@chromium.org> | 2015-04-03 16:17:15 +0000 |
commit | 75386dca6ebff785e62eb52472e660c757d5b2e8 (patch) | |
tree | 07d1a89860a35821d70c86d6010a2fc43baa529f | |
parent | 45d30537039dc68e47e10104110bd61538f63f3f (diff) | |
download | chromium_src-75386dca6ebff785e62eb52472e660c757d5b2e8.zip chromium_src-75386dca6ebff785e62eb52472e660c757d5b2e8.tar.gz chromium_src-75386dca6ebff785e62eb52472e660c757d5b2e8.tar.bz2 |
Init Mojo embedder for Windows NaCl plugins.
With this change (and another fix for NACL_BUILD_SUBARCH), we can test
Pepper/Mojo/NaCl support on Windows.
This also moves embedder initialization to nacl_helper for clarity:
The Mojo embedder must be initialized in nacl_helper when that process
is used. When the plugin is running in a chrome process, ContentMain()
handles Mojo embedder initialization.
BUG=414804
R=dmichael@chromium.org, ncbray@chromium.org
Review URL: https://codereview.chromium.org/1044953003
Cr-Commit-Position: refs/heads/master@{#323750}
-rw-r--r-- | chrome/test/ppapi/ppapi_browsertest.cc | 10 | ||||
-rw-r--r-- | components/nacl.gyp | 1 | ||||
-rw-r--r-- | components/nacl/loader/nacl_helper_linux.cc | 11 | ||||
-rw-r--r-- | components/nacl/loader/nacl_helper_win_64.cc | 4 | ||||
-rw-r--r-- | components/nacl/loader/nacl_listener.cc | 10 |
5 files changed, 18 insertions, 18 deletions
diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc index 8f6a571..8d5c92a 100644 --- a/chrome/test/ppapi/ppapi_browsertest.cc +++ b/chrome/test/ppapi/ppapi_browsertest.cc @@ -1452,17 +1452,11 @@ class MojoPPAPITest : public InProcessBrowserTest { std::string result_; }; -#if defined(OS_POSIX) -#define MAYBE_MOJO(test_name) test_name -#else -#define MAYBE_MOJO(test_name) DISABLED_##test_name -#endif - -IN_PROC_BROWSER_TEST_F(MojoPPAPITest, MAYBE_MOJO(Mojo)) { +IN_PROC_BROWSER_TEST_F(MojoPPAPITest, Mojo) { RunTest(); } -IN_PROC_BROWSER_TEST_F(MojoPPAPITest, MAYBE_MOJO(MojoFailsWithoutFlag)) { +IN_PROC_BROWSER_TEST_F(MojoPPAPITest, MojoFailsWithoutFlag) { RunTestWithoutFlag(); } #endif diff --git a/components/nacl.gyp b/components/nacl.gyp index df9c827..5888d75 100644 --- a/components/nacl.gyp +++ b/components/nacl.gyp @@ -227,6 +227,7 @@ ], 'dependencies': [ 'nacl_linux', + '../third_party/mojo/mojo_edk.gyp:mojo_system_impl', ], 'cflags': ['-fPIE'], 'ldflags!': [ diff --git a/components/nacl/loader/nacl_helper_linux.cc b/components/nacl/loader/nacl_helper_linux.cc index 3ad69b3..7076044 100644 --- a/components/nacl/loader/nacl_helper_linux.cc +++ b/components/nacl/loader/nacl_helper_linux.cc @@ -43,6 +43,11 @@ #include "ipc/ipc_switches.h" #include "sandbox/linux/services/libc_urandom_override.h" +#if !defined(OS_NACL_NONSFI) +#include "third_party/mojo/src/mojo/edk/embedder/embedder.h" +#include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h" +#endif + #if defined(OS_NACL_NONSFI) #include "native_client/src/public/nonsfi/irt_exception_handling.h" #else @@ -459,6 +464,12 @@ int main(int argc, char* argv[]) { CheckRDebug(argv[0]); #endif +// TODO(teravest): Enable mojo for nonsfi. http://crbug.com/473418 +#if !defined(OS_NACL_NONSFI) + mojo::embedder::Init( + make_scoped_ptr(new mojo::embedder::SimplePlatformSupport())); +#endif + scoped_ptr<nacl::NaClSandbox> nacl_sandbox(new nacl::NaClSandbox); // Make sure that the early initialization did not start any spurious // threads. diff --git a/components/nacl/loader/nacl_helper_win_64.cc b/components/nacl/loader/nacl_helper_win_64.cc index d67b7b3..7dfc376 100644 --- a/components/nacl/loader/nacl_helper_win_64.cc +++ b/components/nacl/loader/nacl_helper_win_64.cc @@ -20,6 +20,8 @@ #include "content/public/common/main_function_params.h" #include "content/public/common/sandbox_init.h" #include "sandbox/win/src/sandbox_types.h" +#include "third_party/mojo/src/mojo/edk/embedder/embedder.h" +#include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h" extern int NaClMain(const content::MainFunctionParams&); @@ -62,6 +64,8 @@ int NaClWin64Main() { // Route stdio to parent console (if any) or create one. if (command_line.HasSwitch(switches::kEnableLogging)) base::RouteStdioToConsole(); + mojo::embedder::Init( + make_scoped_ptr(new mojo::embedder::SimplePlatformSupport())); // Initialize the sandbox for this process. bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info); diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc index 424112e..1a2b894 100644 --- a/components/nacl/loader/nacl_listener.cc +++ b/components/nacl/loader/nacl_listener.cc @@ -428,14 +428,7 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) { args->nexe_desc = NaClDescCreateWithFilePathMetadata(nexe_file, file_path_str.c_str()); -#if defined(OS_POSIX) if (params.enable_mojo) { -#if !defined(OS_MACOSX) - // Don't call mojo::embedder::Init on Mac; it's already been called from - // ChromeMain() (see chrome/app/chrome_exe_main_mac.cc). - mojo::embedder::Init(make_scoped_ptr( - new mojo::embedder::SimplePlatformSupport())); -#endif // InjectMojo adds a file descriptor to the process that allows Mojo calls // to use an implementation defined outside the NaCl sandbox. See // //mojo/nacl for implementation details. @@ -445,9 +438,6 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) { // fails on any imc_sendmsg() call to make debugging easier. InjectDisabledMojo(nap); } -#else - InjectDisabledMojo(nap); -#endif // TODO(yusukes): Support pre-opening resource files. CHECK(params.prefetched_resource_files.empty()); |