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

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

Issue 2922973003: RFC: use some in-memory state in SimpleCache to quickly cache-miss some CantConditionalize cases
Patch Set: cleanup naming in SimpleCache impl of this some 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 void SetBeforeNetworkStartCallback( 160 void SetBeforeNetworkStartCallback(
161 const BeforeNetworkStartCallback& callback) override; 161 const BeforeNetworkStartCallback& callback) override;
162 void SetBeforeHeadersSentCallback( 162 void SetBeforeHeadersSentCallback(
163 const BeforeHeadersSentCallback& callback) override; 163 const BeforeHeadersSentCallback& callback) override;
164 int ResumeNetworkStart() override; 164 int ResumeNetworkStart() override;
165 void GetConnectionAttempts(ConnectionAttempts* out) const override; 165 void GetConnectionAttempts(ConnectionAttempts* out) const override;
166 166
167 // Returns the estimate of dynamically allocated memory in bytes. 167 // Returns the estimate of dynamically allocated memory in bytes.
168 size_t EstimateMemoryUsage() const; 168 size_t EstimateMemoryUsage() const;
169 169
170 // ### comment
171 bool CanRejectBasedOnMemoryEntryData(uint8_t in_memory_info);
172
170 private: 173 private:
171 static const size_t kNumValidationHeaders = 2; 174 static const size_t kNumValidationHeaders = 2;
172 // Helper struct to pair a header name with its value, for 175 // Helper struct to pair a header name with its value, for
173 // headers used to validate cache entries. 176 // headers used to validate cache entries.
174 struct ValidationHeaders { 177 struct ValidationHeaders {
175 ValidationHeaders() : initialized(false) {} 178 ValidationHeaders() : initialized(false) {}
176 179
177 std::string values[kNumValidationHeaders]; 180 std::string values[kNumValidationHeaders];
178 bool initialized; 181 bool initialized;
179 }; 182 };
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // Returns network error code. 341 // Returns network error code.
339 int RestartNetworkRequestWithAuth(const AuthCredentials& credentials); 342 int RestartNetworkRequestWithAuth(const AuthCredentials& credentials);
340 343
341 // Called to determine if we need to validate the cache entry before using it. 344 // Called to determine if we need to validate the cache entry before using it.
342 bool RequiresValidation(); 345 bool RequiresValidation();
343 346
344 // Called to make the request conditional (to ask the server if the cached 347 // Called to make the request conditional (to ask the server if the cached
345 // copy is valid). Returns true if able to make the request conditional. 348 // copy is valid). Returns true if able to make the request conditional.
346 bool ConditionalizeRequest(); 349 bool ConditionalizeRequest();
347 350
351 // Determines if saved response permits conditionalization, and extracts
352 // etag/last-modified values. Only depends on response_.headers.
353 bool ResponseConditionalizable(std::string* etag_value,
354 std::string* last_modified_value);
355
348 // Makes sure that a 206 response is expected. Returns true on success. 356 // Makes sure that a 206 response is expected. Returns true on success.
349 // On success, handling_206_ will be set to true if we are processing a 357 // On success, handling_206_ will be set to true if we are processing a
350 // partial entry. 358 // partial entry.
351 bool ValidatePartialResponse(); 359 bool ValidatePartialResponse();
352 360
353 // Handles a response validation error by bypassing the cache. 361 // Handles a response validation error by bypassing the cache.
354 void IgnoreRangeRequest(); 362 void IgnoreRangeRequest();
355 363
356 // Fixes the response headers to match expectations for a HEAD request. 364 // Fixes the response headers to match expectations for a HEAD request.
357 void FixHeadersForHead(); 365 void FixHeadersForHead();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 bool in_do_loop_; 523 bool in_do_loop_;
516 524
517 base::WeakPtrFactory<Transaction> weak_factory_; 525 base::WeakPtrFactory<Transaction> weak_factory_;
518 526
519 DISALLOW_COPY_AND_ASSIGN(Transaction); 527 DISALLOW_COPY_AND_ASSIGN(Transaction);
520 }; 528 };
521 529
522 } // namespace net 530 } // namespace net
523 531
524 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ 532 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698