Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef ResizeObserverController_h | 5 #ifndef ResizeObserverController_h |
| 6 #define ResizeObserverController_h | 6 #define ResizeObserverController_h |
| 7 | 7 |
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 class ResizeObserver; | 12 class ResizeObserver; |
| 13 | 13 |
| 14 // ResizeObserverController keeps track of all ResizeObservers | 14 // ResizeObserverController keeps track of all ResizeObservers |
| 15 // in a single Document. | 15 // in a single Document. |
| 16 // | |
| 17 // The observation API is used to integrate ResizeObserver | |
| 18 // and the event loop. It delivers notification in a loop. | |
| 19 // In each iteration, only notifications deeper than the | |
| 20 // shallowest notification from previous iteration are delivered. | |
| 16 class ResizeObserverController final : public GarbageCollected<ResizeObserverCon troller> { | 21 class ResizeObserverController final : public GarbageCollected<ResizeObserverCon troller> { |
| 17 public: | 22 public: |
| 23 static const size_t kDepthBottom = 4096; | |
| 24 | |
| 18 ResizeObserverController(); | 25 ResizeObserverController(); |
| 19 | 26 |
| 20 void addObserver(ResizeObserver&); | 27 void addObserver(ResizeObserver&); |
| 21 | 28 |
| 29 // observation API | |
| 30 // Returns depth of shallowest observed node, kDepthLimit if none. | |
| 31 size_t gatherObservations(size_t deeperThan); | |
| 32 bool skippedObservations(); | |
|
ikilpatrick
2016/07/29 23:18:39
comment?
atotic1
2016/07/30 03:16:29
Done. I just did not upload changes before waiting
| |
| 33 void deliverObservations(); | |
| 34 void clearObservations(); | |
| 35 void observerChanged() { m_observersChanged = true; } | |
| 36 | |
| 22 DECLARE_TRACE(); | 37 DECLARE_TRACE(); |
| 23 | 38 |
| 24 private: | 39 private: |
| 25 // Active observers | 40 // Active observers |
| 26 HeapHashSet<WeakMember<ResizeObserver>> m_observers; | 41 HeapHashSet<WeakMember<ResizeObserver>> m_observers; |
| 42 // True if observers were changed since last notification | |
|
ikilpatrick
2016/07/29 23:18:39
clarify comment, is this the set of observers that
atotic1
2016/07/30 03:16:29
Changed to:
// True if ANY observers were changed
| |
| 43 bool m_observersChanged; | |
| 27 }; | 44 }; |
| 28 | 45 |
| 29 } // namespace blink | 46 } // namespace blink |
| 30 | 47 |
| 31 #endif | 48 #endif |
| OLD | NEW |