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

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

Issue 2508473002: [DevTools] Properly handle cache-only requests when cache is disabled (Closed)
Patch Set: Fix Created 4 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
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" // For OS_POSIX 7 #include "build/build_config.h" // For OS_POSIX
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 DCHECK(result == OK || result == ERR_FAILED); 895 DCHECK(result == OK || result == ERR_FAILED);
896 net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_GET_BACKEND, 896 net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_GET_BACKEND,
897 result); 897 result);
898 cache_pending_ = false; 898 cache_pending_ = false;
899 899
900 if (!ShouldPassThrough()) { 900 if (!ShouldPassThrough()) {
901 cache_key_ = cache_->GenerateCacheKey(request_); 901 cache_key_ = cache_->GenerateCacheKey(request_);
902 902
903 // Requested cache access mode. 903 // Requested cache access mode.
904 if (effective_load_flags_ & LOAD_ONLY_FROM_CACHE) { 904 if (effective_load_flags_ & LOAD_ONLY_FROM_CACHE) {
905 if (effective_load_flags_ & LOAD_BYPASS_CACHE) {
906 // The client has asked for nonsense.
907 return ERR_CACHE_MISS;
908 }
905 mode_ = READ; 909 mode_ = READ;
906 } else if (effective_load_flags_ & LOAD_BYPASS_CACHE) { 910 } else if (effective_load_flags_ & LOAD_BYPASS_CACHE) {
907 mode_ = WRITE; 911 mode_ = WRITE;
908 } else { 912 } else {
909 mode_ = READ_WRITE; 913 mode_ = READ_WRITE;
910 } 914 }
911 915
912 // Downgrade to UPDATE if the request has been externally conditionalized. 916 // Downgrade to UPDATE if the request has been externally conditionalized.
913 if (external_validation_.initialized) { 917 if (external_validation_.initialized) {
914 if (mode_ & WRITE) { 918 if (mode_ & WRITE) {
(...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after
2940 default: 2944 default:
2941 NOTREACHED(); 2945 NOTREACHED();
2942 } 2946 }
2943 } 2947 }
2944 2948
2945 void HttpCache::Transaction::OnIOComplete(int result) { 2949 void HttpCache::Transaction::OnIOComplete(int result) {
2946 DoLoop(result); 2950 DoLoop(result);
2947 } 2951 }
2948 2952
2949 } // namespace net 2953 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698