Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home for chromium.org
« Groups Home
r167600 - in trunk/src/net: base url_request
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mme...@chromium.org  
View profile  
 More options Nov 14 2012, 12:04 am
From: mme...@chromium.org
Date: Tue, 13 Nov 2012 21:04:30 -0800 (PST)
Local: Wed, Nov 14 2012 12:04 am
Subject: r167600 - in trunk/src/net: base url_request
Author: mme...@chromium.org
Date: Tue Nov 13 21:04:30 2012
New Revision: 167600

Log:
Set blocked_on_delegate_ when a URLRequest is blocked by
its NetworkDelegate during a redirect.

R=ero...@chromium.org
BUG=159197

Review URL: https://chromiumcodereview.appspot.com/11364057

Modified:
   trunk/src/net/base/net_log_event_type_list.h
   trunk/src/net/url_request/url_request.cc
   trunk/src/net/url_request/url_request_http_job.cc
   trunk/src/net/url_request/url_request_job.cc
   trunk/src/net/url_request/url_request_job.h

Modified: trunk/src/net/base/net_log_event_type_list.h
=========================================================================== ===
--- trunk/src/net/base/net_log_event_type_list.h        (original)
+++ trunk/src/net/base/net_log_event_type_list.h        Tue Nov 13 21:04:30 2012
@@ -717,8 +717,13 @@
 //   }
 EVENT_TYPE(URL_REQUEST_REDIRECTED)

-// Measures the time a net::URLRequest is blocked waiting for a delegate
-// (usually an extension) to respond to the onBeforeRequest extension event.
+// Measures the time a net::URLRequest is blocked waiting for either the
+// NetworkDelegate or a URLRequest::Delegate to respond.
+//
+// The parameters attached to the event are:
+//   {
+//     "delegate": <What's blocking the request, if known>,
+//   }
 EVENT_TYPE(URL_REQUEST_BLOCKED_ON_DELEGATE)

 // The specified number of bytes were read from the net::URLRequest.

Modified: trunk/src/net/url_request/url_request.cc
=========================================================================== ===
--- trunk/src/net/url_request/url_request.cc    (original)
+++ trunk/src/net/url_request/url_request.cc    Tue Nov 13 21:04:30 2012
@@ -326,7 +326,8 @@
 }

 LoadStateWithParam URLRequest::GetLoadState() const {
-  if (blocked_on_delegate_) {
+  // Only return LOAD_STATE_WAITING_FOR_DELEGATE if there's a load state param.
+  if (blocked_on_delegate_ && !load_state_param_.empty()) {
     return LoadStateWithParam(LOAD_STATE_WAITING_FOR_DELEGATE,
                               load_state_param_);
   }
@@ -651,6 +652,7 @@
     RestartWithJob(job);
   } else if (delegate_) {
     delegate_->OnReceivedRedirect(this, location, defer_redirect);
+    // |this| may be have been destroyed here.
   }
 }

@@ -964,7 +966,12 @@

 void URLRequest::SetBlockedOnDelegate() {
   blocked_on_delegate_ = true;
-  net_log_.BeginEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE);
+  if (!load_state_param_.empty()) {
+    net_log_.BeginEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE,
+                        NetLog::StringCallback("delegate", &load_state_param_));
+  } else {
+    net_log_.BeginEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE);
+  }
 }

 void URLRequest::SetUnblockedOnDelegate() {

Modified: trunk/src/net/url_request/url_request_http_job.cc
=========================================================================== ===
--- trunk/src/net/url_request/url_request_http_job.cc   (original)
+++ trunk/src/net/url_request/url_request_http_job.cc   Tue Nov 13 21:04:30 2012
@@ -813,8 +813,7 @@
       if (error != net::OK) {
         if (error == net::ERR_IO_PENDING) {
           awaiting_callback_ = true;
-          request_->net_log().BeginEvent(
-              NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE);
+          SetBlockedOnDelegate();
         } else {
           std::string source("delegate");
           request_->net_log().AddEvent(NetLog::TYPE_CANCELLED,
@@ -849,7 +848,7 @@
 }

 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) {
-  request_->net_log().EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE);
+  SetUnblockedOnDelegate();
   awaiting_callback_ = false;

   // Check that there are no callbacks to already canceled requests.

Modified: trunk/src/net/url_request/url_request_job.cc
=========================================================================== ===
--- trunk/src/net/url_request/url_request_job.cc        (original)
+++ trunk/src/net/url_request/url_request_job.cc        Tue Nov 13 21:04:30 2012
@@ -191,6 +191,8 @@
   // It is also possible that FollowRedirect will drop the last reference to
   // this job, so we need to reset our members before calling it.

+  SetUnblockedOnDelegate();
+
   GURL redirect_url = deferred_redirect_url_;
   int redirect_status_code = deferred_redirect_status_code_;

@@ -307,6 +309,7 @@
       if (defer_redirect) {
         deferred_redirect_url_ = new_location;
         deferred_redirect_status_code_ = http_status_code;
+        SetBlockedOnDelegate();
       } else {
         FollowRedirect(new_location, http_status_code);
       }

Modified: trunk/src/net/url_request/url_request_job.h
=========================================================================== ===
--- trunk/src/net/url_request/url_request_job.h (original)
+++ trunk/src/net/url_request/url_request_job.h Tue Nov 13 21:04:30 2012
@@ -241,8 +241,8 @@
   // Should only be called if the job has not started a resposne.
   void NotifyRestartRequired();

-  // Called when the delegate blocks or unblocks this request when intercepting
-  // certain requests.
+  // Called when the network delegate blocks or unblocks this request when
+  // intercepting certain requests.
   void SetBlockedOnDelegate();
   void SetUnblockedOnDelegate();


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »