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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 file descriptor 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 instance_info->channel_handle.mojo_handle.Close(); |
137 base::win::ScopedHandle closer(instance_info->channel_handle.pipe.handle); | |
138 #else | |
139 base::ScopedFD closer(instance_info->channel_handle.socket.fd); | |
140 #endif | |
141 } | |
142 } | 137 } |
143 | 138 |
144 NexeLoadManager nexe_load_manager; | 139 NexeLoadManager nexe_load_manager; |
145 std::unique_ptr<JsonManifest> json_manifest; | 140 std::unique_ptr<JsonManifest> json_manifest; |
146 std::unique_ptr<InstanceInfo> instance_info; | 141 std::unique_ptr<InstanceInfo> instance_info; |
147 | 142 |
148 // When translation is complete, this records the size of the pexe in | 143 // 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. | 144 // bytes so that it can be reported in a later load event. |
150 uint64_t pexe_size; | 145 uint64_t pexe_size; |
151 }; | 146 }; |
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 // Mark the request as requesting a PNaCl bitcode file, | 1730 // Mark the request as requesting a PNaCl bitcode file, |
1736 // so that component updater can detect this user action. | 1731 // so that component updater can detect this user action. |
1737 url_request.addHTTPHeaderField( | 1732 url_request.addHTTPHeaderField( |
1738 blink::WebString::fromUTF8("Accept"), | 1733 blink::WebString::fromUTF8("Accept"), |
1739 blink::WebString::fromUTF8("application/x-pnacl, */*")); | 1734 blink::WebString::fromUTF8("application/x-pnacl, */*")); |
1740 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); | 1735 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); |
1741 downloader->Load(url_request); | 1736 downloader->Load(url_request); |
1742 } | 1737 } |
1743 | 1738 |
1744 } // namespace nacl | 1739 } // namespace nacl |
OLD | NEW |