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

Unified Diff: net/http/http_cache_transaction.h

Issue 2721933002: HttpCache::Transaction layer allowing parallel validation (Closed)
Patch Set: DoneReadingFromEntry replaced with DoneWithEntry Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_cache_transaction.h
diff --git a/net/http/http_cache_transaction.h b/net/http/http_cache_transaction.h
index 51c0db70256cbd31505ca20ffba6486ab4c36aad..6061f0c82e0ec9af4937b9134866bb6ea1f16ecb 100644
--- a/net/http/http_cache_transaction.h
+++ b/net/http/http_cache_transaction.h
@@ -80,6 +80,8 @@ class HttpCache::Transaction : public HttpTransaction {
Mode mode() const { return mode_; }
+ std::string& method() { return method_; }
+
const std::string& key() const { return cache_key_; }
// Writes |buf_len| bytes of meta-data from the provided buffer |buf|. to the
@@ -164,6 +166,10 @@ class HttpCache::Transaction : public HttpTransaction {
int ResumeNetworkStart() override;
void GetConnectionAttempts(ConnectionAttempts* out) const override;
+ // Invoked when parallel validation cannot proceed due to response failure
+ // and this transaction needs to be restarted.
+ void SetValidatingCannotProceed();
+
// Returns the estimate of dynamically allocated memory in bytes.
size_t EstimateMemoryUsage() const;
@@ -178,6 +184,13 @@ class HttpCache::Transaction : public HttpTransaction {
bool initialized;
};
+ // Used when restarting the transaction.
jkarlin 2017/05/30 14:42:38 The comment could be more clear about where this d
shivanisha 2017/05/31 17:32:12 Done
+ struct RestartInfo {
+ Mode mode = NONE;
+ HttpResponseInfo::CacheEntryStatus cache_entry_status =
+ HttpResponseInfo::CacheEntryStatus::ENTRY_UNDEFINED;
+ };
+
enum State {
STATE_UNSET,
@@ -220,6 +233,9 @@ class HttpCache::Transaction : public HttpTransaction {
STATE_PARTIAL_HEADERS_RECEIVED,
STATE_CACHE_READ_METADATA,
STATE_CACHE_READ_METADATA_COMPLETE,
+ STATE_HEADERS_PHASE_CANNOT_PROCEED,
+ STATE_FINISH_HEADERS,
+ STATE_FINISH_HEADERS_COMPLETE,
// These states are entered from Read/AddTruncatedFlag.
STATE_NETWORK_READ,
@@ -288,6 +304,9 @@ class HttpCache::Transaction : public HttpTransaction {
int DoPartialHeadersReceived();
int DoCacheReadMetadata();
int DoCacheReadMetadataComplete(int result);
+ int DoHeadersPhaseCannotProceed();
+ int DoFinishHeaders(int result);
+ int DoFinishHeadersComplete(int result);
int DoNetworkRead();
int DoNetworkReadComplete(int result);
int DoCacheReadData();
@@ -430,7 +449,12 @@ class HttpCache::Transaction : public HttpTransaction {
void SyncCacheEntryStatusToResponse();
void RecordHistograms();
- // Called to signal completion of asynchronous IO.
+ // Called to signal completion of asynchronous IO. Note that this callback is
+ // used in the conventional sense where one layer calls the callback of the
+ // layer above it e.g. this callback gets called from the network transaction
+ // layer. In addition, it is also used for HttpCache layer to let this
+ // transaction know when it is out of a queued state in ActiveEntry and can
+ // continue its processing.
void OnIOComplete(int result);
// When in a DoLoop, use this to set the next state as it verifies that the
@@ -439,6 +463,7 @@ class HttpCache::Transaction : public HttpTransaction {
State next_state_;
const HttpRequestInfo* request_;
+ std::string method_;
RequestPriority priority_;
NetLogWithSource net_log_;
std::unique_ptr<HttpRequestInfo> custom_request_;
@@ -514,6 +539,8 @@ class HttpCache::Transaction : public HttpTransaction {
// True if the Transaction is currently processing the DoLoop.
bool in_do_loop_;
+ RestartInfo restart_info_;
jkarlin 2017/05/30 14:42:38 Please add a comment to this.
shivanisha 2017/05/31 17:32:12 done
+
base::WeakPtrFactory<Transaction> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(Transaction);

Powered by Google App Engine
This is Rietveld 408576698