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

Side by Side Diff: third_party/WebKit/Source/core/dom/IntersectionObserverController.cpp

Issue 1545813002: Remove unnecessary RAF from tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@intersection-observer-document-root
Patch Set: rebaseline Created 4 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/intersection-observer/same-document-root.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/IntersectionObserverController.h" 5 #include "core/dom/IntersectionObserverController.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 10 matching lines...) Expand all
21 : ActiveDOMObject(document) 21 : ActiveDOMObject(document)
22 , m_timer(this, &IntersectionObserverController::deliverIntersectionObservat ions) 22 , m_timer(this, &IntersectionObserverController::deliverIntersectionObservat ions)
23 , m_timerFiredWhileSuspended(false) 23 , m_timerFiredWhileSuspended(false)
24 { 24 {
25 } 25 }
26 26
27 IntersectionObserverController::~IntersectionObserverController() { } 27 IntersectionObserverController::~IntersectionObserverController() { }
28 28
29 void IntersectionObserverController::scheduleIntersectionObserverForDelivery(Int ersectionObserver& observer) 29 void IntersectionObserverController::scheduleIntersectionObserverForDelivery(Int ersectionObserver& observer)
30 { 30 {
31 // TODO(szager): use idle callback with a timeout 31 // TODO(szager): use idle callback with a timeout. Until we do that, there is no
32 // reliable way to write a test for takeRecords, because it's impossible to guarantee
33 // that javascript will get a chance to run before the timer fires.
32 if (!m_timer.isActive()) 34 if (!m_timer.isActive())
33 m_timer.startOneShot(0, BLINK_FROM_HERE); 35 m_timer.startOneShot(0, BLINK_FROM_HERE);
34 m_pendingIntersectionObservers.add(&observer); 36 m_pendingIntersectionObservers.add(&observer);
35 } 37 }
36 38
37 void IntersectionObserverController::resume() 39 void IntersectionObserverController::resume()
38 { 40 {
39 // If the timer fired while DOM objects were suspended, notifications might be late, so deliver 41 // If the timer fired while DOM objects were suspended, notifications might be late, so deliver
40 // them right away (rather than waiting for m_timer to fire again). 42 // them right away (rather than waiting for m_timer to fire again).
41 if (m_timerFiredWhileSuspended) { 43 if (m_timerFiredWhileSuspended) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 86 }
85 87
86 DEFINE_TRACE(IntersectionObserverController) 88 DEFINE_TRACE(IntersectionObserverController)
87 { 89 {
88 visitor->trace(m_trackedIntersectionObservers); 90 visitor->trace(m_trackedIntersectionObservers);
89 visitor->trace(m_pendingIntersectionObservers); 91 visitor->trace(m_pendingIntersectionObservers);
90 ActiveDOMObject::trace(visitor); 92 ActiveDOMObject::trace(visitor);
91 } 93 }
92 94
93 } // namespace blink 95 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/intersection-observer/same-document-root.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698