| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/http/http_cache.h" | 5 #include "net/http/http_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 | 10 |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 DCHECK(entry->readers.empty()); | 768 DCHECK(entry->readers.empty()); |
| 769 | 769 |
| 770 Transaction* trans = entry->writer; | 770 Transaction* trans = entry->writer; |
| 771 | 771 |
| 772 entry->writer = NULL; | 772 entry->writer = NULL; |
| 773 entry->readers.push_back(trans); | 773 entry->readers.push_back(trans); |
| 774 | 774 |
| 775 ProcessPendingQueue(entry); | 775 ProcessPendingQueue(entry); |
| 776 } | 776 } |
| 777 | 777 |
| 778 LoadState HttpCache::GetLoadStateForPendingTransaction( |
| 779 const Transaction* trans) { |
| 780 ActiveEntriesMap::const_iterator i = active_entries_.find(trans->key()); |
| 781 if (i == active_entries_.end()) { |
| 782 // If this is really a pending transaction, and it is not part of |
| 783 // active_entries_, we should be creating the backend or the entry. |
| 784 return LOAD_STATE_WAITING_FOR_CACHE; |
| 785 } |
| 786 |
| 787 Transaction* writer = i->second->writer; |
| 788 return writer->GetWriterLoadState(); |
| 789 } |
| 790 |
| 778 void HttpCache::RemovePendingTransaction(Transaction* trans) { | 791 void HttpCache::RemovePendingTransaction(Transaction* trans) { |
| 779 ActiveEntriesMap::const_iterator i = active_entries_.find(trans->key()); | 792 ActiveEntriesMap::const_iterator i = active_entries_.find(trans->key()); |
| 780 bool found = false; | 793 bool found = false; |
| 781 if (i != active_entries_.end()) | 794 if (i != active_entries_.end()) |
| 782 found = RemovePendingTransactionFromEntry(i->second, trans); | 795 found = RemovePendingTransactionFromEntry(i->second, trans); |
| 783 | 796 |
| 784 if (found) | 797 if (found) |
| 785 return; | 798 return; |
| 786 | 799 |
| 787 if (building_backend_) { | 800 if (building_backend_) { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 // This could be an external caller or a transaction waiting on Start(). | 1000 // This could be an external caller or a transaction waiting on Start(). |
| 988 pending_item->DoCallback(result, temp_backend_); | 1001 pending_item->DoCallback(result, temp_backend_); |
| 989 pending_item->NotifyTransaction(result, NULL); | 1002 pending_item->NotifyTransaction(result, NULL); |
| 990 } | 1003 } |
| 991 | 1004 |
| 992 DeletePendingOp(pending_op); | 1005 DeletePendingOp(pending_op); |
| 993 building_backend_ = false; | 1006 building_backend_ = false; |
| 994 } | 1007 } |
| 995 | 1008 |
| 996 } // namespace net | 1009 } // namespace net |
| OLD | NEW |