| Index: content/child/web_url_loader_impl.cc
|
| diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
|
| index 00bbf1b1e61598ff987a349e5a580198774c28b6..9e99f7f3d24b5eba142001252168a1b7a095e421 100644
|
| --- a/content/child/web_url_loader_impl.cc
|
| +++ b/content/child/web_url_loader_impl.cc
|
| @@ -2,8 +2,6 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// An implementation of WebURLLoader in terms of ResourceLoaderBridge.
|
| -
|
| #include "content/child/web_url_loader_impl.h"
|
|
|
| #include "base/bind.h"
|
| @@ -16,6 +14,7 @@
|
| #include "content/child/ftp_directory_listing_response_delegate.h"
|
| #include "content/child/request_extra_data.h"
|
| #include "content/child/request_info.h"
|
| +#include "content/child/resource_dispatcher.h"
|
| #include "content/child/sync_load_response.h"
|
| #include "content/common/resource_request_body.h"
|
| #include "content/public/child/request_peer.h"
|
| @@ -37,7 +36,6 @@
|
| #include "third_party/WebKit/public/platform/WebURLResponse.h"
|
| #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
| #include "webkit/child/multipart_response_delegate.h"
|
| -#include "webkit/child/resource_loader_bridge.h"
|
| #include "webkit/child/weburlresponse_extradata_impl.h"
|
|
|
| using base::Time;
|
| @@ -58,7 +56,6 @@ using blink::WebURLRequest;
|
| using blink::WebURLResponse;
|
| using webkit_glue::MultipartResponseDelegate;
|
| using webkit_glue::ResourceDevToolsInfo;
|
| -using webkit_glue::ResourceLoaderBridge;
|
| using webkit_glue::ResourceResponseInfo;
|
| using webkit_glue::WebURLResponseExtraDataImpl;
|
|
|
| @@ -219,8 +216,7 @@ net::RequestPriority ConvertWebKitPriorityToNetPriority(
|
| // WebURLLoaderImpl::Context --------------------------------------------------
|
|
|
| // This inner class exists since the WebURLLoader may be deleted while inside a
|
| -// call to WebURLLoaderClient. The bridge requires its Peer to stay alive
|
| -// until it receives OnCompletedRequest.
|
| +// call to WebURLLoaderClient.
|
| class WebURLLoaderImpl::Context : public base::RefCounted<Context>,
|
| public RequestPeer {
|
| public:
|
| @@ -268,23 +264,23 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>,
|
| WebURLRequest request_;
|
| WebURLLoaderClient* client_;
|
| WebReferrerPolicy referrer_policy_;
|
| - scoped_ptr<ResourceLoaderBridge> bridge_;
|
| + ResourceDispatcher* dispatcher_;
|
| scoped_ptr<FtpDirectoryListingResponseDelegate> ftp_listing_delegate_;
|
| scoped_ptr<MultipartResponseDelegate> multipart_delegate_;
|
| - scoped_ptr<ResourceLoaderBridge> completed_bridge_;
|
| };
|
|
|
| WebURLLoaderImpl::Context::Context(WebURLLoaderImpl* loader)
|
| : loader_(loader),
|
| client_(NULL),
|
| - referrer_policy_(blink::WebReferrerPolicyDefault) {
|
| + referrer_policy_(blink::WebReferrerPolicyDefault),
|
| + dispatcher_(NULL) {
|
| }
|
|
|
| void WebURLLoaderImpl::Context::Cancel() {
|
| - // The bridge will still send OnCompletedRequest, which will Release() us, so
|
| - // we don't do that here.
|
| - if (bridge_)
|
| - bridge_->Cancel();
|
| + // The dispatcher will still send OnCompletedRequest, which will Release() us,
|
| + // so we don't do that here.
|
| + if (dispatcher_)
|
| + dispatcher_->Cancel();
|
|
|
| // Ensure that we do not notify the multipart delegate anymore as it has
|
| // its own pointer to the client.
|
| @@ -297,20 +293,20 @@ void WebURLLoaderImpl::Context::Cancel() {
|
| }
|
|
|
| void WebURLLoaderImpl::Context::SetDefersLoading(bool value) {
|
| - if (bridge_)
|
| - bridge_->SetDefersLoading(value);
|
| + if (dispatcher_)
|
| + dispatcher_->SetDefersLoading(value);
|
| }
|
|
|
| void WebURLLoaderImpl::Context::DidChangePriority(
|
| WebURLRequest::Priority new_priority) {
|
| - if (bridge_)
|
| - bridge_->DidChangePriority(
|
| + if (dispatcher_)
|
| + dispatcher_->DidChangePriority(
|
| ConvertWebKitPriorityToNetPriority(new_priority));
|
| }
|
|
|
| void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
|
| SyncLoadResponse* sync_load_response) {
|
| - DCHECK(!bridge_.get());
|
| + DCHECK(!dispatcher_);
|
|
|
| request_ = request; // Save the request.
|
|
|
| @@ -399,7 +395,8 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
|
| request_info.extra_data = request.extraData();
|
| referrer_policy_ = request.referrerPolicy();
|
| request_info.referrer_policy = request.referrerPolicy();
|
| - bridge_.reset(ChildThread::current()->CreateBridge(request_info));
|
| + dispatcher_ = ChildThread::current()->resource_dispatcher();
|
| + dispatcher_->CreateBridge(request_info);
|
|
|
| if (!request.httpBody().isNull()) {
|
| // GET and HEAD requests shouldn't have http bodies.
|
| @@ -449,18 +446,16 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
|
| }
|
| }
|
| request_body->set_identifier(request.httpBody().identifier());
|
| - bridge_->SetRequestBody(request_body.get());
|
| + dispatcher_->SetRequestBody(request_body.get());
|
| }
|
|
|
| if (sync_load_response) {
|
| - bridge_->SyncLoad(sync_load_response);
|
| + dispatcher_->SyncLoad(sync_load_response);
|
| return;
|
| }
|
|
|
| - if (bridge_->Start(this)) {
|
| + if (dispatcher_->Start(this)) {
|
| AddRef(); // Balanced in OnCompletedRequest
|
| - } else {
|
| - bridge_.reset();
|
| }
|
| }
|
|
|
| @@ -619,11 +614,6 @@ void WebURLLoaderImpl::Context::OnCompletedRequest(
|
| multipart_delegate_.reset(NULL);
|
| }
|
|
|
| - // Prevent any further IPC to the browser now that we're complete, but
|
| - // don't delete it to keep any downloaded temp files alive.
|
| - DCHECK(!completed_bridge_.get());
|
| - completed_bridge_.swap(bridge_);
|
| -
|
| if (client_) {
|
| if (error_code != net::OK) {
|
| client_->didFail(loader_, CreateError(request_.url(),
|
| @@ -636,9 +626,6 @@ void WebURLLoaderImpl::Context::OnCompletedRequest(
|
| }
|
| }
|
|
|
| - // We are done with the bridge now, and so we need to release the reference
|
| - // to ourselves that we took on behalf of the bridge. This may cause our
|
| - // destruction.
|
| Release();
|
| }
|
|
|
| @@ -650,8 +637,7 @@ bool WebURLLoaderImpl::Context::CanHandleDataURL(const GURL& url) const {
|
| // download.
|
| //
|
| // NOTE: We special case MIME types we can render both for performance
|
| - // reasons as well as to support unit tests, which do not have an underlying
|
| - // ResourceLoaderBridge implementation.
|
| + // reasons as well as to support unit tests.
|
|
|
| #if defined(OS_ANDROID)
|
| // For compatibility reasons on Android we need to expose top-level data://
|
|
|