Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: net/http/http_cache.cc

Issue 2959183002: Start work on splitting off the usage piece of in-memory index. This revision is just from the prev…
Patch Set: Rebase Created 3 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_cache_transaction.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 } 736 }
737 737
738 int HttpCache::OpenEntry(const std::string& key, ActiveEntry** entry, 738 int HttpCache::OpenEntry(const std::string& key, ActiveEntry** entry,
739 Transaction* trans) { 739 Transaction* trans) {
740 ActiveEntry* active_entry = FindActiveEntry(key); 740 ActiveEntry* active_entry = FindActiveEntry(key);
741 if (active_entry) { 741 if (active_entry) {
742 *entry = active_entry; 742 *entry = active_entry;
743 return OK; 743 return OK;
744 } 744 }
745 745
746 // See if we could potentially quick-reject the entry.
747 uint8_t in_memory_info = disk_cache_->GetEntryInMemoryData(key);
748 if (trans->MaybeRejectBasedOnEntryInMemoryData(in_memory_info)) {
749 disk_cache_->DoomEntry(key, base::Bind([](int) {}));
750 return net::ERR_CACHE_ENTRY_NOT_SUITABLE;
751 }
752
746 std::unique_ptr<WorkItem> item = 753 std::unique_ptr<WorkItem> item =
747 std::make_unique<WorkItem>(WI_OPEN_ENTRY, trans, entry); 754 std::make_unique<WorkItem>(WI_OPEN_ENTRY, trans, entry);
748 PendingOp* pending_op = GetPendingOp(key); 755 PendingOp* pending_op = GetPendingOp(key);
749 if (pending_op->writer) { 756 if (pending_op->writer) {
750 pending_op->pending_queue.push_back(std::move(item)); 757 pending_op->pending_queue.push_back(std::move(item));
751 return ERR_IO_PENDING; 758 return ERR_IO_PENDING;
752 } 759 }
753 760
754 DCHECK(pending_op->pending_queue.empty()); 761 DCHECK(pending_op->pending_queue.empty());
755 762
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 building_backend_ = false; 1419 building_backend_ = false;
1413 DeletePendingOp(pending_op); 1420 DeletePendingOp(pending_op);
1414 } 1421 }
1415 1422
1416 // The cache may be gone when we return from the callback. 1423 // The cache may be gone when we return from the callback.
1417 if (!item->DoCallback(result, disk_cache_.get())) 1424 if (!item->DoCallback(result, disk_cache_.get()))
1418 item->NotifyTransaction(result, NULL); 1425 item->NotifyTransaction(result, NULL);
1419 } 1426 }
1420 1427
1421 } // namespace net 1428 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_cache_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698