|
Lines 31-39
a/Source/WebCore/page/DOMTimer.cpp_sec1
|
| 31 |
#include "HTMLPlugInElement.h" |
31 |
#include "HTMLPlugInElement.h" |
| 32 |
#include "InspectorInstrumentation.h" |
32 |
#include "InspectorInstrumentation.h" |
| 33 |
#include "Logging.h" |
33 |
#include "Logging.h" |
|
|
34 |
#include "Page.h" |
| 34 |
#include "PluginViewBase.h" |
35 |
#include "PluginViewBase.h" |
| 35 |
#include "ScheduledAction.h" |
36 |
#include "ScheduledAction.h" |
| 36 |
#include "ScriptExecutionContext.h" |
37 |
#include "ScriptExecutionContext.h" |
|
|
38 |
#include "Settings.h" |
| 37 |
#include "UserGestureIndicator.h" |
39 |
#include "UserGestureIndicator.h" |
| 38 |
#include <wtf/CurrentTime.h> |
40 |
#include <wtf/CurrentTime.h> |
| 39 |
#include <wtf/HashSet.h> |
41 |
#include <wtf/HashSet.h> |
|
Lines 45-51
a/Source/WebCore/page/DOMTimer.cpp_sec2
|
| 45 |
#include "Chrome.h" |
47 |
#include "Chrome.h" |
| 46 |
#include "ChromeClient.h" |
48 |
#include "ChromeClient.h" |
| 47 |
#include "Frame.h" |
49 |
#include "Frame.h" |
| 48 |
#include "Page.h" |
|
|
| 49 |
#include "WKContentObservation.h" |
50 |
#include "WKContentObservation.h" |
| 50 |
#endif |
51 |
#endif |
| 51 |
|
52 |
|
|
Lines 77-82
public:
a/Source/WebCore/page/DOMTimer.cpp_sec3
|
| 77 |
current = m_previous; |
78 |
current = m_previous; |
| 78 |
} |
79 |
} |
| 79 |
|
80 |
|
|
|
81 |
Document* contextDocument() const { return m_contextIsDocument ? &downcast<Document>(m_context) : nullptr; } |
| 82 |
|
| 80 |
void setScriptMadeUserObservableChanges() { m_scriptMadeUserObservableChanges = true; } |
83 |
void setScriptMadeUserObservableChanges() { m_scriptMadeUserObservableChanges = true; } |
| 81 |
void setScriptMadeNonUserObservableChanges() { m_scriptMadeNonUserObservableChanges = true; } |
84 |
void setScriptMadeNonUserObservableChanges() { m_scriptMadeNonUserObservableChanges = true; } |
| 82 |
void setScriptMadeNonUserObservableChangesToElementStyle(StyledElement& element) |
85 |
void setScriptMadeNonUserObservableChangesToElementStyle(StyledElement& element) |
|
Lines 91-98
public:
a/Source/WebCore/page/DOMTimer.cpp_sec4
|
| 91 |
if (m_scriptMadeUserObservableChanges) |
94 |
if (m_scriptMadeUserObservableChanges) |
| 92 |
return true; |
95 |
return true; |
| 93 |
|
96 |
|
|
|
97 |
Document* document = contextDocument(); |
| 94 |
// To be conservative, we also consider any DOM Tree change to be user observable. |
98 |
// To be conservative, we also consider any DOM Tree change to be user observable. |
| 95 |
return m_contextIsDocument && downcast<Document>(m_context).domTreeVersion() != m_initialDOMTreeVersion; |
99 |
return document && document->domTreeVersion() != m_initialDOMTreeVersion; |
| 96 |
} |
100 |
} |
| 97 |
|
101 |
|
| 98 |
void setChangedStyleOfElementOutsideViewport(StyledElement& element) |
102 |
void setChangedStyleOfElementOutsideViewport(StyledElement& element) |
|
Lines 251-258
void DOMTimer::removeById(ScriptExecutionContext& context, int timeoutId)
a/Source/WebCore/page/DOMTimer.cpp_sec5
|
| 251 |
context.removeTimeout(timeoutId); |
255 |
context.removeTimeout(timeoutId); |
| 252 |
} |
256 |
} |
| 253 |
|
257 |
|
|
|
258 |
inline bool DOMTimer::isDOMTimersThrottlingEnabled(Document& document) const |
| 259 |
{ |
| 260 |
auto* page = document.page(); |
| 261 |
if (!page) |
| 262 |
return true; |
| 263 |
return page->settings().domTimersThrottlingEnabled(); |
| 264 |
} |
| 265 |
|
| 254 |
void DOMTimer::updateThrottlingStateIfNecessary(const DOMTimerFireState& fireState) |
266 |
void DOMTimer::updateThrottlingStateIfNecessary(const DOMTimerFireState& fireState) |
| 255 |
{ |
267 |
{ |
|
|
268 |
Document* contextDocument = fireState.contextDocument(); |
| 269 |
// We don't throttle timers in worker threads. |
| 270 |
if (!contextDocument) |
| 271 |
return; |
| 272 |
|
| 273 |
if (UNLIKELY(!isDOMTimersThrottlingEnabled(*contextDocument))) { |
| 274 |
if (m_throttleState == ShouldThrottle) { |
| 275 |
// Unthrottle the timer in case it was throttled before the setting was updated. |
| 276 |
LOG(DOMTimers, "%p - Unthrottling DOM timer because throttling was disabled via settings.", this); |
| 277 |
m_throttleState = ShouldNotThrottle; |
| 278 |
updateTimerIntervalIfNecessary(); |
| 279 |
} |
| 280 |
return; |
| 281 |
} |
| 282 |
|
| 256 |
if (fireState.scriptMadeUserObservableChanges()) { |
283 |
if (fireState.scriptMadeUserObservableChanges()) { |
| 257 |
ASSERT(m_elementsCausingThrottling.isEmpty()); |
284 |
ASSERT(m_elementsCausingThrottling.isEmpty()); |
| 258 |
if (m_throttleState != ShouldNotThrottle) { |
285 |
if (m_throttleState != ShouldNotThrottle) { |