0

Remove PlatformImpl::createURLLoader

PlatformImpl::createURLLoader is used only by tests. In that case,
resource_dispatcher is null and the returned url loader should be
used only for local resources such as data URLs. This CL moves
the implementation to TestBlinkWebUnitTestSupport to make it explicit.

BUG=603396

Review URL: https://codereview.chromium.org/1904403004

Cr-Commit-Position: refs/heads/master@{#389421}
This commit is contained in:
yhirano
2016-04-25 00:07:56 -07:00
committed by Commit bot
parent b02ed2a73c
commit 6e4dac6c46
3 changed files with 9 additions and 12 deletions

@ -418,15 +418,6 @@ void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread,
BlinkPlatformImpl::~BlinkPlatformImpl() {
}
WebURLLoader* BlinkPlatformImpl::createURLLoader() {
ChildThreadImpl* child_thread = ChildThreadImpl::current();
// There may be no child thread in RenderViewTests. These tests can still use
// data URLs to bypass the ResourceDispatcher.
return new WebURLLoaderImpl(
child_thread ? child_thread->resource_dispatcher() : NULL,
base::WrapUnique(currentThread()->getWebTaskRunner()->clone()));
}
blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() {
return new WebSocketBridge;
}

@ -85,7 +85,6 @@ class CONTENT_EXPORT BlinkPlatformImpl
size_t maxDecodedImageBytes() override;
uint32_t getUniqueIdForProcess() override;
blink::WebURLLoader* createURLLoader() override;
blink::WebSocketHandle* createWebSocketHandle() override;
blink::WebString userAgent() override;
blink::WebData parseDataURL(const blink::WebURL& url,

@ -21,6 +21,7 @@
#include "components/scheduler/renderer/renderer_scheduler_impl.h"
#include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h"
#include "components/scheduler/test/lazy_scheduler_message_loop_delegate_for_tests.h"
#include "content/child/web_url_loader_impl.h"
#include "content/test/mock_webclipboard_impl.h"
#include "content/test/web_gesture_curve_mock.h"
#include "media/base/media.h"
@ -30,6 +31,8 @@
#include "third_party/WebKit/public/platform/WebData.h"
#include "third_party/WebKit/public/platform/WebPluginListBuilder.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebTaskRunner.h"
#include "third_party/WebKit/public/platform/WebThread.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebNetworkStateNotifier.h"
@ -185,8 +188,12 @@ blink::WebMimeRegistry* TestBlinkWebUnitTestSupport::mimeRegistry() {
}
blink::WebURLLoader* TestBlinkWebUnitTestSupport::createURLLoader() {
return url_loader_factory_->createURLLoader(
BlinkPlatformImpl::createURLLoader());
blink::WebThread* currentThread = Platform::current()->currentThread();
// This loader should be used only for process-local resources such as
// data URLs.
blink::WebURLLoader* default_loader = new WebURLLoaderImpl(
nullptr, base::WrapUnique(currentThread->getWebTaskRunner()->clone()));
return url_loader_factory_->createURLLoader(default_loader);
}
blink::WebString TestBlinkWebUnitTestSupport::userAgent() {