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/browser/nacl_host_message_filter.h" | 5 #include "components/nacl/browser/nacl_host_message_filter.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "components/nacl/browser/bad_message.h" | 13 #include "components/nacl/browser/bad_message.h" |
13 #include "components/nacl/browser/nacl_browser.h" | 14 #include "components/nacl/browser/nacl_browser.h" |
14 #include "components/nacl/browser/nacl_file_host.h" | 15 #include "components/nacl/browser/nacl_file_host.h" |
15 #include "components/nacl/browser/nacl_process_host.h" | 16 #include "components/nacl/browser/nacl_process_host.h" |
16 #include "components/nacl/browser/pnacl_host.h" | 17 #include "components/nacl/browser/pnacl_host.h" |
17 #include "components/nacl/common/nacl_host_messages.h" | 18 #include "components/nacl/common/nacl_host_messages.h" |
18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 profile_directory_, | 218 profile_directory_, |
218 &file_path_metadata)) { | 219 &file_path_metadata)) { |
219 continue; | 220 continue; |
220 } | 221 } |
221 base::File file = nacl::OpenNaClReadExecImpl( | 222 base::File file = nacl::OpenNaClReadExecImpl( |
222 file_path_metadata, true /* is_executable */); | 223 file_path_metadata, true /* is_executable */); |
223 if (!file.IsValid()) | 224 if (!file.IsValid()) |
224 continue; | 225 continue; |
225 | 226 |
226 prefetched_resource_files.push_back(NaClResourcePrefetchResult( | 227 prefetched_resource_files.push_back(NaClResourcePrefetchResult( |
227 IPC::TakeFileHandleForProcess(file.Pass(), PeerHandle()), | 228 IPC::TakeFileHandleForProcess(std::move(file), PeerHandle()), |
228 file_path_metadata, | 229 file_path_metadata, request_list[i].file_key)); |
229 request_list[i].file_key)); | |
230 | 230 |
231 if (prefetched_resource_files.size() >= kMaxPreOpenResourceFiles) | 231 if (prefetched_resource_files.size() >= kMaxPreOpenResourceFiles) |
232 break; | 232 break; |
233 } | 233 } |
234 | 234 |
235 content::BrowserThread::PostTask( | 235 content::BrowserThread::PostTask( |
236 content::BrowserThread::IO, | 236 content::BrowserThread::IO, |
237 FROM_HERE, | 237 FROM_HERE, |
238 base::Bind(&NaClHostMessageFilter::LaunchNaClContinuationOnIOThread, | 238 base::Bind(&NaClHostMessageFilter::LaunchNaClContinuationOnIOThread, |
239 this, | 239 this, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 | 318 |
319 // Return the temporary file via a reply to the | 319 // Return the temporary file via a reply to the |
320 // NaClHostMsg_NaClCreateTemporaryFile sync message. | 320 // NaClHostMsg_NaClCreateTemporaryFile sync message. |
321 void NaClHostMessageFilter::SyncReturnTemporaryFile( | 321 void NaClHostMessageFilter::SyncReturnTemporaryFile( |
322 IPC::Message* reply_msg, | 322 IPC::Message* reply_msg, |
323 base::File file) { | 323 base::File file) { |
324 if (file.IsValid()) { | 324 if (file.IsValid()) { |
325 NaClHostMsg_NaClCreateTemporaryFile::WriteReplyParams( | 325 NaClHostMsg_NaClCreateTemporaryFile::WriteReplyParams( |
326 reply_msg, | 326 reply_msg, |
327 IPC::TakeFileHandleForProcess(file.Pass(), PeerHandle())); | 327 IPC::TakeFileHandleForProcess(std::move(file), PeerHandle())); |
328 } else { | 328 } else { |
329 reply_msg->set_reply_error(); | 329 reply_msg->set_reply_error(); |
330 } | 330 } |
331 Send(reply_msg); | 331 Send(reply_msg); |
332 } | 332 } |
333 | 333 |
334 void NaClHostMessageFilter::OnNaClCreateTemporaryFile( | 334 void NaClHostMessageFilter::OnNaClCreateTemporaryFile( |
335 IPC::Message* reply_msg) { | 335 IPC::Message* reply_msg) { |
336 pnacl::PnaclHost::GetInstance()->CreateTemporaryFile( | 336 pnacl::PnaclHost::GetInstance()->CreateTemporaryFile( |
337 base::Bind(&NaClHostMessageFilter::SyncReturnTemporaryFile, | 337 base::Bind(&NaClHostMessageFilter::SyncReturnTemporaryFile, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 reply_msg); | 402 reply_msg); |
403 } | 403 } |
404 | 404 |
405 void NaClHostMessageFilter::OnNaClDebugEnabledForURL(const GURL& nmf_url, | 405 void NaClHostMessageFilter::OnNaClDebugEnabledForURL(const GURL& nmf_url, |
406 bool* should_debug) { | 406 bool* should_debug) { |
407 *should_debug = | 407 *should_debug = |
408 nacl::NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(nmf_url); | 408 nacl::NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(nmf_url); |
409 } | 409 } |
410 | 410 |
411 } // namespace nacl | 411 } // namespace nacl |
OLD | NEW |