Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2256)

Unified Diff: chrome/renderer/pepper/ppb_nacl_private_impl.cc

Issue 11428063: Add a flag to LaunchSelLdr to skip grabbing a routing_id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reduce mod Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/nacl_host/nacl_process_host.cc ('k') | ppapi/api/private/ppb_nacl_private.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/pepper/ppb_nacl_private_impl.cc
diff --git a/chrome/renderer/pepper/ppb_nacl_private_impl.cc b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
index cd78a7a0191b767d14f86231e9b56223c8bebe65..f4d3a65dab59e8649b00ef84203cd9cdaa7750b4 100644
--- a/chrome/renderer/pepper/ppb_nacl_private_impl.cc
+++ b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
@@ -57,6 +57,7 @@ base::LazyInstance<InstanceInfoMap> g_instance_info =
// Launch NaCl's sel_ldr process.
PP_NaClResult LaunchSelLdr(PP_Instance instance,
const char* alleged_url,
+ PP_Bool uses_ppapi,
PP_Bool enable_ppapi_dev,
int socket_count,
void* imc_handles) {
@@ -65,17 +66,27 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
if (sender == NULL)
sender = g_background_thread_sender.Pointer()->get();
- webkit::ppapi::PluginInstance* plugin_instance =
- content::GetHostGlobals()->GetInstance(instance);
- if (!plugin_instance)
- return PP_NACL_FAILED;
-
- WebKit::WebView* web_view =
- plugin_instance->container()->element().document().frame()->view();
- content::RenderView* render_view =
- content::RenderView::FromWebView(web_view);
- if (!render_view)
- return PP_NACL_FAILED;
+ int routing_id = 0;
+ // If the nexe uses ppapi APIs, we need a routing ID.
+ // To get the routing ID, we must be on the main thread.
+ // Some nexes do not use ppapi and launch from the background thread,
+ // so those nexes can skip finding a routing_id.
+ if (uses_ppapi) {
+ // Check that we are on the main renderer thread.
+ CHECK(content::RenderThread::Get());
+ webkit::ppapi::PluginInstance* plugin_instance =
+ content::GetHostGlobals()->GetInstance(instance);
+ if (!plugin_instance)
+ return PP_NACL_FAILED;
+
+ WebKit::WebView* web_view =
+ plugin_instance->container()->element().document().frame()->view();
+ content::RenderView* render_view =
+ content::RenderView::FromWebView(web_view);
+ if (!render_view)
+ return PP_NACL_FAILED;
+ routing_id = render_view->GetRoutingID();
+ }
InstanceInfo instance_info;
instance_info.url = GURL(alleged_url);
@@ -91,7 +102,7 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
if (!sender->Send(new ChromeViewHostMsg_LaunchNaCl(
instance_info.url,
- render_view->GetRoutingID(),
+ routing_id,
perm_bits,
socket_count, &sockets,
&instance_info.channel_handle,
« no previous file with comments | « chrome/browser/nacl_host/nacl_process_host.cc ('k') | ppapi/api/private/ppb_nacl_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698