Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Unified Diff: third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp

Issue 2646893002: Move WebAssociatedURLLoaderImpl's error timer to the frame's loading task runner. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp b/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp
index a2afce29a664a9eac4ef5034a04959a99df0d4bb..d3f7b28710604a2d564da325cdff3708d1477ecb 100644
--- a/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp
+++ b/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp
@@ -31,6 +31,7 @@
#include "web/WebAssociatedURLLoaderImpl.h"
#include "core/dom/ContextLifecycleObserver.h"
+#include "core/dom/TaskRunnerHelper.h"
#include "core/fetch/CrossOriginAccessControl.h"
#include "core/fetch/FetchUtils.h"
#include "core/loader/DocumentThreadableLoader.h"
@@ -92,7 +93,8 @@ class WebAssociatedURLLoaderImpl::ClientAdapter final
static std::unique_ptr<ClientAdapter> create(
WebAssociatedURLLoaderImpl*,
WebAssociatedURLLoaderClient*,
- const WebAssociatedURLLoaderOptions&);
+ const WebAssociatedURLLoaderOptions&,
+ RefPtr<WebTaskRunner>);
// ThreadableLoaderClient
void didSendData(unsigned long long /*bytesSent*/,
@@ -133,7 +135,8 @@ class WebAssociatedURLLoaderImpl::ClientAdapter final
private:
ClientAdapter(WebAssociatedURLLoaderImpl*,
WebAssociatedURLLoaderClient*,
- const WebAssociatedURLLoaderOptions&);
+ const WebAssociatedURLLoaderOptions&,
+ RefPtr<WebTaskRunner>);
void notifyError(TimerBase*);
@@ -142,7 +145,7 @@ class WebAssociatedURLLoaderImpl::ClientAdapter final
WebAssociatedURLLoaderOptions m_options;
WebURLError m_error;
- Timer<ClientAdapter> m_errorTimer;
+ TaskRunnerTimer<ClientAdapter> m_errorTimer;
bool m_enableErrorNotifications;
bool m_didFail;
};
@@ -151,18 +154,21 @@ std::unique_ptr<WebAssociatedURLLoaderImpl::ClientAdapter>
WebAssociatedURLLoaderImpl::ClientAdapter::create(
WebAssociatedURLLoaderImpl* loader,
WebAssociatedURLLoaderClient* client,
- const WebAssociatedURLLoaderOptions& options) {
- return WTF::wrapUnique(new ClientAdapter(loader, client, options));
+ const WebAssociatedURLLoaderOptions& options,
+ RefPtr<WebTaskRunner> taskRunner) {
+ return WTF::wrapUnique(
+ new ClientAdapter(loader, client, options, taskRunner));
}
WebAssociatedURLLoaderImpl::ClientAdapter::ClientAdapter(
WebAssociatedURLLoaderImpl* loader,
WebAssociatedURLLoaderClient* client,
- const WebAssociatedURLLoaderOptions& options)
+ const WebAssociatedURLLoaderOptions& options,
+ RefPtr<WebTaskRunner> taskRunner)
: m_loader(loader),
m_client(client),
m_options(options),
- m_errorTimer(this, &ClientAdapter::notifyError),
+ m_errorTimer(std::move(taskRunner), this, &ClientAdapter::notifyError),
m_enableErrorNotifications(false),
m_didFail(false) {
DCHECK(m_loader);
@@ -382,8 +388,12 @@ void WebAssociatedURLLoaderImpl::loadAsynchronously(
}
}
+ RefPtr<WebTaskRunner> taskRunner = TaskRunnerHelper::get(
+ TaskType::UnspecedLoading,
+ m_observer ? toDocument(m_observer->lifecycleContext()) : nullptr);
m_client = client;
- m_clientAdapter = ClientAdapter::create(this, client, m_options);
+ m_clientAdapter =
+ ClientAdapter::create(this, client, m_options, std::move(taskRunner));
if (allowLoad) {
ThreadableLoaderOptions options;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698