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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 READ_META = 1 << 0, | 54 READ_META = 1 << 0, |
55 READ_DATA = 1 << 1, | 55 READ_DATA = 1 << 1, |
56 READ = READ_META | READ_DATA, | 56 READ = READ_META | READ_DATA, |
57 WRITE = 1 << 2, | 57 WRITE = 1 << 2, |
58 READ_WRITE = READ | WRITE, | 58 READ_WRITE = READ | WRITE, |
59 UPDATE = READ_META | WRITE, // READ_WRITE & ~READ_DATA | 59 UPDATE = READ_META | WRITE, // READ_WRITE & ~READ_DATA |
60 }; | 60 }; |
61 | 61 |
62 Transaction(RequestPriority priority, | 62 Transaction(RequestPriority priority, |
63 HttpCache* cache); | 63 HttpCache* cache); |
64 virtual ~Transaction(); | 64 ~Transaction() override; |
65 | 65 |
66 Mode mode() const { return mode_; } | 66 Mode mode() const { return mode_; } |
67 | 67 |
68 const std::string& key() const { return cache_key_; } | 68 const std::string& key() const { return cache_key_; } |
69 | 69 |
70 // Writes |buf_len| bytes of meta-data from the provided buffer |buf|. to the | 70 // Writes |buf_len| bytes of meta-data from the provided buffer |buf|. to the |
71 // HTTP cache entry that backs this transaction (if any). | 71 // HTTP cache entry that backs this transaction (if any). |
72 // Returns the number of bytes actually written, or a net error code. If the | 72 // Returns the number of bytes actually written, or a net error code. If the |
73 // operation cannot complete immediately, returns ERR_IO_PENDING, grabs a | 73 // operation cannot complete immediately, returns ERR_IO_PENDING, grabs a |
74 // reference to the buffer (until completion), and notifies the caller using | 74 // reference to the buffer (until completion), and notifies the caller using |
(...skipping 28 matching lines...) Expand all Loading... |
103 const CompletionCallback& io_callback() { return io_callback_; } | 103 const CompletionCallback& io_callback() { return io_callback_; } |
104 | 104 |
105 const BoundNetLog& net_log() const; | 105 const BoundNetLog& net_log() const; |
106 | 106 |
107 // Bypasses the cache lock whenever there is lock contention. | 107 // Bypasses the cache lock whenever there is lock contention. |
108 void BypassLockForTest() { | 108 void BypassLockForTest() { |
109 bypass_lock_for_test_ = true; | 109 bypass_lock_for_test_ = true; |
110 } | 110 } |
111 | 111 |
112 // HttpTransaction methods: | 112 // HttpTransaction methods: |
113 virtual int Start(const HttpRequestInfo* request_info, | 113 int Start(const HttpRequestInfo* request_info, |
114 const CompletionCallback& callback, | 114 const CompletionCallback& callback, |
115 const BoundNetLog& net_log) override; | 115 const BoundNetLog& net_log) override; |
116 virtual int RestartIgnoringLastError( | 116 int RestartIgnoringLastError(const CompletionCallback& callback) override; |
117 const CompletionCallback& callback) override; | 117 int RestartWithCertificate(X509Certificate* client_cert, |
118 virtual int RestartWithCertificate( | 118 const CompletionCallback& callback) override; |
119 X509Certificate* client_cert, | 119 int RestartWithAuth(const AuthCredentials& credentials, |
120 const CompletionCallback& callback) override; | 120 const CompletionCallback& callback) override; |
121 virtual int RestartWithAuth(const AuthCredentials& credentials, | 121 bool IsReadyToRestartForAuth() override; |
122 const CompletionCallback& callback) override; | 122 int Read(IOBuffer* buf, |
123 virtual bool IsReadyToRestartForAuth() override; | 123 int buf_len, |
124 virtual int Read(IOBuffer* buf, | 124 const CompletionCallback& callback) override; |
125 int buf_len, | 125 void StopCaching() override; |
126 const CompletionCallback& callback) override; | 126 bool GetFullRequestHeaders(HttpRequestHeaders* headers) const override; |
127 virtual void StopCaching() override; | 127 int64 GetTotalReceivedBytes() const override; |
128 virtual bool GetFullRequestHeaders( | 128 void DoneReading() override; |
129 HttpRequestHeaders* headers) const override; | 129 const HttpResponseInfo* GetResponseInfo() const override; |
130 virtual int64 GetTotalReceivedBytes() const override; | 130 LoadState GetLoadState() const override; |
131 virtual void DoneReading() override; | 131 UploadProgress GetUploadProgress(void) const override; |
132 virtual const HttpResponseInfo* GetResponseInfo() const override; | 132 void SetQuicServerInfo(QuicServerInfo* quic_server_info) override; |
133 virtual LoadState GetLoadState() const override; | 133 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; |
134 virtual UploadProgress GetUploadProgress(void) const override; | 134 void SetPriority(RequestPriority priority) override; |
135 virtual void SetQuicServerInfo(QuicServerInfo* quic_server_info) override; | 135 void SetWebSocketHandshakeStreamCreateHelper( |
136 virtual bool GetLoadTimingInfo( | |
137 LoadTimingInfo* load_timing_info) const override; | |
138 virtual void SetPriority(RequestPriority priority) override; | |
139 virtual void SetWebSocketHandshakeStreamCreateHelper( | |
140 net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; | 136 net::WebSocketHandshakeStreamBase::CreateHelper* create_helper) override; |
141 virtual void SetBeforeNetworkStartCallback( | 137 void SetBeforeNetworkStartCallback( |
142 const BeforeNetworkStartCallback& callback) override; | 138 const BeforeNetworkStartCallback& callback) override; |
143 virtual void SetBeforeProxyHeadersSentCallback( | 139 void SetBeforeProxyHeadersSentCallback( |
144 const BeforeProxyHeadersSentCallback& callback) override; | 140 const BeforeProxyHeadersSentCallback& callback) override; |
145 virtual int ResumeNetworkStart() override; | 141 int ResumeNetworkStart() override; |
146 | 142 |
147 private: | 143 private: |
148 static const size_t kNumValidationHeaders = 2; | 144 static const size_t kNumValidationHeaders = 2; |
149 // Helper struct to pair a header name with its value, for | 145 // Helper struct to pair a header name with its value, for |
150 // headers used to validate cache entries. | 146 // headers used to validate cache entries. |
151 struct ValidationHeaders { | 147 struct ValidationHeaders { |
152 ValidationHeaders() : initialized(false) {} | 148 ValidationHeaders() : initialized(false) {} |
153 | 149 |
154 std::string values[kNumValidationHeaders]; | 150 std::string values[kNumValidationHeaders]; |
155 bool initialized; | 151 bool initialized; |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; | 465 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; |
470 | 466 |
471 base::WeakPtrFactory<Transaction> weak_factory_; | 467 base::WeakPtrFactory<Transaction> weak_factory_; |
472 | 468 |
473 DISALLOW_COPY_AND_ASSIGN(Transaction); | 469 DISALLOW_COPY_AND_ASSIGN(Transaction); |
474 }; | 470 }; |
475 | 471 |
476 } // namespace net | 472 } // namespace net |
477 | 473 |
478 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 474 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
OLD | NEW |