| 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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // GetNexeFd. | 140 // GetNexeFd. |
| 141 cache_state_ = CacheUninitialized; | 141 cache_state_ = CacheUninitialized; |
| 142 } else { | 142 } else { |
| 143 cache_state_ = CacheReady; | 143 cache_state_ = CacheReady; |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 void PnaclHost::Init() { | 147 void PnaclHost::Init() { |
| 148 // Extra check that we're on the real IO thread since this version of | 148 // Extra check that we're on the real IO thread since this version of |
| 149 // Init isn't used in unit tests. | 149 // Init isn't used in unit tests. |
| 150 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 150 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 151 DCHECK(thread_checker_.CalledOnValidThread()); | 151 DCHECK(thread_checker_.CalledOnValidThread()); |
| 152 base::FilePath cache_path(GetCachePath()); | 152 base::FilePath cache_path(GetCachePath()); |
| 153 if (cache_path.empty() || cache_state_ != CacheUninitialized) | 153 if (cache_path.empty() || cache_state_ != CacheUninitialized) |
| 154 return; | 154 return; |
| 155 disk_cache_.reset(new pnacl::PnaclTranslationCache()); | 155 disk_cache_.reset(new pnacl::PnaclTranslationCache()); |
| 156 cache_state_ = CacheInitializing; | 156 cache_state_ = CacheInitializing; |
| 157 int rv = disk_cache_->InitOnDisk( | 157 int rv = disk_cache_->InitOnDisk( |
| 158 cache_path, | 158 cache_path, |
| 159 base::Bind(&PnaclHost::OnCacheInitialized, weak_factory_.GetWeakPtr())); | 159 base::Bind(&PnaclHost::OnCacheInitialized, weak_factory_.GetWeakPtr())); |
| 160 if (rv != net::ERR_IO_PENDING) | 160 if (rv != net::ERR_IO_PENDING) |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 DCHECK(pending_backend_operations_ >= 0); | 680 DCHECK(pending_backend_operations_ >= 0); |
| 681 if (pending_translations_.empty() && | 681 if (pending_translations_.empty() && |
| 682 pending_backend_operations_ <= 0 && | 682 pending_backend_operations_ <= 0 && |
| 683 cache_state_ == CacheReady) { | 683 cache_state_ == CacheReady) { |
| 684 cache_state_ = CacheUninitialized; | 684 cache_state_ = CacheUninitialized; |
| 685 disk_cache_.reset(); | 685 disk_cache_.reset(); |
| 686 } | 686 } |
| 687 } | 687 } |
| 688 | 688 |
| 689 } // namespace pnacl | 689 } // namespace pnacl |
| OLD | NEW |