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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 | 243 |
244 LoadState HttpCache::Transaction::GetWriterLoadState() const { | 244 LoadState HttpCache::Transaction::GetWriterLoadState() const { |
245 if (network_trans_.get()) | 245 if (network_trans_.get()) |
246 return network_trans_->GetLoadState(); | 246 return network_trans_->GetLoadState(); |
247 if (entry_ || !request_) | 247 if (entry_ || !request_) |
248 return LOAD_STATE_IDLE; | 248 return LOAD_STATE_IDLE; |
249 return LOAD_STATE_WAITING_FOR_CACHE; | 249 return LOAD_STATE_WAITING_FOR_CACHE; |
250 } | 250 } |
251 | 251 |
252 const BoundNetLog& HttpCache::Transaction::net_log() const { | 252 const NetLogWithSource& HttpCache::Transaction::net_log() const { |
253 return net_log_; | 253 return net_log_; |
254 } | 254 } |
255 | 255 |
256 int HttpCache::Transaction::Start(const HttpRequestInfo* request, | 256 int HttpCache::Transaction::Start(const HttpRequestInfo* request, |
257 const CompletionCallback& callback, | 257 const CompletionCallback& callback, |
258 const BoundNetLog& net_log) { | 258 const NetLogWithSource& net_log) { |
259 DCHECK(request); | 259 DCHECK(request); |
260 DCHECK(!callback.is_null()); | 260 DCHECK(!callback.is_null()); |
261 | 261 |
262 // Ensure that we only have one asynchronous call at a time. | 262 // Ensure that we only have one asynchronous call at a time. |
263 DCHECK(callback_.is_null()); | 263 DCHECK(callback_.is_null()); |
264 DCHECK(!reading_); | 264 DCHECK(!reading_); |
265 DCHECK(!network_trans_.get()); | 265 DCHECK(!network_trans_.get()); |
266 DCHECK(!entry_); | 266 DCHECK(!entry_); |
267 DCHECK_EQ(next_state_, STATE_NONE); | 267 DCHECK_EQ(next_state_, STATE_NONE); |
268 | 268 |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 next_state_ = STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE; | 1829 next_state_ = STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE; |
1830 return WriteResponseInfoToEntry(true); | 1830 return WriteResponseInfoToEntry(true); |
1831 } | 1831 } |
1832 | 1832 |
1833 int HttpCache::Transaction::DoCacheWriteTruncatedResponseComplete(int result) { | 1833 int HttpCache::Transaction::DoCacheWriteTruncatedResponseComplete(int result) { |
1834 return OnWriteResponseInfoToEntryComplete(result); | 1834 return OnWriteResponseInfoToEntryComplete(result); |
1835 } | 1835 } |
1836 | 1836 |
1837 //----------------------------------------------------------------------------- | 1837 //----------------------------------------------------------------------------- |
1838 | 1838 |
1839 void HttpCache::Transaction::SetRequest(const BoundNetLog& net_log, | 1839 void HttpCache::Transaction::SetRequest(const NetLogWithSource& net_log, |
1840 const HttpRequestInfo* request) { | 1840 const HttpRequestInfo* request) { |
1841 net_log_ = net_log; | 1841 net_log_ = net_log; |
1842 request_ = request; | 1842 request_ = request; |
1843 effective_load_flags_ = request_->load_flags; | 1843 effective_load_flags_ = request_->load_flags; |
1844 | 1844 |
1845 if (cache_->mode() == DISABLE) | 1845 if (cache_->mode() == DISABLE) |
1846 effective_load_flags_ |= LOAD_DISABLE_CACHE; | 1846 effective_load_flags_ |= LOAD_DISABLE_CACHE; |
1847 | 1847 |
1848 // Some headers imply load flags. The order here is significant. | 1848 // Some headers imply load flags. The order here is significant. |
1849 // | 1849 // |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3013 default: | 3013 default: |
3014 NOTREACHED(); | 3014 NOTREACHED(); |
3015 } | 3015 } |
3016 } | 3016 } |
3017 | 3017 |
3018 void HttpCache::Transaction::OnIOComplete(int result) { | 3018 void HttpCache::Transaction::OnIOComplete(int result) { |
3019 DoLoop(result); | 3019 DoLoop(result); |
3020 } | 3020 } |
3021 | 3021 |
3022 } // namespace net | 3022 } // namespace net |
OLD | NEW |