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

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

Issue 2774603003: Doom and create new entry when validation is not a match (Closed)
Patch Set: Rebased with parent branch Created 3 years, 6 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 const BeforeNetworkStartCallback& callback) override; 165 const BeforeNetworkStartCallback& callback) override;
166 void SetBeforeHeadersSentCallback( 166 void SetBeforeHeadersSentCallback(
167 const BeforeHeadersSentCallback& callback) override; 167 const BeforeHeadersSentCallback& callback) override;
168 int ResumeNetworkStart() override; 168 int ResumeNetworkStart() override;
169 void GetConnectionAttempts(ConnectionAttempts* out) const override; 169 void GetConnectionAttempts(ConnectionAttempts* out) const override;
170 170
171 // Invoked when parallel validation cannot proceed due to response failure 171 // Invoked when parallel validation cannot proceed due to response failure
172 // and this transaction needs to be restarted. 172 // and this transaction needs to be restarted.
173 void SetValidatingCannotProceed(); 173 void SetValidatingCannotProceed();
174 174
175 // Invoked to removes the association between a transaction waiting to be
176 // added to an entry and the entry.
177 void ResetCachePendingState() { cache_pending_ = false; }
178
175 // Returns the estimate of dynamically allocated memory in bytes. 179 // Returns the estimate of dynamically allocated memory in bytes.
176 size_t EstimateMemoryUsage() const; 180 size_t EstimateMemoryUsage() const;
177 181
178 private: 182 private:
179 static const size_t kNumValidationHeaders = 2; 183 static const size_t kNumValidationHeaders = 2;
180 // Helper struct to pair a header name with its value, for 184 // Helper struct to pair a header name with its value, for
181 // headers used to validate cache entries. 185 // headers used to validate cache entries.
182 struct ValidationHeaders { 186 struct ValidationHeaders {
183 ValidationHeaders() : initialized(false) {} 187 ValidationHeaders() : initialized(false) {}
184 188
(...skipping 18 matching lines...) Expand all
203 STATE_GET_BACKEND_COMPLETE, 207 STATE_GET_BACKEND_COMPLETE,
204 STATE_INIT_ENTRY, 208 STATE_INIT_ENTRY,
205 STATE_OPEN_ENTRY, 209 STATE_OPEN_ENTRY,
206 STATE_OPEN_ENTRY_COMPLETE, 210 STATE_OPEN_ENTRY_COMPLETE,
207 STATE_DOOM_ENTRY, 211 STATE_DOOM_ENTRY,
208 STATE_DOOM_ENTRY_COMPLETE, 212 STATE_DOOM_ENTRY_COMPLETE,
209 STATE_CREATE_ENTRY, 213 STATE_CREATE_ENTRY,
210 STATE_CREATE_ENTRY_COMPLETE, 214 STATE_CREATE_ENTRY_COMPLETE,
211 STATE_ADD_TO_ENTRY, 215 STATE_ADD_TO_ENTRY,
212 STATE_ADD_TO_ENTRY_COMPLETE, 216 STATE_ADD_TO_ENTRY_COMPLETE,
217 STATE_DONE_HEADERS_ADD_TO_ENTRY_COMPLETE,
213 STATE_CACHE_READ_RESPONSE, 218 STATE_CACHE_READ_RESPONSE,
214 STATE_CACHE_READ_RESPONSE_COMPLETE, 219 STATE_CACHE_READ_RESPONSE_COMPLETE,
215 STATE_TOGGLE_UNUSED_SINCE_PREFETCH, 220 STATE_TOGGLE_UNUSED_SINCE_PREFETCH,
216 STATE_TOGGLE_UNUSED_SINCE_PREFETCH_COMPLETE, 221 STATE_TOGGLE_UNUSED_SINCE_PREFETCH_COMPLETE,
217 STATE_CACHE_DISPATCH_VALIDATION, 222 STATE_CACHE_DISPATCH_VALIDATION,
218 STATE_CACHE_QUERY_DATA, 223 STATE_CACHE_QUERY_DATA,
219 STATE_CACHE_QUERY_DATA_COMPLETE, 224 STATE_CACHE_QUERY_DATA_COMPLETE,
220 STATE_START_PARTIAL_CACHE_VALIDATION, 225 STATE_START_PARTIAL_CACHE_VALIDATION,
221 STATE_COMPLETE_PARTIAL_CACHE_VALIDATION, 226 STATE_COMPLETE_PARTIAL_CACHE_VALIDATION,
222 STATE_SEND_REQUEST, 227 STATE_SEND_REQUEST,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 int DoGetBackendComplete(int result); 279 int DoGetBackendComplete(int result);
275 int DoInitEntry(); 280 int DoInitEntry();
276 int DoOpenEntry(); 281 int DoOpenEntry();
277 int DoOpenEntryComplete(int result); 282 int DoOpenEntryComplete(int result);
278 int DoDoomEntry(); 283 int DoDoomEntry();
279 int DoDoomEntryComplete(int result); 284 int DoDoomEntryComplete(int result);
280 int DoCreateEntry(); 285 int DoCreateEntry();
281 int DoCreateEntryComplete(int result); 286 int DoCreateEntryComplete(int result);
282 int DoAddToEntry(); 287 int DoAddToEntry();
283 int DoAddToEntryComplete(int result); 288 int DoAddToEntryComplete(int result);
289 int DoDoneHeadersAddToEntryComplete(int result);
284 int DoCacheReadResponse(); 290 int DoCacheReadResponse();
285 int DoCacheReadResponseComplete(int result); 291 int DoCacheReadResponseComplete(int result);
286 int DoCacheToggleUnusedSincePrefetch(); 292 int DoCacheToggleUnusedSincePrefetch();
287 int DoCacheToggleUnusedSincePrefetchComplete(int result); 293 int DoCacheToggleUnusedSincePrefetchComplete(int result);
288 int DoCacheDispatchValidation(); 294 int DoCacheDispatchValidation();
289 int DoCacheQueryData(); 295 int DoCacheQueryData();
290 int DoCacheQueryDataComplete(int result); 296 int DoCacheQueryDataComplete(int result);
291 int DoStartPartialCacheValidation(); 297 int DoStartPartialCacheValidation();
292 int DoCompletePartialCacheValidation(int result); 298 int DoCompletePartialCacheValidation(int result);
293 int DoSendRequest(); 299 int DoSendRequest();
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 std::string cache_key_; 491 std::string cache_key_;
486 Mode mode_; 492 Mode mode_;
487 bool reading_; // We are already reading. Never reverts to false once set. 493 bool reading_; // We are already reading. Never reverts to false once set.
488 bool invalid_range_; // We may bypass the cache for this request. 494 bool invalid_range_; // We may bypass the cache for this request.
489 bool truncated_; // We don't have all the response data. 495 bool truncated_; // We don't have all the response data.
490 bool is_sparse_; // The data is stored in sparse byte ranges. 496 bool is_sparse_; // The data is stored in sparse byte ranges.
491 bool range_requested_; // The user requested a byte range. 497 bool range_requested_; // The user requested a byte range.
492 bool handling_206_; // We must deal with this 206 response. 498 bool handling_206_; // We must deal with this 206 response.
493 bool cache_pending_; // We are waiting for the HttpCache. 499 bool cache_pending_; // We are waiting for the HttpCache.
494 bool done_reading_; // All available data was read. 500 bool done_reading_; // All available data was read.
501 // Headers have been received from the network and it's not a match with the
jkarlin 2017/06/09 17:04:50 newline above this comment
shivanisha 2017/06/12 18:01:23 done
502 // existing entry.
503 bool done_headers_create_new_entry_;
jkarlin 2017/06/09 17:04:49 newline below the member
shivanisha 2017/06/12 18:01:23 done
495 bool vary_mismatch_; // The request doesn't match the stored vary data. 504 bool vary_mismatch_; // The request doesn't match the stored vary data.
496 bool couldnt_conditionalize_request_; 505 bool couldnt_conditionalize_request_;
497 bool bypass_lock_for_test_; // A test is exercising the cache lock. 506 bool bypass_lock_for_test_; // A test is exercising the cache lock.
498 bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest. 507 bool fail_conditionalization_for_test_; // Fail ConditionalizeRequest.
499 scoped_refptr<IOBuffer> read_buf_; 508 scoped_refptr<IOBuffer> read_buf_;
500 int io_buf_len_; 509 int io_buf_len_;
501 int read_offset_; 510 int read_offset_;
502 int effective_load_flags_; 511 int effective_load_flags_;
503 int write_len_; 512 int write_len_;
504 std::unique_ptr<PartialData> partial_; // We are dealing with range requests. 513 std::unique_ptr<PartialData> partial_; // We are dealing with range requests.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 RestartInfo restart_info_; 558 RestartInfo restart_info_;
550 559
551 base::WeakPtrFactory<Transaction> weak_factory_; 560 base::WeakPtrFactory<Transaction> weak_factory_;
552 561
553 DISALLOW_COPY_AND_ASSIGN(Transaction); 562 DISALLOW_COPY_AND_ASSIGN(Transaction);
554 }; 563 };
555 564
556 } // namespace net 565 } // namespace net
557 566
558 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ 567 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698