| 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 | |
| 791 void HttpCache::RemovePendingTransaction(Transaction* trans) { | 778 void HttpCache::RemovePendingTransaction(Transaction* trans) { |
| 792 ActiveEntriesMap::const_iterator i = active_entries_.find(trans->key()); | 779 ActiveEntriesMap::const_iterator i = active_entries_.find(trans->key()); |
| 793 bool found = false; | 780 bool found = false; |
| 794 if (i != active_entries_.end()) | 781 if (i != active_entries_.end()) |
| 795 found = RemovePendingTransactionFromEntry(i->second, trans); | 782 found = RemovePendingTransactionFromEntry(i->second, trans); |
| 796 | 783 |
| 797 if (found) | 784 if (found) |
| 798 return; | 785 return; |
| 799 | 786 |
| 800 if (building_backend_) { | 787 if (building_backend_) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 // This could be an external caller or a transaction waiting on Start(). | 988 // This could be an external caller or a transaction waiting on Start(). |
| 1002 pending_item->DoCallback(result, temp_backend_); | 989 pending_item->DoCallback(result, temp_backend_); |
| 1003 pending_item->NotifyTransaction(result, NULL); | 990 pending_item->NotifyTransaction(result, NULL); |
| 1004 } | 991 } |
| 1005 | 992 |
| 1006 DeletePendingOp(pending_op); | 993 DeletePendingOp(pending_op); |
| 1007 building_backend_ = false; | 994 building_backend_ = false; |
| 1008 } | 995 } |
| 1009 | 996 |
| 1010 } // namespace net | 997 } // namespace net |
| OLD | NEW |