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

Unified Diff: net/http/disk_cache_based_ssl_host_info.cc

Issue 8832006: Reverts a commit that caused ASAN failures, and 2 dependent commits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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.h » ('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
diff --git a/net/http/disk_cache_based_ssl_host_info.cc b/net/http/disk_cache_based_ssl_host_info.cc
index 985a2612cfe6a3a5ec5a243f2af3e17fa1a62854..003618e5e4ea4b7b1b16b4d8d674b4aa3b835468 100644
--- a/net/http/disk_cache_based_ssl_host_info.cc
+++ b/net/http/disk_cache_based_ssl_host_info.cc
@@ -40,8 +40,8 @@ DiskCacheBasedSSLHostInfo::DiskCacheBasedSSLHostInfo(
HttpCache* http_cache)
: SSLHostInfo(hostname, ssl_config, cert_verifier),
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
- callback_(base::Bind(&DiskCacheBasedSSLHostInfo::OnIOComplete,
- weak_ptr_factory_.GetWeakPtr())),
+ callback_(new CallbackImpl(weak_ptr_factory_.GetWeakPtr(),
+ &DiskCacheBasedSSLHostInfo::OnIOComplete)),
state_(GET_BACKEND),
ready_(false),
found_entry_(false),
@@ -93,6 +93,8 @@ DiskCacheBasedSSLHostInfo::~DiskCacheBasedSSLHostInfo() {
DCHECK(user_callback_.is_null());
if (entry_)
entry_->Close();
+ if (!IsCallbackPending())
+ delete callback_;
}
std::string DiskCacheBasedSSLHostInfo::key() const {
@@ -158,6 +160,7 @@ int DiskCacheBasedSSLHostInfo::DoLoop(int rv) {
int DiskCacheBasedSSLHostInfo::DoGetBackendComplete(int rv) {
if (rv == OK) {
+ backend_ = callback_->backend();
state_ = OPEN;
} else {
state_ = WAIT_FOR_DATA_READY_DONE;
@@ -167,6 +170,7 @@ int DiskCacheBasedSSLHostInfo::DoGetBackendComplete(int rv) {
int DiskCacheBasedSSLHostInfo::DoOpenComplete(int rv) {
if (rv == OK) {
+ entry_ = callback_->entry();
state_ = READ;
found_entry_ = true;
} else {
@@ -190,22 +194,23 @@ int DiskCacheBasedSSLHostInfo::DoWriteComplete(int rv) {
}
int DiskCacheBasedSSLHostInfo::DoCreateOrOpenComplete(int rv) {
- if (rv != OK)
+ if (rv != OK) {
state_ = SET_DONE;
- else
+ } else {
+ entry_ = callback_->entry();
state_ = WRITE;
-
+ }
return OK;
}
int DiskCacheBasedSSLHostInfo::DoGetBackend() {
state_ = GET_BACKEND_COMPLETE;
- return http_cache_->GetBackend(&backend_, callback_);
+ return http_cache_->GetBackend(callback_->backend_pointer(), callback_);
}
int DiskCacheBasedSSLHostInfo::DoOpen() {
state_ = OPEN_COMPLETE;
- return backend_->OpenEntry(key(), &entry_, callback_);
+ return backend_->OpenEntry(key(), callback_->entry_pointer(), callback_);
}
int DiskCacheBasedSSLHostInfo::DoRead() {
@@ -227,17 +232,16 @@ int DiskCacheBasedSSLHostInfo::DoWrite() {
state_ = WRITE_COMPLETE;
return entry_->WriteData(0 /* index */, 0 /* offset */, write_buffer_,
- new_data_.size(), callback_,
- true /* truncate */);
+ new_data_.size(), callback_, true /* truncate */);
}
int DiskCacheBasedSSLHostInfo::DoCreateOrOpen() {
DCHECK(entry_ == NULL);
state_ = CREATE_OR_OPEN_COMPLETE;
if (found_entry_)
- return backend_->OpenEntry(key(), &entry_, callback_);
+ return backend_->OpenEntry(key(), callback_->entry_pointer(), callback_);
- return backend_->CreateEntry(key(), &entry_, callback_);
+ return backend_->CreateEntry(key(), callback_->entry_pointer(), callback_);
}
int DiskCacheBasedSSLHostInfo::DoWaitForDataReadyDone() {
« no previous file with comments | « net/http/disk_cache_based_ssl_host_info.h ('k') | net/http/http_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698