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

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

Issue 672773002: Http cache: Fix DCHECK with POSTs and a disabled cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | 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 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 (request_->method == "PUT" || request_->method == "DELETE")) { 1212 (request_->method == "PUT" || request_->method == "DELETE")) {
1213 if (NonErrorResponse(new_response->headers->response_code())) { 1213 if (NonErrorResponse(new_response->headers->response_code())) {
1214 int ret = cache_->DoomEntry(cache_key_, NULL); 1214 int ret = cache_->DoomEntry(cache_key_, NULL);
1215 DCHECK_EQ(OK, ret); 1215 DCHECK_EQ(OK, ret);
1216 } 1216 }
1217 cache_->DoneWritingToEntry(entry_, true); 1217 cache_->DoneWritingToEntry(entry_, true);
1218 entry_ = NULL; 1218 entry_ = NULL;
1219 mode_ = NONE; 1219 mode_ = NONE;
1220 } 1220 }
1221 1221
1222 if (request_->method == "POST" && 1222 if (!(effective_load_flags_ & LOAD_DISABLE_CACHE) &&
davidben 2014/10/23 19:14:43 Should this be mode_ != NONE or mode_ & WRITE or s
rvargas (doing something else) 2014/10/23 19:36:09 There are multiple causes for mode_ to change betw
davidben 2014/10/23 19:45:42 Ohh, I see. This is about invalidating GETs after
rvargas (doing something else) 2014/10/23 20:06:15 Done.
1223 request_->method == "POST" &&
1223 NonErrorResponse(new_response->headers->response_code())) { 1224 NonErrorResponse(new_response->headers->response_code())) {
1224 cache_->DoomMainEntryForUrl(request_->url); 1225 cache_->DoomMainEntryForUrl(request_->url);
1225 } 1226 }
1226 1227
1227 RecordVaryHeaderHistogram(new_response); 1228 RecordVaryHeaderHistogram(new_response);
1228 RecordNoStoreHeaderHistogram(request_->load_flags, new_response); 1229 RecordNoStoreHeaderHistogram(request_->load_flags, new_response);
1229 1230
1230 if (new_response_->headers->response_code() == 416 && 1231 if (new_response_->headers->response_code() == 416 &&
1231 (request_->method == "GET" || request_->method == "POST")) { 1232 (request_->method == "GET" || request_->method == "POST")) {
1232 // If there is an active entry it may be destroyed with this transaction. 1233 // 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 2947
2947 void HttpCache::Transaction::OnIOComplete(int result) { 2948 void HttpCache::Transaction::OnIOComplete(int result) {
2948 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422516 is fixed. 2949 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422516 is fixed.
2949 tracked_objects::ScopedProfile tracking_profile( 2950 tracked_objects::ScopedProfile tracking_profile(
2950 FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 Transaction::OnIOComplete")); 2951 FROM_HERE_WITH_EXPLICIT_FUNCTION("422516 Transaction::OnIOComplete"));
2951 2952
2952 DoLoop(result); 2953 DoLoop(result);
2953 } 2954 }
2954 2955
2955 } // namespace net 2956 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698