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

Unified Diff: net/http/disk_cache_based_ssl_host_info.cc

Issue 7715007: Do not call callback->Run() until we are about to return from this (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add ssl_host_info.h to the CL. Created 9 years, 4 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
« no previous file with comments | « net/http/disk_cache_based_ssl_host_info.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/disk_cache_based_ssl_host_info.cc
===================================================================
--- net/http/disk_cache_based_ssl_host_info.cc (revision 97879)
+++ net/http/disk_cache_based_ssl_host_info.cc (working copy)
@@ -41,7 +41,7 @@
: SSLHostInfo(hostname, ssl_config, cert_verifier),
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
callback_(new CallbackImpl(weak_ptr_factory_.GetWeakPtr(),
- &DiskCacheBasedSSLHostInfo::DoLoop)),
+ &DiskCacheBasedSSLHostInfo::OnIOComplete)),
state_(GET_BACKEND),
ready_(false),
hostname_(hostname),
@@ -98,7 +98,17 @@
return "sslhostinfo:" + hostname_;
}
-void DiskCacheBasedSSLHostInfo::DoLoop(int rv) {
+void DiskCacheBasedSSLHostInfo::OnIOComplete(int rv) {
+ rv = DoLoop(rv);
+ if (rv != ERR_IO_PENDING) {
+ CompletionCallback* callback = user_callback_;
+ user_callback_ = NULL;
+ if (callback)
+ callback->Run(rv);
+ }
+}
+
+int DiskCacheBasedSSLHostInfo::DoLoop(int rv) {
do {
switch (state_) {
case GET_BACKEND:
@@ -142,6 +152,8 @@
NOTREACHED();
}
} while (rv != ERR_IO_PENDING && state_ != NONE);
+
+ return rv;
}
int DiskCacheBasedSSLHostInfo::DoGetBackendComplete(int rv) {
@@ -167,7 +179,7 @@
int DiskCacheBasedSSLHostInfo::DoReadComplete(int rv) {
if (rv > 0)
- data_ = std::string(read_buffer_->data(), rv);
+ data_.assign(read_buffer_->data(), rv);
state_ = WAIT_FOR_DATA_READY_DONE;
return OK;
@@ -227,23 +239,15 @@
}
int DiskCacheBasedSSLHostInfo::DoWaitForDataReadyDone() {
- CompletionCallback* callback;
-
DCHECK(!ready_);
state_ = NONE;
ready_ = true;
- callback = user_callback_;
- user_callback_ = NULL;
// We close the entry because, if we shutdown before ::Persist is called,
// then we might leak a cache reference, which causes a DCHECK on shutdown.
if (entry_)
entry_->Close();
entry_ = NULL;
Parse(data_);
-
- if (callback)
- callback->Run(OK);
-
return OK;
}
« no previous file with comments | « net/http/disk_cache_based_ssl_host_info.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698