| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 | 10 |
| 11 #include "net/base/net_log.h" |
| 11 #include "net/http/http_cache.h" | 12 #include "net/http/http_cache.h" |
| 12 #include "net/http/http_response_info.h" | 13 #include "net/http/http_response_info.h" |
| 13 #include "net/http/http_transaction.h" | 14 #include "net/http/http_transaction.h" |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 | 17 |
| 17 class HttpResponseHeaders; | 18 class HttpResponseHeaders; |
| 18 class PartialData; | 19 class PartialData; |
| 19 | 20 |
| 20 // This is the transaction that is returned by the HttpCache transaction | 21 // This is the transaction that is returned by the HttpCache transaction |
| 21 // factory. | 22 // factory. |
| 22 class HttpCache::Transaction : public HttpTransaction { | 23 class HttpCache::Transaction : public HttpTransaction { |
| 23 public: | 24 public: |
| 24 Transaction(HttpCache* cache, bool enable_range_support); | 25 Transaction(HttpCache* cache, bool enable_range_support); |
| 25 virtual ~Transaction(); | 26 virtual ~Transaction(); |
| 26 | 27 |
| 27 // HttpTransaction methods: | 28 // HttpTransaction methods: |
| 28 virtual int Start(const HttpRequestInfo*, CompletionCallback*, LoadLog*); | 29 virtual int Start(const HttpRequestInfo*, CompletionCallback*, |
| 30 const BoundNetLog&); |
| 29 virtual int RestartIgnoringLastError(CompletionCallback* callback); | 31 virtual int RestartIgnoringLastError(CompletionCallback* callback); |
| 30 virtual int RestartWithCertificate(X509Certificate* client_cert, | 32 virtual int RestartWithCertificate(X509Certificate* client_cert, |
| 31 CompletionCallback* callback); | 33 CompletionCallback* callback); |
| 32 virtual int RestartWithAuth(const std::wstring& username, | 34 virtual int RestartWithAuth(const std::wstring& username, |
| 33 const std::wstring& password, | 35 const std::wstring& password, |
| 34 CompletionCallback* callback); | 36 CompletionCallback* callback); |
| 35 virtual bool IsReadyToRestartForAuth(); | 37 virtual bool IsReadyToRestartForAuth(); |
| 36 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 38 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
| 37 virtual void StopCaching(); | 39 virtual void StopCaching(); |
| 38 virtual const HttpResponseInfo* GetResponseInfo() const; | 40 virtual const HttpResponseInfo* GetResponseInfo() const; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 int DoCacheReadMetadata(); | 189 int DoCacheReadMetadata(); |
| 188 int DoCacheReadMetadataComplete(int result); | 190 int DoCacheReadMetadataComplete(int result); |
| 189 int DoCacheQueryData(); | 191 int DoCacheQueryData(); |
| 190 int DoCacheQueryDataComplete(int result); | 192 int DoCacheQueryDataComplete(int result); |
| 191 int DoCacheReadData(); | 193 int DoCacheReadData(); |
| 192 int DoCacheReadDataComplete(int result); | 194 int DoCacheReadDataComplete(int result); |
| 193 int DoCacheWriteData(int num_bytes); | 195 int DoCacheWriteData(int num_bytes); |
| 194 int DoCacheWriteDataComplete(int result); | 196 int DoCacheWriteDataComplete(int result); |
| 195 | 197 |
| 196 // Sets request_ and fields derived from it. | 198 // Sets request_ and fields derived from it. |
| 197 void SetRequest(LoadLog* load_log, const HttpRequestInfo* request); | 199 void SetRequest(const BoundNetLog& net_log, const HttpRequestInfo* request); |
| 198 | 200 |
| 199 // Returns true if the request should be handled exclusively by the network | 201 // Returns true if the request should be handled exclusively by the network |
| 200 // layer (skipping the cache entirely). | 202 // layer (skipping the cache entirely). |
| 201 bool ShouldPassThrough(); | 203 bool ShouldPassThrough(); |
| 202 | 204 |
| 203 // Associates this transaction with a cache entry. | 205 // Associates this transaction with a cache entry. |
| 204 int AddToEntry(); | 206 int AddToEntry(); |
| 205 | 207 |
| 206 // Called to begin reading from the cache. Returns network error code. | 208 // Called to begin reading from the cache. Returns network error code. |
| 207 int BeginCacheRead(); | 209 int BeginCacheRead(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 int DoPartialCacheReadCompleted(int result); | 294 int DoPartialCacheReadCompleted(int result); |
| 293 | 295 |
| 294 // Sends a histogram with info about the response headers. | 296 // Sends a histogram with info about the response headers. |
| 295 void HistogramHeaders(const HttpResponseHeaders* headers); | 297 void HistogramHeaders(const HttpResponseHeaders* headers); |
| 296 | 298 |
| 297 // Called to signal completion of asynchronous IO. | 299 // Called to signal completion of asynchronous IO. |
| 298 void OnIOComplete(int result); | 300 void OnIOComplete(int result); |
| 299 | 301 |
| 300 State next_state_; | 302 State next_state_; |
| 301 const HttpRequestInfo* request_; | 303 const HttpRequestInfo* request_; |
| 302 scoped_refptr<LoadLog> load_log_; | 304 BoundNetLog net_log_; |
| 303 scoped_ptr<HttpRequestInfo> custom_request_; | 305 scoped_ptr<HttpRequestInfo> custom_request_; |
| 304 // If extra_headers specified a "if-modified-since" or "if-none-match", | 306 // If extra_headers specified a "if-modified-since" or "if-none-match", |
| 305 // |external_validation_| contains the value of those headers. | 307 // |external_validation_| contains the value of those headers. |
| 306 ValidationHeaders external_validation_; | 308 ValidationHeaders external_validation_; |
| 307 base::WeakPtr<HttpCache> cache_; | 309 base::WeakPtr<HttpCache> cache_; |
| 308 HttpCache::ActiveEntry* entry_; | 310 HttpCache::ActiveEntry* entry_; |
| 309 HttpCache::ActiveEntry* new_entry_; | 311 HttpCache::ActiveEntry* new_entry_; |
| 310 scoped_ptr<HttpTransaction> network_trans_; | 312 scoped_ptr<HttpTransaction> network_trans_; |
| 311 CompletionCallback* callback_; // Consumer's callback. | 313 CompletionCallback* callback_; // Consumer's callback. |
| 312 HttpResponseInfo response_; | 314 HttpResponseInfo response_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 329 uint64 final_upload_progress_; | 331 uint64 final_upload_progress_; |
| 330 CompletionCallbackImpl<Transaction> io_callback_; | 332 CompletionCallbackImpl<Transaction> io_callback_; |
| 331 scoped_refptr<CancelableCompletionCallback<Transaction> > cache_callback_; | 333 scoped_refptr<CancelableCompletionCallback<Transaction> > cache_callback_; |
| 332 scoped_refptr<CancelableCompletionCallback<Transaction> > | 334 scoped_refptr<CancelableCompletionCallback<Transaction> > |
| 333 write_headers_callback_; | 335 write_headers_callback_; |
| 334 }; | 336 }; |
| 335 | 337 |
| 336 } // namespace net | 338 } // namespace net |
| 337 | 339 |
| 338 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 340 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| OLD | NEW |