| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/nacl/renderer/ppb_nacl_private.h" | 5 #include "components/nacl/renderer/ppb_nacl_private.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 base::LazyInstance<scoped_refptr<PnaclTranslationResourceHost> > | 86 base::LazyInstance<scoped_refptr<PnaclTranslationResourceHost> > |
| 87 g_pnacl_resource_host = LAZY_INSTANCE_INITIALIZER; | 87 g_pnacl_resource_host = LAZY_INSTANCE_INITIALIZER; |
| 88 | 88 |
| 89 bool InitializePnaclResourceHost() { | 89 bool InitializePnaclResourceHost() { |
| 90 // Must run on the main thread. | 90 // Must run on the main thread. |
| 91 content::RenderThread* render_thread = content::RenderThread::Get(); | 91 content::RenderThread* render_thread = content::RenderThread::Get(); |
| 92 if (!render_thread) | 92 if (!render_thread) |
| 93 return false; | 93 return false; |
| 94 if (!g_pnacl_resource_host.Get().get()) { | 94 if (!g_pnacl_resource_host.Get().get()) { |
| 95 g_pnacl_resource_host.Get() = new PnaclTranslationResourceHost( | 95 g_pnacl_resource_host.Get() = |
| 96 render_thread->GetIOMessageLoopProxy()); | 96 new PnaclTranslationResourceHost(render_thread->GetIOTaskRunner()); |
| 97 render_thread->AddFilter(g_pnacl_resource_host.Get().get()); | 97 render_thread->AddFilter(g_pnacl_resource_host.Get().get()); |
| 98 } | 98 } |
| 99 return true; | 99 return true; |
| 100 } | 100 } |
| 101 | 101 |
| 102 bool CanOpenViaFastPath(content::PepperPluginInstance* plugin_instance, | 102 bool CanOpenViaFastPath(content::PepperPluginInstance* plugin_instance, |
| 103 const GURL& gurl) { | 103 const GURL& gurl) { |
| 104 // Fast path only works for installed file URLs. | 104 // Fast path only works for installed file URLs. |
| 105 if (!gurl.SchemeIs("chrome-extension")) | 105 if (!gurl.SchemeIs("chrome-extension")) |
| 106 return PP_kInvalidFileHandle; | 106 return PP_kInvalidFileHandle; |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 instance_info.channel_handle = launch_result.ppapi_ipc_channel_handle; | 523 instance_info.channel_handle = launch_result.ppapi_ipc_channel_handle; |
| 524 instance_info.plugin_pid = launch_result.plugin_pid; | 524 instance_info.plugin_pid = launch_result.plugin_pid; |
| 525 instance_info.plugin_child_id = launch_result.plugin_child_id; | 525 instance_info.plugin_child_id = launch_result.plugin_child_id; |
| 526 | 526 |
| 527 // Don't save instance_info if channel handle is invalid. | 527 // Don't save instance_info if channel handle is invalid. |
| 528 if (IsValidChannelHandle(instance_info.channel_handle)) { | 528 if (IsValidChannelHandle(instance_info.channel_handle)) { |
| 529 if (process_type == kPNaClTranslatorProcessType) { | 529 if (process_type == kPNaClTranslatorProcessType) { |
| 530 // Return an IPC channel which allows communicating with a PNaCl | 530 // Return an IPC channel which allows communicating with a PNaCl |
| 531 // translator process. | 531 // translator process. |
| 532 *translator_channel = IPC::SyncChannel::Create( | 532 *translator_channel = IPC::SyncChannel::Create( |
| 533 instance_info.channel_handle, | 533 instance_info.channel_handle, IPC::Channel::MODE_CLIENT, |
| 534 IPC::Channel::MODE_CLIENT, | 534 new NoOpListener, content::RenderThread::Get()->GetIOTaskRunner(), |
| 535 new NoOpListener, | 535 true, content::RenderThread::Get()->GetShutdownEvent()); |
| 536 content::RenderThread::Get()->GetIOMessageLoopProxy(), | |
| 537 true, | |
| 538 content::RenderThread::Get()->GetShutdownEvent()); | |
| 539 } else { | 536 } else { |
| 540 // Save the channel handle for when StartPpapiProxy() is called. | 537 // Save the channel handle for when StartPpapiProxy() is called. |
| 541 NaClPluginInstance* nacl_plugin_instance = | 538 NaClPluginInstance* nacl_plugin_instance = |
| 542 GetNaClPluginInstance(instance); | 539 GetNaClPluginInstance(instance); |
| 543 nacl_plugin_instance->instance_info.reset( | 540 nacl_plugin_instance->instance_info.reset( |
| 544 new InstanceInfo(instance_info)); | 541 new InstanceInfo(instance_info)); |
| 545 } | 542 } |
| 546 } | 543 } |
| 547 | 544 |
| 548 // Store the crash information shared memory handle. | 545 // Store the crash information shared memory handle. |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1746 // Mark the request as requesting a PNaCl bitcode file, | 1743 // Mark the request as requesting a PNaCl bitcode file, |
| 1747 // so that component updater can detect this user action. | 1744 // so that component updater can detect this user action. |
| 1748 url_request.addHTTPHeaderField( | 1745 url_request.addHTTPHeaderField( |
| 1749 blink::WebString::fromUTF8("Accept"), | 1746 blink::WebString::fromUTF8("Accept"), |
| 1750 blink::WebString::fromUTF8("application/x-pnacl, */*")); | 1747 blink::WebString::fromUTF8("application/x-pnacl, */*")); |
| 1751 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); | 1748 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); |
| 1752 downloader->Load(url_request); | 1749 downloader->Load(url_request); |
| 1753 } | 1750 } |
| 1754 | 1751 |
| 1755 } // namespace nacl | 1752 } // namespace nacl |
| OLD | NEW |