Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 0fdcc4105945baf18ff9939cd0680d86f154fb6e..b64db4415dd282746cfe66f2dc37d0ce296663c4 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -91,6 +91,7 @@ |
#include "core/dom/ProcessingInstruction.h" |
#include "core/dom/ScriptRunner.h" |
#include "core/dom/ScriptedAnimationController.h" |
+#include "core/dom/ScriptedIdleTaskController.h" |
#include "core/dom/SelectorQuery.h" |
#include "core/dom/StaticNodeList.h" |
#include "core/dom/StyleEngine.h" |
@@ -586,6 +587,8 @@ void Document::dispose() |
m_scriptedAnimationController->clearDocumentPointer(); |
m_scriptedAnimationController.clear(); |
+ m_scriptedIdleTaskController.clear(); |
+ |
if (svgExtensions()) |
accessSVGExtensions().pauseAnimations(); |
@@ -2136,6 +2139,8 @@ void Document::detach(const AttachContext& context) |
m_scriptedAnimationController->clearDocumentPointer(); |
m_scriptedAnimationController.clear(); |
+ m_scriptedIdleTaskController.clear(); |
+ |
if (svgExtensions()) |
accessSVGExtensions().pauseAnimations(); |
@@ -5130,6 +5135,25 @@ void Document::serviceScriptedAnimations(double monotonicAnimationStartTime) |
m_scriptedAnimationController->serviceScriptedAnimations(monotonicAnimationStartTime); |
} |
+ScriptedIdleTaskController& Document::ensureScriptedIdleTaskController() |
+{ |
+ if (!m_scriptedIdleTaskController) |
+ m_scriptedIdleTaskController = ScriptedIdleTaskController::create(this, loader()->timing()); |
+ return *m_scriptedIdleTaskController; |
+} |
+ |
+int Document::requestIdleCallback(IdleRequestCallback* callback, double timeoutMillis) |
+{ |
+ return ensureScriptedIdleTaskController().registerCallback(callback, timeoutMillis); |
+} |
+ |
+void Document::cancelIdleCallback(int id) |
+{ |
+ if (!m_scriptedIdleTaskController) |
+ return; |
+ m_scriptedIdleTaskController->cancelCallback(id); |
+} |
+ |
PassRefPtrWillBeRawPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, double pageX, double pageY, double screenX, double screenY, double radiusX, double radiusY, float rotationAngle, float force) const |
{ |
// Match behavior from when these types were integers, and avoid surprises from someone explicitly |
@@ -5660,6 +5684,7 @@ DEFINE_TRACE(Document) |
visitor->trace(m_documentTiming); |
visitor->trace(m_mediaQueryMatcher); |
visitor->trace(m_scriptedAnimationController); |
+ visitor->trace(m_scriptedIdleTaskController); |
visitor->trace(m_taskRunner); |
visitor->trace(m_textAutosizer); |
visitor->trace(m_registrationContext); |