| OLD | NEW |
| 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 Loading... |
| 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 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2939 default: | 2943 default: |
| 2940 NOTREACHED(); | 2944 NOTREACHED(); |
| 2941 } | 2945 } |
| 2942 } | 2946 } |
| 2943 | 2947 |
| 2944 void HttpCache::Transaction::OnIOComplete(int result) { | 2948 void HttpCache::Transaction::OnIOComplete(int result) { |
| 2945 DoLoop(result); | 2949 DoLoop(result); |
| 2946 } | 2950 } |
| 2947 | 2951 |
| 2948 } // namespace net | 2952 } // namespace net |
| OLD | NEW |