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/pnacl_host.h" | 5 #include "components/nacl/browser/pnacl_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 // Create a temporary file on the blocking pool | 130 // Create a temporary file on the blocking pool |
131 // static | 131 // static |
132 void PnaclHost::DoCreateTemporaryFile(base::FilePath temp_dir, | 132 void PnaclHost::DoCreateTemporaryFile(base::FilePath temp_dir, |
133 TempFileCallback cb) { | 133 TempFileCallback cb) { |
134 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 134 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
135 | 135 |
136 base::FilePath file_path; | 136 base::FilePath file_path; |
137 base::PlatformFile file_handle(base::kInvalidPlatformFileValue); | 137 base::PlatformFile file_handle(base::kInvalidPlatformFileValue); |
138 bool rv = temp_dir.empty() | 138 bool rv = temp_dir.empty() |
139 ? file_util::CreateTemporaryFile(&file_path) | 139 ? base::CreateTemporaryFile(&file_path) |
140 : file_util::CreateTemporaryFileInDir(temp_dir, &file_path); | 140 : base::CreateTemporaryFileInDir(temp_dir, &file_path); |
141 if (!rv) { | 141 if (!rv) { |
142 PLOG(ERROR) << "Temp file creation failed."; | 142 PLOG(ERROR) << "Temp file creation failed."; |
143 } else { | 143 } else { |
144 base::PlatformFileError error; | 144 base::PlatformFileError error; |
145 file_handle = base::CreatePlatformFile( | 145 file_handle = base::CreatePlatformFile( |
146 file_path, | 146 file_path, |
147 base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_READ | | 147 base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_READ | |
148 base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_TEMPORARY | | 148 base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_TEMPORARY | |
149 base::PLATFORM_FILE_DELETE_ON_CLOSE, | 149 base::PLATFORM_FILE_DELETE_ON_CLOSE, |
150 NULL, | 150 NULL, |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 // the backend to avoid hanging shutdown. | 625 // the backend to avoid hanging shutdown. |
626 void PnaclHost::DeInitIfSafe() { | 626 void PnaclHost::DeInitIfSafe() { |
627 DCHECK(pending_backend_operations_ >= 0); | 627 DCHECK(pending_backend_operations_ >= 0); |
628 if (pending_translations_.empty() && pending_backend_operations_ <= 0) { | 628 if (pending_translations_.empty() && pending_backend_operations_ <= 0) { |
629 cache_state_ = CacheUninitialized; | 629 cache_state_ = CacheUninitialized; |
630 disk_cache_.reset(); | 630 disk_cache_.reset(); |
631 } | 631 } |
632 } | 632 } |
633 | 633 |
634 } // namespace pnacl | 634 } // namespace pnacl |
OLD | NEW |