| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Helper struct to pair a header name with its value, for | 163 // Helper struct to pair a header name with its value, for |
| 164 // headers used to validate cache entries. | 164 // headers used to validate cache entries. |
| 165 struct ValidationHeaders { | 165 struct ValidationHeaders { |
| 166 ValidationHeaders() : initialized(false) {} | 166 ValidationHeaders() : initialized(false) {} |
| 167 | 167 |
| 168 std::string values[kNumValidationHeaders]; | 168 std::string values[kNumValidationHeaders]; |
| 169 bool initialized; | 169 bool initialized; |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 enum State { | 172 enum State { |
| 173 // Normally, states are traversed in approximately this order. |
| 173 STATE_NONE, | 174 STATE_NONE, |
| 174 STATE_GET_BACKEND, | 175 STATE_GET_BACKEND, |
| 175 STATE_GET_BACKEND_COMPLETE, | 176 STATE_GET_BACKEND_COMPLETE, |
| 177 STATE_INIT_ENTRY, |
| 178 STATE_OPEN_ENTRY, |
| 179 STATE_OPEN_ENTRY_COMPLETE, |
| 180 STATE_DOOM_ENTRY, |
| 181 STATE_DOOM_ENTRY_COMPLETE, |
| 182 STATE_CREATE_ENTRY, |
| 183 STATE_CREATE_ENTRY_COMPLETE, |
| 184 STATE_ADD_TO_ENTRY, |
| 185 STATE_ADD_TO_ENTRY_COMPLETE, |
| 186 STATE_CACHE_READ_RESPONSE, |
| 187 STATE_CACHE_READ_RESPONSE_COMPLETE, |
| 188 STATE_TOGGLE_UNUSED_SINCE_PREFETCH, |
| 189 STATE_TOGGLE_UNUSED_SINCE_PREFETCH_COMPLETE, |
| 190 STATE_CACHE_DISPATCH_VALIDATION, |
| 191 STATE_CACHE_QUERY_DATA, |
| 192 STATE_CACHE_QUERY_DATA_COMPLETE, |
| 193 STATE_START_PARTIAL_CACHE_VALIDATION, |
| 194 STATE_COMPLETE_PARTIAL_CACHE_VALIDATION, |
| 176 STATE_SEND_REQUEST, | 195 STATE_SEND_REQUEST, |
| 177 STATE_SEND_REQUEST_COMPLETE, | 196 STATE_SEND_REQUEST_COMPLETE, |
| 178 STATE_SUCCESSFUL_SEND_REQUEST, | 197 STATE_SUCCESSFUL_SEND_REQUEST, |
| 179 STATE_NETWORK_READ, | |
| 180 STATE_NETWORK_READ_COMPLETE, | |
| 181 STATE_INIT_ENTRY, | |
| 182 STATE_OPEN_ENTRY, | |
| 183 STATE_OPEN_ENTRY_COMPLETE, | |
| 184 STATE_CREATE_ENTRY, | |
| 185 STATE_CREATE_ENTRY_COMPLETE, | |
| 186 STATE_DOOM_ENTRY, | |
| 187 STATE_DOOM_ENTRY_COMPLETE, | |
| 188 STATE_ADD_TO_ENTRY, | |
| 189 STATE_ADD_TO_ENTRY_COMPLETE, | |
| 190 STATE_START_PARTIAL_CACHE_VALIDATION, | |
| 191 STATE_COMPLETE_PARTIAL_CACHE_VALIDATION, | |
| 192 STATE_UPDATE_CACHED_RESPONSE, | 198 STATE_UPDATE_CACHED_RESPONSE, |
| 193 STATE_UPDATE_CACHED_RESPONSE_COMPLETE, | 199 STATE_UPDATE_CACHED_RESPONSE_COMPLETE, |
| 194 STATE_OVERWRITE_CACHED_RESPONSE, | 200 STATE_OVERWRITE_CACHED_RESPONSE, |
| 201 STATE_CACHE_WRITE_RESPONSE, |
| 202 STATE_CACHE_WRITE_TRUNCATED_RESPONSE, |
| 203 STATE_CACHE_WRITE_RESPONSE_COMPLETE, |
| 195 STATE_TRUNCATE_CACHED_DATA, | 204 STATE_TRUNCATE_CACHED_DATA, |
| 196 STATE_TRUNCATE_CACHED_DATA_COMPLETE, | 205 STATE_TRUNCATE_CACHED_DATA_COMPLETE, |
| 197 STATE_TRUNCATE_CACHED_METADATA, | 206 STATE_TRUNCATE_CACHED_METADATA, |
| 198 STATE_TRUNCATE_CACHED_METADATA_COMPLETE, | 207 STATE_TRUNCATE_CACHED_METADATA_COMPLETE, |
| 199 STATE_PARTIAL_HEADERS_RECEIVED, | 208 STATE_PARTIAL_HEADERS_RECEIVED, |
| 200 STATE_CACHE_READ_RESPONSE, | |
| 201 STATE_CACHE_READ_RESPONSE_COMPLETE, | |
| 202 STATE_CACHE_DISPATCH_VALIDATION, | |
| 203 STATE_TOGGLE_UNUSED_SINCE_PREFETCH, | |
| 204 STATE_TOGGLE_UNUSED_SINCE_PREFETCH_COMPLETE, | |
| 205 STATE_CACHE_WRITE_RESPONSE, | |
| 206 STATE_CACHE_WRITE_TRUNCATED_RESPONSE, | |
| 207 STATE_CACHE_WRITE_RESPONSE_COMPLETE, | |
| 208 STATE_CACHE_READ_METADATA, | 209 STATE_CACHE_READ_METADATA, |
| 209 STATE_CACHE_READ_METADATA_COMPLETE, | 210 STATE_CACHE_READ_METADATA_COMPLETE, |
| 210 STATE_CACHE_QUERY_DATA, | 211 |
| 211 STATE_CACHE_QUERY_DATA_COMPLETE, | 212 // These states are entered from Read/Write |
| 213 STATE_NETWORK_READ, |
| 214 STATE_NETWORK_READ_COMPLETE, |
| 212 STATE_CACHE_READ_DATA, | 215 STATE_CACHE_READ_DATA, |
| 213 STATE_CACHE_READ_DATA_COMPLETE, | 216 STATE_CACHE_READ_DATA_COMPLETE, |
| 214 STATE_CACHE_WRITE_DATA, | 217 STATE_CACHE_WRITE_DATA, |
| 215 STATE_CACHE_WRITE_DATA_COMPLETE | 218 STATE_CACHE_WRITE_DATA_COMPLETE |
| 216 }; | 219 }; |
| 217 | 220 |
| 218 // Used for categorizing transactions for reporting in histograms. Patterns | 221 // Used for categorizing transactions for reporting in histograms. Patterns |
| 219 // cover relatively common use cases being measured and considered for | 222 // cover relatively common use cases being measured and considered for |
| 220 // optimization. Many use cases that are more complex or uncommon are binned | 223 // optimization. Many use cases that are more complex or uncommon are binned |
| 221 // as PATTERN_NOT_COVERED, and details are not reported. | 224 // as PATTERN_NOT_COVERED, and details are not reported. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 240 int HandleResult(int rv); | 243 int HandleResult(int rv); |
| 241 | 244 |
| 242 // Runs the state transition loop. | 245 // Runs the state transition loop. |
| 243 int DoLoop(int result); | 246 int DoLoop(int result); |
| 244 | 247 |
| 245 // Each of these methods corresponds to a State value. If there is an | 248 // Each of these methods corresponds to a State value. If there is an |
| 246 // argument, the value corresponds to the return of the previous state or | 249 // argument, the value corresponds to the return of the previous state or |
| 247 // corresponding callback. | 250 // corresponding callback. |
| 248 int DoGetBackend(); | 251 int DoGetBackend(); |
| 249 int DoGetBackendComplete(int result); | 252 int DoGetBackendComplete(int result); |
| 253 int DoInitEntry(); |
| 254 int DoOpenEntry(); |
| 255 int DoOpenEntryComplete(int result); |
| 256 int DoDoomEntry(); |
| 257 int DoDoomEntryComplete(int result); |
| 258 int DoCreateEntry(); |
| 259 int DoCreateEntryComplete(int result); |
| 260 int DoAddToEntry(); |
| 261 int DoAddToEntryComplete(int result); |
| 262 int DoCacheReadResponse(); |
| 263 int DoCacheReadResponseComplete(int result); |
| 264 int DoCacheToggleUnusedSincePrefetch(); |
| 265 int DoCacheToggleUnusedSincePrefetchComplete(int result); |
| 266 int DoCacheDispatchValidation(); |
| 267 int DoCacheQueryData(); |
| 268 int DoCacheQueryDataComplete(int result); |
| 269 int DoStartPartialCacheValidation(); |
| 270 int DoCompletePartialCacheValidation(int result); |
| 250 int DoSendRequest(); | 271 int DoSendRequest(); |
| 251 int DoSendRequestComplete(int result); | 272 int DoSendRequestComplete(int result); |
| 252 int DoSuccessfulSendRequest(); | 273 int DoSuccessfulSendRequest(); |
| 253 int DoNetworkRead(); | |
| 254 int DoNetworkReadComplete(int result); | |
| 255 int DoInitEntry(); | |
| 256 int DoOpenEntry(); | |
| 257 int DoOpenEntryComplete(int result); | |
| 258 int DoCreateEntry(); | |
| 259 int DoCreateEntryComplete(int result); | |
| 260 int DoDoomEntry(); | |
| 261 int DoDoomEntryComplete(int result); | |
| 262 int DoAddToEntry(); | |
| 263 int DoAddToEntryComplete(int result); | |
| 264 int DoStartPartialCacheValidation(); | |
| 265 int DoCompletePartialCacheValidation(int result); | |
| 266 int DoUpdateCachedResponse(); | 274 int DoUpdateCachedResponse(); |
| 267 int DoUpdateCachedResponseComplete(int result); | 275 int DoUpdateCachedResponseComplete(int result); |
| 268 int DoOverwriteCachedResponse(); | 276 int DoOverwriteCachedResponse(); |
| 277 int DoCacheWriteResponse(); |
| 278 int DoCacheWriteTruncatedResponse(); |
| 279 int DoCacheWriteResponseComplete(int result); |
| 269 int DoTruncateCachedData(); | 280 int DoTruncateCachedData(); |
| 270 int DoTruncateCachedDataComplete(int result); | 281 int DoTruncateCachedDataComplete(int result); |
| 271 int DoTruncateCachedMetadata(); | 282 int DoTruncateCachedMetadata(); |
| 272 int DoTruncateCachedMetadataComplete(int result); | 283 int DoTruncateCachedMetadataComplete(int result); |
| 273 int DoPartialHeadersReceived(); | 284 int DoPartialHeadersReceived(); |
| 274 int DoCacheReadResponse(); | |
| 275 int DoCacheReadResponseComplete(int result); | |
| 276 int DoCacheDispatchValidation(); | |
| 277 int DoCacheToggleUnusedSincePrefetch(); | |
| 278 int DoCacheToggleUnusedSincePrefetchComplete(int result); | |
| 279 int DoCacheWriteResponse(); | |
| 280 int DoCacheWriteTruncatedResponse(); | |
| 281 int DoCacheWriteResponseComplete(int result); | |
| 282 int DoCacheReadMetadata(); | 285 int DoCacheReadMetadata(); |
| 283 int DoCacheReadMetadataComplete(int result); | 286 int DoCacheReadMetadataComplete(int result); |
| 284 int DoCacheQueryData(); | 287 int DoNetworkRead(); |
| 285 int DoCacheQueryDataComplete(int result); | 288 int DoNetworkReadComplete(int result); |
| 286 int DoCacheReadData(); | 289 int DoCacheReadData(); |
| 287 int DoCacheReadDataComplete(int result); | 290 int DoCacheReadDataComplete(int result); |
| 288 int DoCacheWriteData(int num_bytes); | 291 int DoCacheWriteData(int num_bytes); |
| 289 int DoCacheWriteDataComplete(int result); | 292 int DoCacheWriteDataComplete(int result); |
| 290 | 293 |
| 291 // These functions are involved in a field trial testing storing certificates | 294 // These functions are involved in a field trial testing storing certificates |
| 292 // in seperate entries from the HttpResponseInfo. | 295 // in seperate entries from the HttpResponseInfo. |
| 293 void ReadCertChain(); | 296 void ReadCertChain(); |
| 294 void WriteCertChain(); | 297 void WriteCertChain(); |
| 295 | 298 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; | 487 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; |
| 485 | 488 |
| 486 base::WeakPtrFactory<Transaction> weak_factory_; | 489 base::WeakPtrFactory<Transaction> weak_factory_; |
| 487 | 490 |
| 488 DISALLOW_COPY_AND_ASSIGN(Transaction); | 491 DISALLOW_COPY_AND_ASSIGN(Transaction); |
| 489 }; | 492 }; |
| 490 | 493 |
| 491 } // namespace net | 494 } // namespace net |
| 492 | 495 |
| 493 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 496 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| OLD | NEW |