Index: content/browser/loader/resource_loader.h |
diff --git a/content/browser/loader/resource_loader.h b/content/browser/loader/resource_loader.h |
index 6ebcd2de50b08624c9cf4cb2eae356f015916135..7a92c14fb35ce990e4ee052d92eaaf8e1bafb14f 100644 |
--- a/content/browser/loader/resource_loader.h |
+++ b/content/browser/loader/resource_loader.h |
@@ -14,7 +14,6 @@ |
#include "content/browser/ssl/ssl_client_auth_handler.h" |
#include "content/browser/ssl/ssl_error_handler.h" |
#include "content/common/content_export.h" |
-#include "content/public/browser/resource_controller.h" |
#include "net/url_request/url_request.h" |
namespace net { |
@@ -32,8 +31,7 @@ class ResourceRequestInfoImpl; |
// chain of ResourceHandlers, and is the ResourceController for its handler. |
class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, |
public SSLErrorHandler::Delegate, |
- public SSLClientAuthHandler::Delegate, |
- public ResourceController { |
+ public SSLClientAuthHandler::Delegate { |
public: |
ResourceLoader(std::unique_ptr<net::URLRequest> request, |
std::unique_ptr<ResourceHandler> handler, |
@@ -53,6 +51,9 @@ class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, |
void ClearLoginDelegate(); |
private: |
+ // ResourceController implementation for the ResourceLoader. |
+ class Controller; |
+ |
// net::URLRequest::Delegate implementation: |
void OnReceivedRedirect(net::URLRequest* request, |
const net::RedirectInfo& redirect_info, |
@@ -75,11 +76,18 @@ class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, |
void ContinueWithCertificate(net::X509Certificate* cert) override; |
void CancelCertificateSelection() override; |
- // ResourceController implementation: |
- void Resume() override; |
- void Cancel() override; |
- void CancelAndIgnore() override; |
- void CancelWithError(int error_code) override; |
+ // These correspond to Controller's methods. |
+ // TODO(mmenke): Seems like this could be simplified a little. |
+ |
+ // |is_continuation| is false if called from a ResourceController, and true if |
+ // called from ResourceLoader, right after the previous operation succeeded. |
+ // In the latter case, the ResourceController's Resume() method was called |
+ // synchronously by the ResourceLoader, and the stack has since been unwound, |
+ // so the ResourceLoader is at the top of the stack. |
+ void Resume(bool is_continuation); |
+ void Cancel(); |
+ void CancelAndIgnore(); |
+ void CancelWithError(int error_code); |
void StartRequestInternal(); |
void CancelRequestInternal(int error, bool from_renderer); |
@@ -108,6 +116,12 @@ class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, |
enum DeferredStage { |
DEFERRED_NONE, |
+ // Magic deferral "stage" which means that the code is currently in a |
+ // recursive call from the ResourceLoader. When in this state, Resume() does |
+ // nothing but update the deferral state, and when the stack is unwound back |
+ // up to the ResourceLoader, the request will be continued. This is used to |
+ // prevent the stack from getting too deep. |
+ DEFERRED_SYNC, |
DEFERRED_START, |
DEFERRED_REDIRECT, |
DEFERRED_READ, |
@@ -116,6 +130,8 @@ class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, |
}; |
DeferredStage deferred_stage_; |
+ class ScopedDeferral; |
+ |
std::unique_ptr<net::URLRequest> request_; |
std::unique_ptr<ResourceHandler> handler_; |
ResourceLoaderDelegate* delegate_; |