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

Unified Diff: components/cronet/android/url_request_adapter.cc

Issue 617393005: Make URLRequestContextAdapter initialization asynchronous (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed mStarted Created 6 years, 2 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: components/cronet/android/url_request_adapter.cc
diff --git a/components/cronet/android/url_request_adapter.cc b/components/cronet/android/url_request_adapter.cc
index 9d9e29b2ce3258ab2a86ee8e506eb99426c7731c..ff98f9098689d115e20165e01ab3c4ce695a616f 100644
--- a/components/cronet/android/url_request_adapter.cc
+++ b/components/cronet/android/url_request_adapter.cc
@@ -76,13 +76,11 @@ void URLRequestAdapter::AppendChunk(const char* bytes, int bytes_len,
VLOG(1) << "AppendChunk, len: " << bytes_len << ", last: " << is_last_chunk;
scoped_ptr<char[]> buf(new char[bytes_len]);
memcpy(buf.get(), bytes, bytes_len);
- context_->GetNetworkTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(&URLRequestAdapter::OnAppendChunk,
- base::Unretained(this),
- Passed(buf.Pass()),
- bytes_len,
- is_last_chunk));
+ context_->RunTask(base::Bind(&URLRequestAdapter::OnAppendChunk,
+ base::Unretained(this),
+ Passed(buf.Pass()),
+ bytes_len,
+ is_last_chunk));
}
std::string URLRequestAdapter::GetHeader(const std::string& name) const {
@@ -107,10 +105,8 @@ std::string URLRequestAdapter::GetNegotiatedProtocol() const {
}
void URLRequestAdapter::Start() {
- context_->GetNetworkTaskRunner()->PostTask(
- FROM_HERE,
- base::Bind(&URLRequestAdapter::OnInitiateConnection,
- base::Unretained(this)));
+ context_->RunTask(base::Bind(&URLRequestAdapter::OnInitiateConnection,
+ base::Unretained(this)));
}
void URLRequestAdapter::OnAppendChunk(const scoped_ptr<char[]> bytes,
@@ -158,8 +154,7 @@ void URLRequestAdapter::Cancel() {
canceled_ = true;
- context_->GetNetworkTaskRunner()->PostTask(
- FROM_HERE,
+ context_->RunTask(
base::Bind(&URLRequestAdapter::OnCancelRequest, base::Unretained(this)));
}

Powered by Google App Engine
This is Rietveld 408576698