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

Unified Diff: net/http/disk_cache_based_quic_server_info.cc

Issue 154933003: Persist server's crypto config data to disk cache for 0-RTT (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments in patch set 7 Created 6 years, 10 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/disk_cache_based_quic_server_info.cc
diff --git a/net/http/disk_cache_based_quic_server_info.cc b/net/http/disk_cache_based_quic_server_info.cc
index aa322ab3f08079a351377e9fe4c948a6a0c025bd..91625bc973cec0eee0174c9348fd858d127212f2 100644
--- a/net/http/disk_cache_based_quic_server_info.cc
+++ b/net/http/disk_cache_based_quic_server_info.cc
@@ -70,22 +70,29 @@ void DiskCacheBasedQuicServerInfo::Start() {
int DiskCacheBasedQuicServerInfo::WaitForDataReady(
const CompletionCallback& callback) {
DCHECK(CalledOnValidThread());
- DCHECK(state_ != GET_BACKEND);
+ DCHECK_NE(GET_BACKEND, state_);
if (ready_)
return OK;
if (!callback.is_null()) {
- DCHECK(user_callback_.is_null());
+ // Prevent a new callback for WaitForDataReady overwriting an existing
+ // pending callback (|user_callback_|).
+ if (!user_callback_.is_null())
+ return ERR_INVALID_ARGUMENT;
user_callback_ = callback;
}
return ERR_IO_PENDING;
}
+bool DiskCacheBasedQuicServerInfo::IsDataReady() {
+ return ready_;
+}
+
void DiskCacheBasedQuicServerInfo::Persist() {
DCHECK(CalledOnValidThread());
- DCHECK(state_ != GET_BACKEND);
+ DCHECK_NE(GET_BACKEND, state_);
DCHECK(new_data_.empty());
CHECK(ready_);
@@ -111,6 +118,7 @@ std::string DiskCacheBasedQuicServerInfo::key() const {
void DiskCacheBasedQuicServerInfo::OnIOComplete(CacheOperationDataShim* unused,
int rv) {
+ DCHECK_NE(NONE, state_);
rv = DoLoop(rv);
if (rv != ERR_IO_PENDING && !user_callback_.is_null()) {
CompletionCallback callback = user_callback_;
@@ -272,6 +280,7 @@ int DiskCacheBasedQuicServerInfo::DoSetDone() {
if (entry_)
entry_->Close();
entry_ = NULL;
+ new_data_.clear();
state_ = NONE;
return OK;
}

Powered by Google App Engine
This is Rietveld 408576698