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 // 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 |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 namespace net { | 37 namespace net { |
38 | 38 |
39 class PartialData; | 39 class PartialData; |
40 struct HttpRequestInfo; | 40 struct HttpRequestInfo; |
41 struct LoadTimingInfo; | 41 struct LoadTimingInfo; |
42 class SSLPrivateKey; | 42 class SSLPrivateKey; |
43 | 43 |
44 // This is the transaction that is returned by the HttpCache transaction | 44 // This is the transaction that is returned by the HttpCache transaction |
45 // factory. | 45 // factory. |
46 class HttpCache::Transaction : public HttpTransaction { | 46 class NET_EXPORT_PRIVATE HttpCache::Transaction : public HttpTransaction { |
47 public: | 47 public: |
48 // The transaction has the following modes, which apply to how it may access | 48 // The transaction has the following modes, which apply to how it may access |
49 // its cache entry. | 49 // its cache entry. |
50 // | 50 // |
51 // o If the mode of the transaction is NONE, then it is in "pass through" | 51 // o If the mode of the transaction is NONE, then it is in "pass through" |
52 // mode and all methods just forward to the inner network transaction. | 52 // mode and all methods just forward to the inner network transaction. |
53 // | 53 // |
54 // o If the mode of the transaction is only READ, then it may only read from | 54 // o If the mode of the transaction is only READ, then it may only read from |
55 // the cache entry. | 55 // the cache entry. |
56 // | 56 // |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // and this transaction needs to be restarted. | 176 // and this transaction needs to be restarted. |
177 void SetValidatingCannotProceed(); | 177 void SetValidatingCannotProceed(); |
178 | 178 |
179 // Invoked to remove the association between a transaction waiting to be | 179 // Invoked to remove the association between a transaction waiting to be |
180 // added to an entry and the entry. | 180 // added to an entry and the entry. |
181 void ResetCachePendingState() { cache_pending_ = false; } | 181 void ResetCachePendingState() { cache_pending_ = false; } |
182 | 182 |
183 // Returns the estimate of dynamically allocated memory in bytes. | 183 // Returns the estimate of dynamically allocated memory in bytes. |
184 size_t EstimateMemoryUsage() const; | 184 size_t EstimateMemoryUsage() const; |
185 | 185 |
| 186 // Sets fail state such that a future Read fails with |error_code|. |
| 187 void SetSharedWritingFailState(int error_code); |
| 188 |
| 189 RequestPriority priority() const { return priority_; } |
| 190 PartialData* partial() { return partial_.get(); } |
| 191 |
186 private: | 192 private: |
187 static const size_t kNumValidationHeaders = 2; | 193 static const size_t kNumValidationHeaders = 2; |
188 // Helper struct to pair a header name with its value, for | 194 // Helper struct to pair a header name with its value, for |
189 // headers used to validate cache entries. | 195 // headers used to validate cache entries. |
190 struct ValidationHeaders { | 196 struct ValidationHeaders { |
191 ValidationHeaders() : initialized(false) {} | 197 ValidationHeaders() : initialized(false) {} |
192 | 198 |
193 std::string values[kNumValidationHeaders]; | 199 std::string values[kNumValidationHeaders]; |
194 void Reset() { | 200 void Reset() { |
195 initialized = false; | 201 initialized = false; |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 bool in_do_loop_; | 572 bool in_do_loop_; |
567 | 573 |
568 base::WeakPtrFactory<Transaction> weak_factory_; | 574 base::WeakPtrFactory<Transaction> weak_factory_; |
569 | 575 |
570 DISALLOW_COPY_AND_ASSIGN(Transaction); | 576 DISALLOW_COPY_AND_ASSIGN(Transaction); |
571 }; | 577 }; |
572 | 578 |
573 } // namespace net | 579 } // namespace net |
574 | 580 |
575 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 581 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
OLD | NEW |