| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file declares HttpCache::Transaction, a private class of HttpCache so | 5 // This file declares HttpCache::Transaction, a private class of HttpCache so |
| 6 // it should only be included by http_cache.cc | 6 // it should only be included by http_cache.cc |
| 7 | 7 |
| 8 #ifndef NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 8 #ifndef NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| 9 #define NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 9 #define NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // We need to indicate that the response data was truncated. Returns true on | 86 // We need to indicate that the response data was truncated. Returns true on |
| 87 // success. | 87 // success. |
| 88 bool AddTruncatedFlag(); | 88 bool AddTruncatedFlag(); |
| 89 | 89 |
| 90 // Returns the LoadState of the writer transaction of a given ActiveEntry. In | 90 // Returns the LoadState of the writer transaction of a given ActiveEntry. In |
| 91 // other words, returns the LoadState of this transaction without asking the | 91 // other words, returns the LoadState of this transaction without asking the |
| 92 // http cache, because this transaction should be the one currently writing | 92 // http cache, because this transaction should be the one currently writing |
| 93 // to the cache entry. | 93 // to the cache entry. |
| 94 LoadState GetWriterLoadState() const; | 94 LoadState GetWriterLoadState() const; |
| 95 | 95 |
| 96 OldCompletionCallback* io_callback() { return &io_callback_; } | 96 const CompletionCallback& io_callback() { return io_callback_; } |
| 97 | 97 |
| 98 const BoundNetLog& net_log() const; | 98 const BoundNetLog& net_log() const; |
| 99 | 99 |
| 100 // HttpTransaction methods: | 100 // HttpTransaction methods: |
| 101 virtual int Start(const HttpRequestInfo*, OldCompletionCallback*, | 101 virtual int Start(const HttpRequestInfo*, const CompletionCallback&, |
| 102 const BoundNetLog&) OVERRIDE; | 102 const BoundNetLog&) OVERRIDE; |
| 103 virtual int RestartIgnoringLastError( | 103 virtual int RestartIgnoringLastError( |
| 104 OldCompletionCallback* callback) OVERRIDE; | 104 const CompletionCallback& callback) OVERRIDE; |
| 105 virtual int RestartWithCertificate(X509Certificate* client_cert, | 105 virtual int RestartWithCertificate( |
| 106 OldCompletionCallback* callback) OVERRIDE; | 106 X509Certificate* client_cert, |
| 107 const CompletionCallback& callback) OVERRIDE; |
| 107 virtual int RestartWithAuth(const AuthCredentials& credentials, | 108 virtual int RestartWithAuth(const AuthCredentials& credentials, |
| 108 OldCompletionCallback* callback) OVERRIDE; | 109 const CompletionCallback& callback) OVERRIDE; |
| 109 virtual bool IsReadyToRestartForAuth() OVERRIDE; | 110 virtual bool IsReadyToRestartForAuth() OVERRIDE; |
| 110 virtual int Read(IOBuffer* buf, | 111 virtual int Read(IOBuffer* buf, |
| 111 int buf_len, | 112 int buf_len, |
| 112 OldCompletionCallback* callback) OVERRIDE; | 113 const CompletionCallback& callback) OVERRIDE; |
| 113 virtual void StopCaching() OVERRIDE; | 114 virtual void StopCaching() OVERRIDE; |
| 114 virtual void DoneReading() OVERRIDE; | 115 virtual void DoneReading() OVERRIDE; |
| 115 virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE; | 116 virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE; |
| 116 virtual LoadState GetLoadState() const OVERRIDE; | 117 virtual LoadState GetLoadState() const OVERRIDE; |
| 117 virtual uint64 GetUploadProgress(void) const OVERRIDE; | 118 virtual uint64 GetUploadProgress(void) const OVERRIDE; |
| 118 | 119 |
| 119 private: | 120 private: |
| 120 static const size_t kNumValidationHeaders = 2; | 121 static const size_t kNumValidationHeaders = 2; |
| 121 // Helper struct to pair a header name with its value, for | 122 // Helper struct to pair a header name with its value, for |
| 122 // headers used to validate cache entries. | 123 // headers used to validate cache entries. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 scoped_ptr<HttpRequestInfo> custom_request_; | 332 scoped_ptr<HttpRequestInfo> custom_request_; |
| 332 HttpRequestHeaders request_headers_copy_; | 333 HttpRequestHeaders request_headers_copy_; |
| 333 // If extra_headers specified a "if-modified-since" or "if-none-match", | 334 // If extra_headers specified a "if-modified-since" or "if-none-match", |
| 334 // |external_validation_| contains the value of those headers. | 335 // |external_validation_| contains the value of those headers. |
| 335 ValidationHeaders external_validation_; | 336 ValidationHeaders external_validation_; |
| 336 base::WeakPtr<HttpCache> cache_; | 337 base::WeakPtr<HttpCache> cache_; |
| 337 HttpCache::ActiveEntry* entry_; | 338 HttpCache::ActiveEntry* entry_; |
| 338 base::TimeTicks entry_lock_waiting_since_; | 339 base::TimeTicks entry_lock_waiting_since_; |
| 339 HttpCache::ActiveEntry* new_entry_; | 340 HttpCache::ActiveEntry* new_entry_; |
| 340 scoped_ptr<HttpTransaction> network_trans_; | 341 scoped_ptr<HttpTransaction> network_trans_; |
| 341 OldCompletionCallback* callback_; // Consumer's callback. | 342 CompletionCallback callback_; // Consumer's callback. |
| 342 HttpResponseInfo response_; | 343 HttpResponseInfo response_; |
| 343 HttpResponseInfo auth_response_; | 344 HttpResponseInfo auth_response_; |
| 344 const HttpResponseInfo* new_response_; | 345 const HttpResponseInfo* new_response_; |
| 345 std::string cache_key_; | 346 std::string cache_key_; |
| 346 Mode mode_; | 347 Mode mode_; |
| 347 State target_state_; | 348 State target_state_; |
| 348 bool reading_; // We are already reading. | 349 bool reading_; // We are already reading. |
| 349 bool invalid_range_; // We may bypass the cache for this request. | 350 bool invalid_range_; // We may bypass the cache for this request. |
| 350 bool truncated_; // We don't have all the response data. | 351 bool truncated_; // We don't have all the response data. |
| 351 bool is_sparse_; // The data is stored in sparse byte ranges. | 352 bool is_sparse_; // The data is stored in sparse byte ranges. |
| 352 bool range_requested_; // The user requested a byte range. | 353 bool range_requested_; // The user requested a byte range. |
| 353 bool handling_206_; // We must deal with this 206 response. | 354 bool handling_206_; // We must deal with this 206 response. |
| 354 bool cache_pending_; // We are waiting for the HttpCache. | 355 bool cache_pending_; // We are waiting for the HttpCache. |
| 355 bool done_reading_; | 356 bool done_reading_; |
| 356 scoped_refptr<IOBuffer> read_buf_; | 357 scoped_refptr<IOBuffer> read_buf_; |
| 357 int io_buf_len_; | 358 int io_buf_len_; |
| 358 int read_offset_; | 359 int read_offset_; |
| 359 int effective_load_flags_; | 360 int effective_load_flags_; |
| 360 int write_len_; | 361 int write_len_; |
| 361 scoped_ptr<PartialData> partial_; // We are dealing with range requests. | 362 scoped_ptr<PartialData> partial_; // We are dealing with range requests. |
| 362 uint64 final_upload_progress_; | 363 uint64 final_upload_progress_; |
| 363 OldCompletionCallbackImpl<Transaction> io_callback_; | 364 CompletionCallback io_callback_; |
| 364 scoped_refptr<CancelableOldCompletionCallback<Transaction> > cache_callback_; | 365 scoped_refptr<CancelableOldCompletionCallback<Transaction> > cache_callback_; |
| 365 scoped_refptr<CancelableOldCompletionCallback<Transaction> > | 366 scoped_refptr<CancelableOldCompletionCallback<Transaction> > |
| 366 write_headers_callback_; | 367 write_headers_callback_; |
| 367 }; | 368 }; |
| 368 | 369 |
| 369 } // namespace net | 370 } // namespace net |
| 370 | 371 |
| 371 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 372 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| OLD | NEW |