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

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
11 typedef HeapVector<Member<IntersectionObserver>> IntersectionObserverVector; 11 typedef HeapVector<Member<IntersectionObserver>> IntersectionObserverVector;
12 12
13 IntersectionObserverController::IntersectionObserverController() 13 IntersectionObserverController::IntersectionObserverController()
14 : m_timer(this, &IntersectionObserverController::deliverIntersectionObservat ions) 14 : m_timer(this, &IntersectionObserverController::deliverIntersectionObservat ions)
15 { 15 {
16 } 16 }
17 17
18 IntersectionObserverController::~IntersectionObserverController() { } 18 IntersectionObserverController::~IntersectionObserverController() { }
19 19
20 void IntersectionObserverController::scheduleIntersectionObserverForDelivery(Int ersectionObserver& observer) 20 void IntersectionObserverController::scheduleIntersectionObserverForDelivery(Int ersectionObserver& observer)
21 { 21 {
22 // TODO(szager): use idle callback with a timeout 22 // TODO(szager): use idle callback with a timeout. Until we do that, there is no
23 // reliable way to write a test for takeRecords, because it's impossible to guarantee
24 // that javascript will get a chance to run before the timer fires.
ojan 2016/01/12 00:43:05 As per in person discussion, not quite clear if th
23 if (!m_timer.isActive()) 25 if (!m_timer.isActive())
24 m_timer.startOneShot(0, BLINK_FROM_HERE); 26 m_timer.startOneShot(0, BLINK_FROM_HERE);
25 m_pendingIntersectionObservers.add(&observer); 27 m_pendingIntersectionObservers.add(&observer);
26 } 28 }
27 29
28 void IntersectionObserverController::deliverIntersectionObservations(Timer<Inter sectionObserverController>*) 30 void IntersectionObserverController::deliverIntersectionObservations(Timer<Inter sectionObserverController>*)
29 { 31 {
30 IntersectionObserverVector observers; 32 IntersectionObserverVector observers;
31 copyToVector(m_pendingIntersectionObservers, observers); 33 copyToVector(m_pendingIntersectionObservers, observers);
32 m_pendingIntersectionObservers.clear(); 34 m_pendingIntersectionObservers.clear();
(...skipping 25 matching lines...) Expand all
58 m_trackedIntersectionObservers.removeAll(toRemove); 60 m_trackedIntersectionObservers.removeAll(toRemove);
59 } 61 }
60 62
61 DEFINE_TRACE(IntersectionObserverController) 63 DEFINE_TRACE(IntersectionObserverController)
62 { 64 {
63 visitor->trace(m_trackedIntersectionObservers); 65 visitor->trace(m_trackedIntersectionObservers);
64 visitor->trace(m_pendingIntersectionObservers); 66 visitor->trace(m_pendingIntersectionObservers);
65 } 67 }
66 68
67 } // namespace blink 69 } // 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