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

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: gavin comments 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
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 }
728
726 729
727 WorkItem* item = new WorkItem(WI_CREATE_ENTRY, trans, entry); 730 WorkItem* item = new WorkItem(WI_CREATE_ENTRY, trans, entry);
728 PendingOp* pending_op = GetPendingOp(key); 731 PendingOp* pending_op = GetPendingOp(key);
729 if (pending_op->writer) { 732 if (pending_op->writer) {
730 pending_op->pending_queue.push_back(item); 733 pending_op->pending_queue.push_back(item);
731 return ERR_IO_PENDING; 734 return ERR_IO_PENDING;
732 } 735 }
733 736
734 DCHECK(pending_op->pending_queue.empty()); 737 DCHECK(pending_op->pending_queue.empty());
735 738
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 building_backend_ = false; 1130 building_backend_ = false;
1128 DeletePendingOp(pending_op); 1131 DeletePendingOp(pending_op);
1129 } 1132 }
1130 1133
1131 // The cache may be gone when we return from the callback. 1134 // The cache may be gone when we return from the callback.
1132 if (!item->DoCallback(result, backend)) 1135 if (!item->DoCallback(result, backend))
1133 item->NotifyTransaction(result, NULL); 1136 item->NotifyTransaction(result, NULL);
1134 } 1137 }
1135 1138
1136 } // namespace net 1139 } // namespace net
OLDNEW
« net/disk_cache/simple/simple_entry_impl.cc ('K') | « 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