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

Unified Diff: net/http/disk_cache_based_quic_server_info.h

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « net/dns/host_resolver_impl.cc ('k') | net/http/disk_cache_based_quic_server_info.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/disk_cache_based_quic_server_info.h
diff --git a/net/http/disk_cache_based_quic_server_info.h b/net/http/disk_cache_based_quic_server_info.h
index 97fe95e10c79b08da35b84b9fcf8da9c6f75612f..e95d5355c97d27bc8f1bf35eeec31e562f623170 100644
--- a/net/http/disk_cache_based_quic_server_info.h
+++ b/net/http/disk_cache_based_quic_server_info.h
@@ -38,9 +38,11 @@ class NET_EXPORT_PRIVATE DiskCacheBasedQuicServerInfo
bool IsDataReady() override;
bool IsReadyToPersist() override;
void Persist() override;
+ void OnExternalCacheHit() override;
private:
struct CacheOperationDataShim;
+
enum State {
GET_BACKEND,
GET_BACKEND_COMPLETE,
@@ -57,8 +59,42 @@ class NET_EXPORT_PRIVATE DiskCacheBasedQuicServerInfo
NONE,
};
+ // Enum to track number of times data read/parse/write API calls of
+ // QuicServerInfo to and from disk cache is called.
+ enum QuicServerInfoAPICall {
+ QUIC_SERVER_INFO_START = 0,
+ QUIC_SERVER_INFO_WAIT_FOR_DATA_READY = 1,
+ QUIC_SERVER_INFO_PARSE = 2,
+ QUIC_SERVER_INFO_WAIT_FOR_DATA_READY_CANCEL = 3,
+ QUIC_SERVER_INFO_READY_TO_PERSIST = 4,
+ QUIC_SERVER_INFO_PERSIST = 5,
+ QUIC_SERVER_INFO_EXTERNAL_CACHE_HIT = 6,
+ QUIC_SERVER_INFO_NUM_OF_API_CALLS = 7,
+ };
+
+ // Enum to track failure reasons to read/load/write of QuicServerInfo to
+ // and from disk cache.
+ enum FailureReason {
+ WAIT_FOR_DATA_READY_INVALID_ARGUMENT_FAILURE = 0,
+ GET_BACKEND_FAILURE = 1,
+ OPEN_FAILURE = 2,
+ CREATE_OR_OPEN_FAILURE = 3,
+ PARSE_NO_DATA_FAILURE = 4,
+ PARSE_FAILURE = 5,
+ READ_FAILURE = 6,
+ READY_TO_PERSIST_FAILURE = 7,
+ PERSIST_NO_BACKEND_FAILURE = 8,
+ WRITE_FAILURE = 9,
+ NO_FAILURE = 10,
+ NUM_OF_FAILURES = 11,
+ };
+
~DiskCacheBasedQuicServerInfo() override;
+ // Persists |pending_write_data_| if it is not empty, otherwise serializes the
+ // data and pesists it.
+ void PersistInternal();
+
std::string key() const;
// The |unused| parameter is a small hack so that we can have the
@@ -86,23 +122,39 @@ class NET_EXPORT_PRIVATE DiskCacheBasedQuicServerInfo
// DoSetDone is the terminal state of the write operation.
int DoSetDone();
+ // Tracks in a histogram the number of times data read/parse/write API calls
+ // of QuicServerInfo to and from disk cache is called.
+ void RecordQuicServerInfoStatus(QuicServerInfoAPICall call);
+
+ // Tracks in a histogram the failure reasons to read/load/write of
+ // QuicServerInfo to and from disk cache. It also saves the |failure| in
+ // |last_failure_|.
+ void RecordQuicServerInfoFailure(FailureReason failure);
+
+ // Tracks in a histogram if |last_failure_| is not NO_FAILURE.
+ void RecordLastFailure();
+
CacheOperationDataShim* data_shim_; // Owned by |io_callback_|.
CompletionCallback io_callback_;
State state_;
bool ready_;
bool found_entry_; // Controls the behavior of DoCreateOrOpen.
std::string new_data_;
+ std::string pending_write_data_;
const QuicServerId server_id_;
HttpCache* const http_cache_;
disk_cache::Backend* backend_;
disk_cache::Entry* entry_;
- CompletionCallback user_callback_;
+ CompletionCallback wait_for_ready_callback_;
scoped_refptr<IOBuffer> read_buffer_;
scoped_refptr<IOBuffer> write_buffer_;
std::string data_;
base::TimeTicks load_start_time_;
+ FailureReason last_failure_;
base::WeakPtrFactory<DiskCacheBasedQuicServerInfo> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(DiskCacheBasedQuicServerInfo);
};
} // namespace net
« no previous file with comments | « net/dns/host_resolver_impl.cc ('k') | net/http/disk_cache_based_quic_server_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698