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

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

Issue 670183003: Update from chromium 62675d9fb31fb8cedc40f68e78e8445a74f362e7 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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/base/sdch_manager_unittest.cc ('k') | net/http/http_cache_unittest.cc » ('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_transaction.h" 5 #include "net/http/http_cache_transaction.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 // sending a range. We have to delete the old entry. 1201 // sending a range. We have to delete the old entry.
1202 UpdateTransactionPattern(PATTERN_NOT_COVERED); 1202 UpdateTransactionPattern(PATTERN_NOT_COVERED);
1203 DoneWritingToEntry(false); 1203 DoneWritingToEntry(false);
1204 } 1204 }
1205 1205
1206 if (mode_ == WRITE && 1206 if (mode_ == WRITE &&
1207 transaction_pattern_ != PATTERN_ENTRY_CANT_CONDITIONALIZE) { 1207 transaction_pattern_ != PATTERN_ENTRY_CANT_CONDITIONALIZE) {
1208 UpdateTransactionPattern(PATTERN_ENTRY_NOT_CACHED); 1208 UpdateTransactionPattern(PATTERN_ENTRY_NOT_CACHED);
1209 } 1209 }
1210 1210
1211 // Invalidate any cached GET with a successful PUT or DELETE.
1211 if (mode_ == WRITE && 1212 if (mode_ == WRITE &&
1212 (request_->method == "PUT" || request_->method == "DELETE")) { 1213 (request_->method == "PUT" || request_->method == "DELETE")) {
1213 if (NonErrorResponse(new_response->headers->response_code())) { 1214 if (NonErrorResponse(new_response->headers->response_code())) {
1214 int ret = cache_->DoomEntry(cache_key_, NULL); 1215 int ret = cache_->DoomEntry(cache_key_, NULL);
1215 DCHECK_EQ(OK, ret); 1216 DCHECK_EQ(OK, ret);
1216 } 1217 }
1217 cache_->DoneWritingToEntry(entry_, true); 1218 cache_->DoneWritingToEntry(entry_, true);
1218 entry_ = NULL; 1219 entry_ = NULL;
1219 mode_ = NONE; 1220 mode_ = NONE;
1220 } 1221 }
1221 1222
1222 if (request_->method == "POST" && 1223 // Invalidate any cached GET with a successful POST.
1224 if (!(effective_load_flags_ & LOAD_DISABLE_CACHE) &&
1225 request_->method == "POST" &&
1223 NonErrorResponse(new_response->headers->response_code())) { 1226 NonErrorResponse(new_response->headers->response_code())) {
1224 cache_->DoomMainEntryForUrl(request_->url); 1227 cache_->DoomMainEntryForUrl(request_->url);
1225 } 1228 }
1226 1229
1227 RecordVaryHeaderHistogram(new_response); 1230 RecordVaryHeaderHistogram(new_response);
1228 RecordNoStoreHeaderHistogram(request_->load_flags, new_response); 1231 RecordNoStoreHeaderHistogram(request_->load_flags, new_response);
1229 1232
1230 if (new_response_->headers->response_code() == 416 && 1233 if (new_response_->headers->response_code() == 416 &&
1231 (request_->method == "GET" || request_->method == "POST")) { 1234 (request_->method == "GET" || request_->method == "POST")) {
1232 // If there is an active entry it may be destroyed with this transaction. 1235 // If there is an active entry it may be destroyed with this transaction.
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
2946 2949
2947 void HttpCache::Transaction::OnIOComplete(int result) { 2950 void HttpCache::Transaction::OnIOComplete(int result) {
2948 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422516 is fixed. 2951 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422516 is fixed.
2949 tracked_objects::ScopedProfile tracking_profile( 2952 tracked_objects::ScopedProfile tracking_profile(
2950 FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 Transaction::OnIOComplete")); 2953 FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 Transaction::OnIOComplete"));
2951 2954
2952 DoLoop(result); 2955 DoLoop(result);
2953 } 2956 }
2954 2957
2955 } // namespace net 2958 } // namespace net
OLDNEW
« no previous file with comments | « net/base/sdch_manager_unittest.cc ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698