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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 DCHECK(content::RenderThread::Get()); | 187 DCHECK(content::RenderThread::Get()); |
188 content::RendererPpapiHost* host = | 188 content::RendererPpapiHost* host = |
189 content::RendererPpapiHost::GetForPPInstance(instance); | 189 content::RendererPpapiHost::GetForPPInstance(instance); |
190 if (!host) | 190 if (!host) |
191 return 0; | 191 return 0; |
192 return host->GetRoutingIDForWidget(instance); | 192 return host->GetRoutingIDForWidget(instance); |
193 } | 193 } |
194 | 194 |
195 // Returns whether the channel_handle is valid or not. | 195 // Returns whether the channel_handle is valid or not. |
196 bool IsValidChannelHandle(const IPC::ChannelHandle& channel_handle) { | 196 bool IsValidChannelHandle(const IPC::ChannelHandle& channel_handle) { |
197 if (channel_handle.name.empty()) { | 197 DCHECK(channel_handle.mojo_handle.is_valid()); |
198 return false; | 198 return channel_handle.mojo_handle.is_valid(); |
199 } | |
200 | |
201 #if defined(OS_POSIX) | |
202 if (channel_handle.socket.fd == -1) { | |
203 return false; | |
204 } | |
205 #endif | |
206 | |
207 return true; | |
208 } | 199 } |
209 | 200 |
210 void PostPPCompletionCallback(PP_CompletionCallback callback, | 201 void PostPPCompletionCallback(PP_CompletionCallback callback, |
211 int32_t status) { | 202 int32_t status) { |
212 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 203 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
213 FROM_HERE, | 204 FROM_HERE, |
214 base::Bind(callback.func, callback.user_data, status)); | 205 base::Bind(callback.func, callback.user_data, status)); |
215 } | 206 } |
216 | 207 |
217 bool ManifestResolveKey(PP_Instance instance, | 208 bool ManifestResolveKey(PP_Instance instance, |
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1744 // Mark the request as requesting a PNaCl bitcode file, | 1735 // Mark the request as requesting a PNaCl bitcode file, |
1745 // so that component updater can detect this user action. | 1736 // so that component updater can detect this user action. |
1746 url_request.addHTTPHeaderField( | 1737 url_request.addHTTPHeaderField( |
1747 blink::WebString::fromUTF8("Accept"), | 1738 blink::WebString::fromUTF8("Accept"), |
1748 blink::WebString::fromUTF8("application/x-pnacl, */*")); | 1739 blink::WebString::fromUTF8("application/x-pnacl, */*")); |
1749 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); | 1740 url_request.setRequestContext(blink::WebURLRequest::RequestContextObject); |
1750 downloader->Load(url_request); | 1741 downloader->Load(url_request); |
1751 } | 1742 } |
1752 | 1743 |
1753 } // namespace nacl | 1744 } // namespace nacl |
OLD | NEW |