Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Side by Side Diff: net/http/http_cache_transaction.h

Issue 2721933002: HttpCache::Transaction layer allowing parallel validation (Closed)
Patch Set: Feedback addressed, more tests and refactoring Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 STATE_OVERWRITE_CACHED_RESPONSE, 211 STATE_OVERWRITE_CACHED_RESPONSE,
212 STATE_CACHE_WRITE_RESPONSE, 212 STATE_CACHE_WRITE_RESPONSE,
213 STATE_CACHE_WRITE_RESPONSE_COMPLETE, 213 STATE_CACHE_WRITE_RESPONSE_COMPLETE,
214 STATE_TRUNCATE_CACHED_DATA, 214 STATE_TRUNCATE_CACHED_DATA,
215 STATE_TRUNCATE_CACHED_DATA_COMPLETE, 215 STATE_TRUNCATE_CACHED_DATA_COMPLETE,
216 STATE_TRUNCATE_CACHED_METADATA, 216 STATE_TRUNCATE_CACHED_METADATA,
217 STATE_TRUNCATE_CACHED_METADATA_COMPLETE, 217 STATE_TRUNCATE_CACHED_METADATA_COMPLETE,
218 STATE_PARTIAL_HEADERS_RECEIVED, 218 STATE_PARTIAL_HEADERS_RECEIVED,
219 STATE_CACHE_READ_METADATA, 219 STATE_CACHE_READ_METADATA,
220 STATE_CACHE_READ_METADATA_COMPLETE, 220 STATE_CACHE_READ_METADATA_COMPLETE,
221 STATE_WAIT_BEFORE_READ,
222 STATE_WAIT_BEFORE_READ_COMPLETE,
221 223
222 // These states are entered from Read/AddTruncatedFlag. 224 // These states are entered from Read/AddTruncatedFlag.
223 STATE_NETWORK_READ, 225 STATE_NETWORK_READ,
224 STATE_NETWORK_READ_COMPLETE, 226 STATE_NETWORK_READ_COMPLETE,
225 STATE_CACHE_READ_DATA, 227 STATE_CACHE_READ_DATA,
226 STATE_CACHE_READ_DATA_COMPLETE, 228 STATE_CACHE_READ_DATA_COMPLETE,
227 STATE_CACHE_WRITE_DATA, 229 STATE_CACHE_WRITE_DATA,
228 STATE_CACHE_WRITE_DATA_COMPLETE, 230 STATE_CACHE_WRITE_DATA_COMPLETE,
229 STATE_CACHE_WRITE_TRUNCATED_RESPONSE, 231 STATE_CACHE_WRITE_TRUNCATED_RESPONSE,
230 STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE 232 STATE_CACHE_WRITE_TRUNCATED_RESPONSE_COMPLETE
231 }; 233 };
232 234
233 // Used for categorizing validation triggers in histograms. 235 // Used for categorizing validation triggers in histograms.
234 // NOTE: This enumeration is used in histograms, so please do not add entries 236 // NOTE: This enumeration is used in histograms, so please do not add entries
235 // in the middle. 237 // in the middle.
236 enum ValidationCause { 238 enum ValidationCause {
237 VALIDATION_CAUSE_UNDEFINED, 239 VALIDATION_CAUSE_UNDEFINED,
238 VALIDATION_CAUSE_VARY_MISMATCH, 240 VALIDATION_CAUSE_VARY_MISMATCH,
239 VALIDATION_CAUSE_VALIDATE_FLAG, 241 VALIDATION_CAUSE_VALIDATE_FLAG,
240 VALIDATION_CAUSE_STALE, 242 VALIDATION_CAUSE_STALE,
241 VALIDATION_CAUSE_ZERO_FRESHNESS, 243 VALIDATION_CAUSE_ZERO_FRESHNESS,
242 VALIDATION_CAUSE_MAX 244 VALIDATION_CAUSE_MAX
243 }; 245 };
244 246
245 // Runs the state transition loop. Resets and calls |callback_| on exit, 247 // Runs the state transition loop. Resets and calls |callback_| on exit,
246 // unless the return value is ERR_IO_PENDING. 248 // unless the return value is ERR_IO_PENDING.
247 int DoLoop(int result); 249 int DoLoop(int result);
250 int DoLoopImpl(int result);
248 251
249 // Each of these methods corresponds to a State value. If there is an 252 // Each of these methods corresponds to a State value. If there is an
250 // argument, the value corresponds to the return of the previous state or 253 // argument, the value corresponds to the return of the previous state or
251 // corresponding callback. 254 // corresponding callback.
252 int DoGetBackend(); 255 int DoGetBackend();
253 int DoGetBackendComplete(int result); 256 int DoGetBackendComplete(int result);
254 int DoInitEntry(); 257 int DoInitEntry();
255 int DoOpenEntry(); 258 int DoOpenEntry();
256 int DoOpenEntryComplete(int result); 259 int DoOpenEntryComplete(int result);
257 int DoDoomEntry(); 260 int DoDoomEntry();
(...skipping 19 matching lines...) Expand all
277 int DoCacheWriteUpdatedResponseComplete(int result); 280 int DoCacheWriteUpdatedResponseComplete(int result);
278 int DoUpdateCachedResponseComplete(int result); 281 int DoUpdateCachedResponseComplete(int result);
279 int DoOverwriteCachedResponse(); 282 int DoOverwriteCachedResponse();
280 int DoCacheWriteResponse(); 283 int DoCacheWriteResponse();
281 int DoCacheWriteResponseComplete(int result); 284 int DoCacheWriteResponseComplete(int result);
282 int DoTruncateCachedData(); 285 int DoTruncateCachedData();
283 int DoTruncateCachedDataComplete(int result); 286 int DoTruncateCachedDataComplete(int result);
284 int DoTruncateCachedMetadata(); 287 int DoTruncateCachedMetadata();
285 int DoTruncateCachedMetadataComplete(int result); 288 int DoTruncateCachedMetadataComplete(int result);
286 int DoPartialHeadersReceived(); 289 int DoPartialHeadersReceived();
290 int DoWaitBeforeRead();
291 int DoWaitBeforeReadComplete(int result);
287 int DoCacheReadMetadata(); 292 int DoCacheReadMetadata();
288 int DoCacheReadMetadataComplete(int result); 293 int DoCacheReadMetadataComplete(int result);
289 int DoNetworkRead(); 294 int DoNetworkRead();
290 int DoNetworkReadComplete(int result); 295 int DoNetworkReadComplete(int result);
291 int DoCacheReadData(); 296 int DoCacheReadData();
292 int DoCacheReadDataComplete(int result); 297 int DoCacheReadDataComplete(int result);
293 int DoCacheWriteData(int num_bytes); 298 int DoCacheWriteData(int num_bytes);
294 int DoCacheWriteDataComplete(int result); 299 int DoCacheWriteDataComplete(int result);
295 int DoCacheWriteTruncatedResponse(); 300 int DoCacheWriteTruncatedResponse();
296 int DoCacheWriteTruncatedResponseComplete(int result); 301 int DoCacheWriteTruncatedResponseComplete(int result);
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 BeforeHeadersSentCallback before_headers_sent_callback_; 512 BeforeHeadersSentCallback before_headers_sent_callback_;
508 513
509 base::WeakPtrFactory<Transaction> weak_factory_; 514 base::WeakPtrFactory<Transaction> weak_factory_;
510 515
511 DISALLOW_COPY_AND_ASSIGN(Transaction); 516 DISALLOW_COPY_AND_ASSIGN(Transaction);
512 }; 517 };
513 518
514 } // namespace net 519 } // namespace net
515 520
516 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ 521 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698