diff options
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/network_delegate.cc | 8 | ||||
-rw-r--r-- | net/base/network_delegate.h | 19 |
2 files changed, 19 insertions, 8 deletions
diff --git a/net/base/network_delegate.cc b/net/base/network_delegate.cc index 3062c7b..d018455 100644 --- a/net/base/network_delegate.cc +++ b/net/base/network_delegate.cc @@ -53,8 +53,14 @@ void NetworkDelegate::NotifyCompleted(URLRequest* request) { } void NetworkDelegate::NotifyURLRequestDestroyed(URLRequest* request) { + DCHECK(CalledOnValidThread()); DCHECK(request); - return OnURLRequestDestroyed(request); + OnURLRequestDestroyed(request); +} + +void NetworkDelegate::NotifyHttpTransactionDestroyed(uint64 request_id) { + DCHECK(CalledOnValidThread()); + OnHttpTransactionDestroyed(request_id); } URLRequestJob* NetworkDelegate::MaybeCreateURLRequestJob(URLRequest* request) { diff --git a/net/base/network_delegate.h b/net/base/network_delegate.h index 86949a8..3cc7b45 100644 --- a/net/base/network_delegate.h +++ b/net/base/network_delegate.h @@ -48,6 +48,7 @@ class NetworkDelegate : public base::NonThreadSafe { void NotifyResponseStarted(URLRequest* request); void NotifyCompleted(URLRequest* request); void NotifyURLRequestDestroyed(URLRequest* request); + void NotifyHttpTransactionDestroyed(uint64 request_id); // Returns a URLRequestJob that will be used to handle the request if // non-null. @@ -63,18 +64,18 @@ class NetworkDelegate : public base::NonThreadSafe { // member function, which will perform basic sanity checking. // Called before a request is sent. Allows the delegate to rewrite the URL - // being fetched by modifying |new_url|. The callback can be called at any - // time, but will have no effect if the request has already been cancelled or - // deleted. Returns a net status code, generally either OK to continue with - // the request or ERR_IO_PENDING if the result is not ready yet. + // being fetched by modifying |new_url|. |callback| and |new_url| are valid + // only until OnURLRequestDestroyed is called for this request. Returns a net + // status code, generally either OK to continue with the request or + // ERR_IO_PENDING if the result is not ready yet. virtual int OnBeforeURLRequest(URLRequest* request, CompletionCallback* callback, GURL* new_url) = 0; // Called right before the HTTP headers are sent. Allows the delegate to - // read/write |headers| before they get sent out. The callback can be called - // at any time, but will have no effect if the transaction handling this - // request has been cancelled. Returns a net status code. + // read/write |headers| before they get sent out. |callback| and |headers| are + // valid only until OnHttpTransactionDestroyed is called for this request. + // Returns a net status code. virtual int OnBeforeSendHeaders(uint64 request_id, CompletionCallback* callback, HttpRequestHeaders* headers) = 0; @@ -99,6 +100,10 @@ class NetworkDelegate : public base::NonThreadSafe { // a virtual method call. virtual void OnURLRequestDestroyed(URLRequest* request) = 0; + // Called when the HttpTransaction for the request with the given ID is + // destroyed. + virtual void OnHttpTransactionDestroyed(uint64 request_id) = 0; + // Called before a request is sent and before a URLRequestJob is created to // handle the request. virtual URLRequestJob* OnMaybeCreateURLRequestJob(URLRequest* request) = 0; |