diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-17 19:54:44 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-17 19:54:44 +0000 |
commit | 4c2f8195b9a5dc59d86434ab498ad609aa4034e4 (patch) | |
tree | 703240def49bf6a89a52447234d5bb53df3c1294 | |
parent | 088eb05f489f805c728fdceafc813a0f589a03da (diff) | |
download | chromium_src-4c2f8195b9a5dc59d86434ab498ad609aa4034e4.zip chromium_src-4c2f8195b9a5dc59d86434ab498ad609aa4034e4.tar.gz chromium_src-4c2f8195b9a5dc59d86434ab498ad609aa4034e4.tar.bz2 |
Add a webkit_glue API for lanching NaCl's sel_ldr. NaCl will call this API via
Pepper. This API is based on an existing piece of code used by NaCl's NPAPI
plugin, which will be removed once we get the Pepper plugin off the ground.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69567 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/renderer/render_process_impl.cc | 1 | ||||
-rw-r--r-- | chrome/renderer/renderer_glue.cc | 29 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.h | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 5 |
4 files changed, 42 insertions, 1 deletions
diff --git a/chrome/renderer/render_process_impl.cc b/chrome/renderer/render_process_impl.cc index a28f823..1396713 100644 --- a/chrome/renderer/render_process_impl.cc +++ b/chrome/renderer/render_process_impl.cc @@ -51,6 +51,7 @@ namespace { +// TODO(abarth): Remove this function in favor of webkit_glue::LaunchSelLdr. #if !defined(DISABLE_NACL) bool LaunchNaClProcessMultiFD(const char* alleged_url, int socket_count, diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc index 9d70613..5cae2a9 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -36,6 +36,11 @@ #include "webkit/glue/webkit_glue.h" #include "webkit/glue/websocketstreamhandle_bridge.h" +#if !defined(DISABLE_NACL) +#include "native_client/src/shared/imc/nacl_imc.h" +#include "native_client/src/trusted/plugin/nacl_entry_points.h" +#endif + #if defined(OS_WIN) #include <strsafe.h> // note: per msdn docs, this must *follow* other includes #elif defined(OS_LINUX) @@ -274,6 +279,30 @@ void UserMetricsRecordAction(const std::string& action) { new ViewHostMsg_UserMetricsRecordAction(action)); } +#if !defined(DISABLE_NACL) +bool LaunchSelLdr(const char* alleged_url, int socket_count, void* imc_handles, + void* nacl_process_handle, int* nacl_process_id) { + std::vector<nacl::FileDescriptor> sockets; + base::ProcessHandle nacl_process; + if (!RenderThread::current()->Send( + new ViewHostMsg_LaunchNaCl( + ASCIIToWide(alleged_url), + socket_count, + &sockets, + &nacl_process, + reinterpret_cast<base::ProcessId*>(nacl_process_id)))) { + return false; + } + CHECK(static_cast<int>(sockets.size()) == socket_count); + for (int i = 0; i < socket_count; i++) { + static_cast<nacl::Handle*>(imc_handles)[i] = + nacl::ToNativeHandle(sockets[i]); + } + *static_cast<nacl::Handle*>(nacl_process_handle) = nacl_process; + return true; +} +#endif + #if defined(OS_LINUX) int MatchFontWithFallback(const std::string& face, bool bold, bool italic, int charset) { diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index 80fe90e..fbb541a 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -109,7 +109,7 @@ std::string CreateHistoryStateForURL(const GURL& url); // Removes any form data state from the history state string |content_state|. std::string RemoveFormDataFromHistoryState(const std::string& content_state); -// Removes scroll offset from the history state string |content_state|.
+// Removes scroll offset from the history state string |content_state|. std::string RemoveScrollOffsetFromHistoryState( const std::string& content_state); @@ -275,6 +275,12 @@ void EnableSpdy(bool enable); // Notifies the browser that the given action has been performed. void UserMetricsRecordAction(const std::string& action); +#if !defined(DISABLE_NACL) +// Launch NaCl's sel_ldr process. +bool LaunchSelLdr(const char* alleged_url, int socket_count, void* imc_handles, + void* nacl_process_handle, int* nacl_process_id); +#endif + #if defined(OS_LINUX) // Return a read-only file descriptor to the font which best matches the given // properties or -1 on failure. diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index d6dd067..280be89 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -882,6 +882,11 @@ bool IsSingleProcess() { return true; } +bool LaunchSelLdr(const char* alleged_url, int socket_count, void* imc_handles, + void* nacl_process_handle, int* nacl_process_id) { + return false; +} + #if defined(OS_LINUX) int MatchFontWithFallback(const std::string& face, bool bold, bool italic, int charset) { |