| 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 15 matching lines...) Expand all Loading... |
| 26 #include "base/strings/string_piece.h" | 26 #include "base/strings/string_piece.h" |
| 27 #include "base/strings/string_util.h" // For LowerCaseEqualsASCII. | 27 #include "base/strings/string_util.h" // For LowerCaseEqualsASCII. |
| 28 #include "base/strings/stringprintf.h" | 28 #include "base/strings/stringprintf.h" |
| 29 #include "base/threading/thread_task_runner_handle.h" | 29 #include "base/threading/thread_task_runner_handle.h" |
| 30 #include "base/time/clock.h" | 30 #include "base/time/clock.h" |
| 31 #include "base/trace_event/trace_event.h" | 31 #include "base/trace_event/trace_event.h" |
| 32 #include "base/values.h" | 32 #include "base/values.h" |
| 33 #include "net/base/auth.h" | 33 #include "net/base/auth.h" |
| 34 #include "net/base/load_flags.h" | 34 #include "net/base/load_flags.h" |
| 35 #include "net/base/load_timing_info.h" | 35 #include "net/base/load_timing_info.h" |
| 36 #include "net/base/trace_constants.h" |
| 36 #include "net/base/upload_data_stream.h" | 37 #include "net/base/upload_data_stream.h" |
| 37 #include "net/cert/cert_status_flags.h" | 38 #include "net/cert/cert_status_flags.h" |
| 38 #include "net/cert/x509_certificate.h" | 39 #include "net/cert/x509_certificate.h" |
| 39 #include "net/disk_cache/disk_cache.h" | 40 #include "net/disk_cache/disk_cache.h" |
| 40 #include "net/http/http_network_session.h" | 41 #include "net/http/http_network_session.h" |
| 41 #include "net/http/http_request_info.h" | 42 #include "net/http/http_request_info.h" |
| 42 #include "net/http/http_util.h" | 43 #include "net/http/http_util.h" |
| 43 #include "net/log/net_log_event_type.h" | 44 #include "net/log/net_log_event_type.h" |
| 44 #include "net/ssl/ssl_cert_request_info.h" | 45 #include "net/ssl/ssl_cert_request_info.h" |
| 45 #include "net/ssl/ssl_config_service.h" | 46 #include "net/ssl/ssl_config_service.h" |
| (...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 // transaction then metadata will be written to cache twice. If prefetching | 1259 // transaction then metadata will be written to cache twice. If prefetching |
| 1259 // becomes more common, consider combining the writes. | 1260 // becomes more common, consider combining the writes. |
| 1260 | 1261 |
| 1261 next_state_ = STATE_TOGGLE_UNUSED_SINCE_PREFETCH_COMPLETE; | 1262 next_state_ = STATE_TOGGLE_UNUSED_SINCE_PREFETCH_COMPLETE; |
| 1262 return WriteResponseInfoToEntry(false); | 1263 return WriteResponseInfoToEntry(false); |
| 1263 } | 1264 } |
| 1264 | 1265 |
| 1265 int HttpCache::Transaction::DoCacheToggleUnusedSincePrefetchComplete( | 1266 int HttpCache::Transaction::DoCacheToggleUnusedSincePrefetchComplete( |
| 1266 int result) { | 1267 int result) { |
| 1267 TRACE_EVENT0( | 1268 TRACE_EVENT0( |
| 1268 "net", "HttpCacheTransaction::DoCacheToggleUnusedSincePrefetchComplete"); | 1269 kNetTracingCategory, |
| 1270 "HttpCacheTransaction::DoCacheToggleUnusedSincePrefetchComplete"); |
| 1269 // Restore the original value for this transaction. | 1271 // Restore the original value for this transaction. |
| 1270 response_.unused_since_prefetch = !response_.unused_since_prefetch; | 1272 response_.unused_since_prefetch = !response_.unused_since_prefetch; |
| 1271 next_state_ = STATE_CACHE_DISPATCH_VALIDATION; | 1273 next_state_ = STATE_CACHE_DISPATCH_VALIDATION; |
| 1272 return OnWriteResponseInfoToEntryComplete(result); | 1274 return OnWriteResponseInfoToEntryComplete(result); |
| 1273 } | 1275 } |
| 1274 | 1276 |
| 1275 int HttpCache::Transaction::DoCacheDispatchValidation() { | 1277 int HttpCache::Transaction::DoCacheDispatchValidation() { |
| 1276 TRACE_EVENT0("io", "HttpCacheTransaction::DoCacheDispatchValidation"); | 1278 TRACE_EVENT0("io", "HttpCacheTransaction::DoCacheDispatchValidation"); |
| 1277 // We now have access to the cache entry. | 1279 // We now have access to the cache entry. |
| 1278 // | 1280 // |
| (...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2989 default: | 2991 default: |
| 2990 NOTREACHED(); | 2992 NOTREACHED(); |
| 2991 } | 2993 } |
| 2992 } | 2994 } |
| 2993 | 2995 |
| 2994 void HttpCache::Transaction::OnIOComplete(int result) { | 2996 void HttpCache::Transaction::OnIOComplete(int result) { |
| 2995 DoLoop(result); | 2997 DoLoop(result); |
| 2996 } | 2998 } |
| 2997 | 2999 |
| 2998 } // namespace net | 3000 } // namespace net |
| OLD | NEW |