Reviewers: alex clarke
CL:
https://codereview.chromium.org/2172153002/Description:
Move FrameLoader completion check timer to loading task runner.
BUG=624694
Base URL:
https://chromium.googlesource.com/chromium/src.git@masterAffected files (+9, -6 lines):
M third_party/WebKit/Source/core/loader/FrameLoader.cpp
M third_party/WebKit/Source/platform/Timer.h
Index: third_party/WebKit/Source/core/loader/FrameLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index 3137c89265b684f69598e0e809d913f3903c6e5a..d33df9db829233465d09fee716158635e555190d 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -40,6 +40,7 @@
#include "core/HTMLNames.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
+#include "core/dom/TaskRunnerHelper.h"
#include "core/dom/ViewportDescription.h"
#include "core/editing/Editor.h"
#include "core/events/GestureEvent.h"
@@ -168,7 +169,7 @@ FrameLoader::FrameLoader(LocalFrame* frame)
, m_progressTracker(ProgressTracker::create(frame))
, m_loadType(FrameLoadTypeStandard)
, m_inStopAllLoaders(false)
- , m_checkTimer(this, &FrameLoader::checkTimerFired)
+ , m_checkTimer(this, &FrameLoader::checkTimerFired, TaskRunnerHelper::getLoadingTaskRunner(frame))
, m_didAccessInitialDocument(false)
, m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocumentTimerFired)
, m_forcedSandboxFlags(SandboxNone)
Index: third_party/WebKit/Source/platform/Timer.h
diff --git a/third_party/WebKit/Source/platform/Timer.h b/third_party/WebKit/Source/platform/Timer.h
index 0a9503f9e72360f70b0496b8b135b01f46b5a61b..8245b3adbf1a499f5fbfa49ee5816444badc9fcf 100644
--- a/third_party/WebKit/Source/platform/Timer.h
+++ b/third_party/WebKit/Source/platform/Timer.h
@@ -159,11 +159,18 @@ class Timer : public TimerBase {
public:
using TimerFiredFunction = void (TimerFiredClass::*)(Timer<TimerFiredClass>*);
+ // TODO(dcheng): Consider removing this overload once all timers are using the
+ // appropriate task runner.
https://crbug.com/624694 Timer(TimerFiredClass* o, TimerFiredFunction f)
: m_object(o), m_function(f)
{
}
+ Timer(TimerFiredClass* o, TimerFiredFunction f, WebTaskRunner* webTaskRunner)
+ : TimerBase(webTaskRunner), m_object(o), m_function(f)
+ {
+ }
+
~Timer() override { }
protected:
@@ -181,11 +188,6 @@ protected:
return TimerIsObjectAliveTrait<TimerFiredClass>::isHeapObjectAlive(m_object);
}
- Timer(TimerFiredClass* o, TimerFiredFunction f, WebTaskRunner* webTaskRunner)
- : TimerBase(webTaskRunner), m_object(o), m_function(f)
- {
- }
-
private:
// FIXME: Oilpan: TimerBase should be moved to the heap and m_object should be traced.
// This raw pointer is safe as long as Timer<X> is held by the X itself (That's the case