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

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

Issue 13907009: Support optimistic Create and Write operations on the SimpleCache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/simple/simple_entry_impl.cc ('k') | no next file » | 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 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 10
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 if (rv != ERR_IO_PENDING) { 715 if (rv != ERR_IO_PENDING) {
716 item->ClearTransaction(); 716 item->ClearTransaction();
717 pending_op->callback.Run(rv); 717 pending_op->callback.Run(rv);
718 } 718 }
719 719
720 return rv; 720 return rv;
721 } 721 }
722 722
723 int HttpCache::CreateEntry(const std::string& key, ActiveEntry** entry, 723 int HttpCache::CreateEntry(const std::string& key, ActiveEntry** entry,
724 Transaction* trans) { 724 Transaction* trans) {
725 DCHECK(!FindActiveEntry(key)); 725 if (FindActiveEntry(key)) {
726 return ERR_CACHE_RACE;
727 }
726 728
727 WorkItem* item = new WorkItem(WI_CREATE_ENTRY, trans, entry); 729 WorkItem* item = new WorkItem(WI_CREATE_ENTRY, trans, entry);
728 PendingOp* pending_op = GetPendingOp(key); 730 PendingOp* pending_op = GetPendingOp(key);
729 if (pending_op->writer) { 731 if (pending_op->writer) {
730 pending_op->pending_queue.push_back(item); 732 pending_op->pending_queue.push_back(item);
731 return ERR_IO_PENDING; 733 return ERR_IO_PENDING;
732 } 734 }
733 735
734 DCHECK(pending_op->pending_queue.empty()); 736 DCHECK(pending_op->pending_queue.empty());
735 737
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 building_backend_ = false; 1129 building_backend_ = false;
1128 DeletePendingOp(pending_op); 1130 DeletePendingOp(pending_op);
1129 } 1131 }
1130 1132
1131 // The cache may be gone when we return from the callback. 1133 // The cache may be gone when we return from the callback.
1132 if (!item->DoCallback(result, backend)) 1134 if (!item->DoCallback(result, backend))
1133 item->NotifyTransaction(result, NULL); 1135 item->NotifyTransaction(result, NULL);
1134 } 1136 }
1135 1137
1136 } // namespace net 1138 } // namespace net
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_entry_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698