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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 122453002: Allows deferral of a URLRequest just before talking to the network, at (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatting nits Created 6 years, 11 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/url_request/url_request_http_job.cc
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index c0e2dd1e14027ee06e4bdfaaf332b414a0283534..9f6312e768228eb5790f33c85f722b8638394b70 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -190,7 +190,8 @@ URLRequestHttpJob::URLRequestHttpJob(
base::Bind(&URLRequestHttpJob::OnHeadersReceivedCallback,
base::Unretained(this))),
awaiting_callback_(false),
- http_user_agent_settings_(http_user_agent_settings) {
+ http_user_agent_settings_(http_user_agent_settings),
+ request_(request) {
URLRequestThrottlerManager* manager = request->context()->throttler_manager();
if (manager)
throttling_entry_ = manager->RegisterRequestUrl(request->url());
@@ -414,6 +415,9 @@ void URLRequestHttpJob::StartTransactionInternal() {
rv = request_->context()->http_transaction_factory()->CreateTransaction(
priority_, &transaction_);
+ transaction_->SetBeforeNetworkStartCallback(
+ base::Bind(&URLRequestHttpJob::NotifyBeforeNetworkStart, this));
+
if (rv == OK && request_info_.url.SchemeIsWSOrWSS()) {
// TODO(ricea): Implement WebSocket throttling semantics as defined in
// RFC6455 Section 4.1.
@@ -1167,6 +1171,11 @@ void URLRequestHttpJob::ContinueDespiteLastError() {
weak_factory_.GetWeakPtr(), rv));
}
+void URLRequestHttpJob::ResumeNetworkStart() {
+ DCHECK(transaction_.get());
+ transaction_->ResumeNetworkStart();
+}
+
bool URLRequestHttpJob::ShouldFixMismatchedContentLength(int rv) const {
// Some servers send the body compressed, but specify the content length as
// the uncompressed size. Although this violates the HTTP spec we want to

Powered by Google App Engine
This is Rietveld 408576698