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

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: omewhat better take at higher-level HC::T impl, a bit lessy hacky, and actually write to cache now. 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Returns the estimate of dynamically allocated memory in bytes. 175 // Returns the estimate of dynamically allocated memory in bytes.
176 size_t EstimateMemoryUsage() const; 176 size_t EstimateMemoryUsage() const;
177 177
178 // ### comment
179 bool MaybeRejectBasedOnMemoryEntryData(uint8_t in_memory_info);
180
178 private: 181 private:
179 static const size_t kNumValidationHeaders = 2; 182 static const size_t kNumValidationHeaders = 2;
180 // Helper struct to pair a header name with its value, for 183 // Helper struct to pair a header name with its value, for
181 // headers used to validate cache entries. 184 // headers used to validate cache entries.
182 struct ValidationHeaders { 185 struct ValidationHeaders {
183 ValidationHeaders() : initialized(false) {} 186 ValidationHeaders() : initialized(false) {}
184 187
185 std::string values[kNumValidationHeaders]; 188 std::string values[kNumValidationHeaders];
186 bool initialized; 189 bool initialized;
187 }; 190 };
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // Returns network error code. 363 // Returns network error code.
361 int RestartNetworkRequestWithAuth(const AuthCredentials& credentials); 364 int RestartNetworkRequestWithAuth(const AuthCredentials& credentials);
362 365
363 // Called to determine if we need to validate the cache entry before using it. 366 // Called to determine if we need to validate the cache entry before using it.
364 bool RequiresValidation(); 367 bool RequiresValidation();
365 368
366 // Called to make the request conditional (to ask the server if the cached 369 // Called to make the request conditional (to ask the server if the cached
367 // copy is valid). Returns true if able to make the request conditional. 370 // copy is valid). Returns true if able to make the request conditional.
368 bool ConditionalizeRequest(); 371 bool ConditionalizeRequest();
369 372
373 // Determines if saved response permits conditionalization, and extracts
374 // etag/last-modified values. Only depends on response_.headers.
375 bool ResponseConditionalizable(std::string* etag_value,
376 std::string* last_modified_value);
377
370 // Makes sure that a 206 response is expected. Returns true on success. 378 // Makes sure that a 206 response is expected. Returns true on success.
371 // On success, handling_206_ will be set to true if we are processing a 379 // On success, handling_206_ will be set to true if we are processing a
372 // partial entry. 380 // partial entry.
373 bool ValidatePartialResponse(); 381 bool ValidatePartialResponse();
374 382
375 // Handles a response validation error by bypassing the cache. 383 // Handles a response validation error by bypassing the cache.
376 void IgnoreRangeRequest(); 384 void IgnoreRangeRequest();
377 385
378 // Fixes the response headers to match expectations for a HEAD request. 386 // Fixes the response headers to match expectations for a HEAD request.
379 void FixHeadersForHead(); 387 void FixHeadersForHead();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 RestartInfo restart_info_; 557 RestartInfo restart_info_;
550 558
551 base::WeakPtrFactory<Transaction> weak_factory_; 559 base::WeakPtrFactory<Transaction> weak_factory_;
552 560
553 DISALLOW_COPY_AND_ASSIGN(Transaction); 561 DISALLOW_COPY_AND_ASSIGN(Transaction);
554 }; 562 };
555 563
556 } // namespace net 564 } // namespace net
557 565
558 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ 566 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698