summaryrefslogtreecommitdiffstats
path: root/content/child/web_url_loader_impl.cc
diff options
context:
space:
mode:
authorrmcilroy <rmcilroy@chromium.org>2014-11-17 04:33:56 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-17 12:34:23 +0000
commit6a14f191e91f6209b5b2dff17199d831fc9d486e (patch)
tree8bc854884542a3b17e766670f214ec7fdae45bf1 /content/child/web_url_loader_impl.cc
parent76a267615a7bc5fcb76f3a6c425c57eb99b66745 (diff)
downloadchromium_src-6a14f191e91f6209b5b2dff17199d831fc9d486e.zip
chromium_src-6a14f191e91f6209b5b2dff17199d831fc9d486e.tar.gz
chromium_src-6a14f191e91f6209b5b2dff17199d831fc9d486e.tar.bz2
content: Post WebUrlLoader tasks through the RendererScheduler::DefaultTaskRunner.
This CL routes calls to PostTask in WebUrlLoader through the DefaultTaskRunner of the RendererScheduler, rather than directly posting to the message loop. This avoids a bug in http/tests/loading/simple-subframe.html where didCommitProvisionalLoadd (for an iframe) and didFinishDocumentLoad (for the main frame) could be reordered. It also ensures that these tasks are properly scheduled with respect to the other tasks in the system. BUG=432129 Review URL: https://codereview.chromium.org/727763004 Cr-Commit-Position: refs/heads/master@{#304413}
Diffstat (limited to 'content/child/web_url_loader_impl.cc')
-rw-r--r--content/child/web_url_loader_impl.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index 9468b43..bd6fe10 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -13,7 +13,7 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
+#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "content/child/ftp_directory_listing_response_delegate.h"
@@ -294,7 +294,9 @@ RequestContextType GetRequestContextType(const WebURLRequest& request) {
class WebURLLoaderImpl::Context : public base::RefCounted<Context>,
public RequestPeer {
public:
- Context(WebURLLoaderImpl* loader, ResourceDispatcher* resource_dispatcher);
+ Context(WebURLLoaderImpl* loader,
+ ResourceDispatcher* resource_dispatcher,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
WebURLLoaderClient* client() const { return client_; }
void set_client(WebURLLoaderClient* client) { client_ = client; }
@@ -339,6 +341,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>,
WebURLRequest request_;
WebURLLoaderClient* client_;
ResourceDispatcher* resource_dispatcher_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
WebReferrerPolicy referrer_policy_;
scoped_ptr<ResourceLoaderBridge> bridge_;
scoped_ptr<FtpDirectoryListingResponseDelegate> ftp_listing_delegate_;
@@ -353,11 +356,14 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>,
bool got_all_stream_body_data_;
};
-WebURLLoaderImpl::Context::Context(WebURLLoaderImpl* loader,
- ResourceDispatcher* resource_dispatcher)
+WebURLLoaderImpl::Context::Context(
+ WebURLLoaderImpl* loader,
+ ResourceDispatcher* resource_dispatcher,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: loader_(loader),
client_(NULL),
resource_dispatcher_(resource_dispatcher),
+ task_runner_(task_runner),
referrer_policy_(blink::WebReferrerPolicyDefault),
got_all_stream_body_data_(false) {
}
@@ -434,8 +440,8 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
GetInfoFromDataURL(sync_load_response->url, sync_load_response,
&sync_load_response->data);
} else {
- base::MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(&Context::HandleDataURL, this));
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&Context::HandleDataURL, this));
}
return;
}
@@ -952,8 +958,10 @@ void WebURLLoaderImpl::Context::OnHandleGotWritable(MojoResult result) {
// WebURLLoaderImpl -----------------------------------------------------------
-WebURLLoaderImpl::WebURLLoaderImpl(ResourceDispatcher* resource_dispatcher)
- : context_(new Context(this, resource_dispatcher)) {
+WebURLLoaderImpl::WebURLLoaderImpl(
+ ResourceDispatcher* resource_dispatcher,
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner)
+ : context_(new Context(this, resource_dispatcher, task_runner)) {
}
WebURLLoaderImpl::~WebURLLoaderImpl() {