| 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 #include <utility> |
| 10 | 10 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 profile_directory_, | 218 profile_directory_, |
| 219 &file_path_metadata)) { | 219 &file_path_metadata)) { |
| 220 continue; | 220 continue; |
| 221 } | 221 } |
| 222 base::File file = nacl::OpenNaClReadExecImpl( | 222 base::File file = nacl::OpenNaClReadExecImpl( |
| 223 file_path_metadata, true /* is_executable */); | 223 file_path_metadata, true /* is_executable */); |
| 224 if (!file.IsValid()) | 224 if (!file.IsValid()) |
| 225 continue; | 225 continue; |
| 226 | 226 |
| 227 prefetched_resource_files.push_back(NaClResourcePrefetchResult( | 227 prefetched_resource_files.push_back(NaClResourcePrefetchResult( |
| 228 IPC::TakeFileHandleForProcess(std::move(file), PeerHandle()), | 228 IPC::TakePlatformFileForTransit(std::move(file)), 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 pnacl::PnaclHost::GetInstance()->Init(); | 294 pnacl::PnaclHost::GetInstance()->Init(); |
| 295 } | 295 } |
| 296 | 296 |
| 297 // Return the temporary file via a reply to the | 297 // Return the temporary file via a reply to the |
| 298 // NaClHostMsg_NaClCreateTemporaryFile sync message. | 298 // NaClHostMsg_NaClCreateTemporaryFile sync message. |
| 299 void NaClHostMessageFilter::SyncReturnTemporaryFile( | 299 void NaClHostMessageFilter::SyncReturnTemporaryFile( |
| 300 IPC::Message* reply_msg, | 300 IPC::Message* reply_msg, |
| 301 base::File file) { | 301 base::File file) { |
| 302 if (file.IsValid()) { | 302 if (file.IsValid()) { |
| 303 NaClHostMsg_NaClCreateTemporaryFile::WriteReplyParams( | 303 NaClHostMsg_NaClCreateTemporaryFile::WriteReplyParams( |
| 304 reply_msg, | 304 reply_msg, IPC::TakePlatformFileForTransit(std::move(file))); |
| 305 IPC::TakeFileHandleForProcess(std::move(file), PeerHandle())); | |
| 306 } else { | 305 } else { |
| 307 reply_msg->set_reply_error(); | 306 reply_msg->set_reply_error(); |
| 308 } | 307 } |
| 309 Send(reply_msg); | 308 Send(reply_msg); |
| 310 } | 309 } |
| 311 | 310 |
| 312 void NaClHostMessageFilter::OnNaClCreateTemporaryFile( | 311 void NaClHostMessageFilter::OnNaClCreateTemporaryFile( |
| 313 IPC::Message* reply_msg) { | 312 IPC::Message* reply_msg) { |
| 314 pnacl::PnaclHost::GetInstance()->CreateTemporaryFile( | 313 pnacl::PnaclHost::GetInstance()->CreateTemporaryFile( |
| 315 base::Bind(&NaClHostMessageFilter::SyncReturnTemporaryFile, | 314 base::Bind(&NaClHostMessageFilter::SyncReturnTemporaryFile, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 reply_msg); | 378 reply_msg); |
| 380 } | 379 } |
| 381 | 380 |
| 382 void NaClHostMessageFilter::OnNaClDebugEnabledForURL(const GURL& nmf_url, | 381 void NaClHostMessageFilter::OnNaClDebugEnabledForURL(const GURL& nmf_url, |
| 383 bool* should_debug) { | 382 bool* should_debug) { |
| 384 *should_debug = | 383 *should_debug = |
| 385 nacl::NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(nmf_url); | 384 nacl::NaClBrowser::GetDelegate()->URLMatchesDebugPatterns(nmf_url); |
| 386 } | 385 } |
| 387 | 386 |
| 388 } // namespace nacl | 387 } // namespace nacl |
| OLD | NEW |