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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 << id.second << " not found."; | 503 << id.second << " not found."; |
504 return; | 504 return; |
505 } | 505 } |
506 | 506 |
507 if (buffer.get() == NULL) { | 507 if (buffer.get() == NULL) { |
508 LOG(ERROR) << "Error reading translated nexe"; | 508 LOG(ERROR) << "Error reading translated nexe"; |
509 return; | 509 return; |
510 } | 510 } |
511 pending_backend_operations_++; | 511 pending_backend_operations_++; |
512 disk_cache_->StoreNexe(it->second.cache_key, | 512 disk_cache_->StoreNexe(it->second.cache_key, |
513 buffer, | 513 buffer.get(), |
514 base::Bind(&PnaclHost::OnTranslatedNexeStored, | 514 base::Bind(&PnaclHost::OnTranslatedNexeStored, |
515 weak_factory_.GetWeakPtr(), | 515 weak_factory_.GetWeakPtr(), |
516 it->first)); | 516 it->first)); |
517 } | 517 } |
518 | 518 |
519 // After we know the nexe has been stored, we can clean up, and unblock any | 519 // After we know the nexe has been stored, we can clean up, and unblock any |
520 // outstanding requests for the same file. | 520 // outstanding requests for the same file. |
521 // (Bound callbacks must re-lookup the TranslationID because the translation | 521 // (Bound callbacks must re-lookup the TranslationID because the translation |
522 // could be cancelled before they get called). | 522 // could be cancelled before they get called). |
523 void PnaclHost::OnTranslatedNexeStored(const TranslationID& id, int net_error) { | 523 void PnaclHost::OnTranslatedNexeStored(const TranslationID& id, int net_error) { |
(...skipping 156 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 |