| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 base::ProcessId plugin_pid; | 123 base::ProcessId plugin_pid; |
| 124 int plugin_child_id; | 124 int plugin_child_id; |
| 125 IPC::ChannelHandle channel_handle; | 125 IPC::ChannelHandle channel_handle; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 class NaClPluginInstance { | 128 class NaClPluginInstance { |
| 129 public: | 129 public: |
| 130 explicit NaClPluginInstance(PP_Instance instance) | 130 explicit NaClPluginInstance(PP_Instance instance) |
| 131 : nexe_load_manager(instance), pexe_size(0) {} | 131 : nexe_load_manager(instance), pexe_size(0) {} |
| 132 ~NaClPluginInstance() { | 132 ~NaClPluginInstance() { |
| 133 // Make sure that we do not leak a file descriptor if the NaCl loader | 133 // Make sure that we do not leak a mojo handle if the NaCl loader |
| 134 // process never called ppapi_start() to initialize PPAPI. | 134 // process never called ppapi_start() to initialize PPAPI. |
| 135 if (instance_info) { | 135 if (instance_info) { |
| 136 #if defined(OS_WIN) | 136 DCHECK(instance_info->channel_handle.is_mojo_channel_handle()); |
| 137 base::win::ScopedHandle closer(instance_info->channel_handle.pipe.handle); | 137 instance_info->channel_handle.mojo_handle.Close(); |
| 138 #else | |
| 139 base::ScopedFD closer(instance_info->channel_handle.socket.fd); | |
| 140 #endif | |
| 141 } | 138 } |
| 142 } | 139 } |
| 143 | 140 |
| 144 NexeLoadManager nexe_load_manager; | 141 NexeLoadManager nexe_load_manager; |
| 145 std::unique_ptr<JsonManifest> json_manifest; | 142 std::unique_ptr<JsonManifest> json_manifest; |
| 146 std::unique_ptr<InstanceInfo> instance_info; | 143 std::unique_ptr<InstanceInfo> instance_info; |
| 147 | 144 |
| 148 // When translation is complete, this records the size of the pexe in | 145 // When translation is complete, this records the size of the pexe in |
| 149 // bytes so that it can be reported in a later load event. | 146 // bytes so that it can be reported in a later load event. |
| 150 uint64_t pexe_size; | 147 uint64_t pexe_size; |
| (...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 // Mark the request as requesting a PNaCl bitcode file, | 1732 // Mark the request as requesting a PNaCl bitcode file, |
| 1736 // so that component updater can detect this user action. | 1733 // so that component updater can detect this user action. |
| 1737 url_request.addHTTPHeaderField( | 1734 url_request.addHTTPHeaderField( |
| 1738 blink::WebString::fromUTF8("Accept"), | 1735 blink::WebString::fromUTF8("Accept"), |
| 1739 blink::WebString::fromUTF8("application/x-pnacl, */*")); | 1736 blink::WebString::fromUTF8("application/x-pnacl, */*")); |
| 1740 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); | 1737 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); |
| 1741 downloader->Load(url_request); | 1738 downloader->Load(url_request); |
| 1742 } | 1739 } |
| 1743 | 1740 |
| 1744 } // namespace nacl | 1741 } // namespace nacl |
| OLD | NEW |