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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 PendingTranslation* pt = &entry->second; | 311 PendingTranslation* pt = &entry->second; |
312 pt->got_cache_reply = true; | 312 pt->got_cache_reply = true; |
313 pt->got_cache_hit = (net_error == net::OK); | 313 pt->got_cache_hit = (net_error == net::OK); |
314 if (pt->got_cache_hit) | 314 if (pt->got_cache_hit) |
315 pt->nexe_read_buffer = buffer; | 315 pt->nexe_read_buffer = buffer; |
316 CheckCacheQueryReady(entry); | 316 CheckCacheQueryReady(entry); |
317 } | 317 } |
318 | 318 |
319 // Callback from temp file creation. |id| is bound from | 319 // Callback from temp file creation. |id| is bound from |
320 // SendCacheQueryAndTempFileRequest, and |file| is the created file. | 320 // SendCacheQueryAndTempFileRequest, and |file| is the created file. |
321 // If there was an error, fd is kInvalidPlatformFileValue. | 321 // If there was an error, file is invalid. |
322 // (Bound callbacks must re-lookup the TranslationID because the translation | 322 // (Bound callbacks must re-lookup the TranslationID because the translation |
323 // could be cancelled before they get called). | 323 // could be cancelled before they get called). |
324 void PnaclHost::OnTempFileReturn(const TranslationID& id, | 324 void PnaclHost::OnTempFileReturn(const TranslationID& id, |
325 base::File file) { | 325 base::File file) { |
326 DCHECK(thread_checker_.CalledOnValidThread()); | 326 DCHECK(thread_checker_.CalledOnValidThread()); |
327 PendingTranslationMap::iterator entry(pending_translations_.find(id)); | 327 PendingTranslationMap::iterator entry(pending_translations_.find(id)); |
328 if (entry == pending_translations_.end()) { | 328 if (entry == pending_translations_.end()) { |
329 // The renderer may have signaled an error or closed while the temp | 329 // The renderer may have signaled an error or closed while the temp |
330 // file was being created. | 330 // file was being created. |
331 LOG(ERROR) << "OnTempFileReturn: id not found"; | 331 LOG(ERROR) << "OnTempFileReturn: id not found"; |
(...skipping 348 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 |