Chromium Code Reviews| 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..37c5c6cf62f58fa695be3161739d7f3360849f5a 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,25 @@ 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) { |
| + webkit::ppapi::PluginInstance* plugin_instance = |
|
brettw
2012/11/29 04:57:18
Can you add an assertion at the top here that cont
jvoung (off chromium)
2012/11/29 22:46:46
Done.
|
| + 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 +100,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, |