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

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

Issue 455623003: stale-while-revalidate experimental implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 2 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
11 #include <string> 11 #include <string>
12 12
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "net/base/completion_callback.h" 14 #include "net/base/completion_callback.h"
15 #include "net/base/net_log.h" 15 #include "net/base/net_log.h"
16 #include "net/base/request_priority.h" 16 #include "net/base/request_priority.h"
17 #include "net/http/http_cache.h" 17 #include "net/http/http_cache.h"
18 #include "net/http/http_request_headers.h" 18 #include "net/http/http_request_headers.h"
19 #include "net/http/http_response_headers.h"
19 #include "net/http/http_response_info.h" 20 #include "net/http/http_response_info.h"
20 #include "net/http/http_transaction.h" 21 #include "net/http/http_transaction.h"
21 22
22 namespace net { 23 namespace net {
23 24
24 class PartialData; 25 class PartialData;
25 struct HttpRequestInfo; 26 struct HttpRequestInfo;
26 struct LoadTimingInfo; 27 struct LoadTimingInfo;
27 28
28 // This is the transaction that is returned by the HttpCache transaction 29 // This is the transaction that is returned by the HttpCache transaction
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 int RestartNetworkRequest(); 305 int RestartNetworkRequest();
305 306
306 // Called to restart a network transaction with a client certificate. 307 // Called to restart a network transaction with a client certificate.
307 // Returns network error code. 308 // Returns network error code.
308 int RestartNetworkRequestWithCertificate(X509Certificate* client_cert); 309 int RestartNetworkRequestWithCertificate(X509Certificate* client_cert);
309 310
310 // Called to restart a network transaction with authentication credentials. 311 // Called to restart a network transaction with authentication credentials.
311 // Returns network error code. 312 // Returns network error code.
312 int RestartNetworkRequestWithAuth(const AuthCredentials& credentials); 313 int RestartNetworkRequestWithAuth(const AuthCredentials& credentials);
313 314
314 // Called to determine if we need to validate the cache entry before using it. 315 // Called to determine if we need to validate the cache entry before using it,
315 bool RequiresValidation(); 316 // and whether the validation should be synchronous or asynchronous.
317 ValidationType RequiresValidation();
316 318
317 // Called to make the request conditional (to ask the server if the cached 319 // Called to make the request conditional (to ask the server if the cached
318 // copy is valid). Returns true if able to make the request conditional. 320 // copy is valid). Returns true if able to make the request conditional.
319 bool ConditionalizeRequest(); 321 bool ConditionalizeRequest();
320 322
321 // Makes sure that a 206 response is expected. Returns true on success. 323 // Makes sure that a 206 response is expected. Returns true on success.
322 // On success, handling_206_ will be set to true if we are processing a 324 // On success, handling_206_ will be set to true if we are processing a
323 // partial entry. 325 // partial entry.
324 bool ValidatePartialResponse(); 326 bool ValidatePartialResponse();
325 327
326 // Handles a response validation error by bypassing the cache. 328 // Handles a response validation error by bypassing the cache.
327 void IgnoreRangeRequest(); 329 void IgnoreRangeRequest();
328 330
329 // Removes content-length and byte range related info if needed. 331 // Removes content-length and byte range related info if needed.
330 void FixHeadersForHead(); 332 void FixHeadersForHead();
331 333
334 // Launches an asynchronous revalidation based on this transaction.
335 void TriggerAsyncValidation();
336
332 // Changes the response code of a range request to be 416 (Requested range not 337 // Changes the response code of a range request to be 416 (Requested range not
333 // satisfiable). 338 // satisfiable).
334 void FailRangeRequest(); 339 void FailRangeRequest();
335 340
336 // Setups the transaction for reading from the cache entry. 341 // Setups the transaction for reading from the cache entry.
337 int SetupEntryForRead(); 342 int SetupEntryForRead();
338 343
339 // Reads data from the network. 344 // Reads data from the network.
340 int ReadFromNetwork(IOBuffer* data, int data_len); 345 int ReadFromNetwork(IOBuffer* data, int data_len);
341 346
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_; 469 BeforeProxyHeadersSentCallback before_proxy_headers_sent_callback_;
465 470
466 base::WeakPtrFactory<Transaction> weak_factory_; 471 base::WeakPtrFactory<Transaction> weak_factory_;
467 472
468 DISALLOW_COPY_AND_ASSIGN(Transaction); 473 DISALLOW_COPY_AND_ASSIGN(Transaction);
469 }; 474 };
470 475
471 } // namespace net 476 } // namespace net
472 477
473 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ 478 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698