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

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

Issue 2089003002: Add a trace event for IntersectionObserver computing intersections. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 6 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 | « no previous file | 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 #include "core/dom/IdleRequestOptions.h" 8 #include "core/dom/IdleRequestOptions.h"
9 #include "platform/TraceEvent.h"
9 10
10 namespace blink { 11 namespace blink {
11 12
12 IntersectionObserverController* IntersectionObserverController::create(Document* document) 13 IntersectionObserverController* IntersectionObserverController::create(Document* document)
13 { 14 {
14 IntersectionObserverController* result = new IntersectionObserverController( document); 15 IntersectionObserverController* result = new IntersectionObserverController( document);
15 result->suspendIfNeeded(); 16 result->suspendIfNeeded();
16 return result; 17 return result;
17 } 18 }
18 19
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 return; 64 return;
64 } 65 }
65 HeapHashSet<Member<IntersectionObserver>> observers; 66 HeapHashSet<Member<IntersectionObserver>> observers;
66 m_pendingIntersectionObservers.swap(observers); 67 m_pendingIntersectionObservers.swap(observers);
67 for (auto& observer : observers) 68 for (auto& observer : observers)
68 observer->deliver(); 69 observer->deliver();
69 } 70 }
70 71
71 void IntersectionObserverController::computeTrackedIntersectionObservations() 72 void IntersectionObserverController::computeTrackedIntersectionObservations()
72 { 73 {
74 TRACE_EVENT0("blink", "IntersectionObserverController::computeTrackedInterse ctionObservations");
73 for (auto& observer : m_trackedIntersectionObservers) { 75 for (auto& observer : m_trackedIntersectionObservers) {
74 observer->computeIntersectionObservations(); 76 observer->computeIntersectionObservations();
75 if (observer->hasEntries()) 77 if (observer->hasEntries())
76 scheduleIntersectionObserverForDelivery(*observer); 78 scheduleIntersectionObserverForDelivery(*observer);
77 } 79 }
78 } 80 }
79 81
80 void IntersectionObserverController::addTrackedObserver(IntersectionObserver& ob server) 82 void IntersectionObserverController::addTrackedObserver(IntersectionObserver& ob server)
81 { 83 {
82 m_trackedIntersectionObservers.add(&observer); 84 m_trackedIntersectionObservers.add(&observer);
(...skipping 11 matching lines...) Expand all
94 96
95 DEFINE_TRACE(IntersectionObserverController) 97 DEFINE_TRACE(IntersectionObserverController)
96 { 98 {
97 visitor->trace(m_trackedIntersectionObservers); 99 visitor->trace(m_trackedIntersectionObservers);
98 visitor->trace(m_pendingIntersectionObservers); 100 visitor->trace(m_pendingIntersectionObservers);
99 ActiveDOMObject::trace(visitor); 101 ActiveDOMObject::trace(visitor);
100 IdleRequestCallback::trace(visitor); 102 IdleRequestCallback::trace(visitor);
101 } 103 }
102 104
103 } // namespace blink 105 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698