| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_file_host.h" | 5 #include "components/nacl/browser/nacl_file_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 7 #include "base/bind.h" | 10 #include "base/bind.h" |
| 8 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 9 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/threading/sequenced_worker_pool.h" | 15 #include "base/threading/sequenced_worker_pool.h" |
| 13 #include "components/nacl/browser/bad_message.h" | 16 #include "components/nacl/browser/bad_message.h" |
| 14 #include "components/nacl/browser/nacl_browser.h" | 17 #include "components/nacl/browser/nacl_browser.h" |
| 15 #include "components/nacl/browser/nacl_browser_delegate.h" | 18 #include "components/nacl/browser/nacl_browser_delegate.h" |
| 16 #include "components/nacl/browser/nacl_host_message_filter.h" | 19 #include "components/nacl/browser/nacl_host_message_filter.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 33 | 36 |
| 34 void NotifyRendererOfError( | 37 void NotifyRendererOfError( |
| 35 nacl::NaClHostMessageFilter* nacl_host_message_filter, | 38 nacl::NaClHostMessageFilter* nacl_host_message_filter, |
| 36 IPC::Message* reply_msg) { | 39 IPC::Message* reply_msg) { |
| 37 reply_msg->set_reply_error(); | 40 reply_msg->set_reply_error(); |
| 38 nacl_host_message_filter->Send(reply_msg); | 41 nacl_host_message_filter->Send(reply_msg); |
| 39 } | 42 } |
| 40 | 43 |
| 41 typedef void (*WriteFileInfoReply)(IPC::Message* reply_msg, | 44 typedef void (*WriteFileInfoReply)(IPC::Message* reply_msg, |
| 42 IPC::PlatformFileForTransit file_desc, | 45 IPC::PlatformFileForTransit file_desc, |
| 43 uint64 file_token_lo, | 46 uint64_t file_token_lo, |
| 44 uint64 file_token_hi); | 47 uint64_t file_token_hi); |
| 45 | 48 |
| 46 void DoRegisterOpenedNaClExecutableFile( | 49 void DoRegisterOpenedNaClExecutableFile( |
| 47 scoped_refptr<nacl::NaClHostMessageFilter> nacl_host_message_filter, | 50 scoped_refptr<nacl::NaClHostMessageFilter> nacl_host_message_filter, |
| 48 base::File file, | 51 base::File file, |
| 49 base::FilePath file_path, | 52 base::FilePath file_path, |
| 50 IPC::Message* reply_msg, | 53 IPC::Message* reply_msg, |
| 51 WriteFileInfoReply write_reply_message) { | 54 WriteFileInfoReply write_reply_message) { |
| 52 // IO thread owns the NaClBrowser singleton. | 55 // IO thread owns the NaClBrowser singleton. |
| 53 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 56 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 54 | 57 |
| 55 nacl::NaClBrowser* nacl_browser = nacl::NaClBrowser::GetInstance(); | 58 nacl::NaClBrowser* nacl_browser = nacl::NaClBrowser::GetInstance(); |
| 56 uint64 file_token_lo = 0; | 59 uint64_t file_token_lo = 0; |
| 57 uint64 file_token_hi = 0; | 60 uint64_t file_token_hi = 0; |
| 58 nacl_browser->PutFilePath(file_path, &file_token_lo, &file_token_hi); | 61 nacl_browser->PutFilePath(file_path, &file_token_lo, &file_token_hi); |
| 59 | 62 |
| 60 IPC::PlatformFileForTransit file_desc = IPC::TakeFileHandleForProcess( | 63 IPC::PlatformFileForTransit file_desc = IPC::TakeFileHandleForProcess( |
| 61 file.Pass(), | 64 file.Pass(), |
| 62 nacl_host_message_filter->PeerHandle()); | 65 nacl_host_message_filter->PeerHandle()); |
| 63 | 66 |
| 64 write_reply_message(reply_msg, file_desc, file_token_lo, file_token_hi); | 67 write_reply_message(reply_msg, file_desc, file_token_lo, file_token_hi); |
| 65 nacl_host_message_filter->Send(reply_msg); | 68 nacl_host_message_filter->Send(reply_msg); |
| 66 } | 69 } |
| 67 | 70 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 &DoOpenNaClExecutableOnThreadPool, | 275 &DoOpenNaClExecutableOnThreadPool, |
| 273 nacl_host_message_filter, | 276 nacl_host_message_filter, |
| 274 file_url, | 277 file_url, |
| 275 enable_validation_caching, | 278 enable_validation_caching, |
| 276 reply_msg))) { | 279 reply_msg))) { |
| 277 NotifyRendererOfError(nacl_host_message_filter.get(), reply_msg); | 280 NotifyRendererOfError(nacl_host_message_filter.get(), reply_msg); |
| 278 } | 281 } |
| 279 } | 282 } |
| 280 | 283 |
| 281 } // namespace nacl_file_host | 284 } // namespace nacl_file_host |
| OLD | NEW |