Index: third_party/WebKit/Source/core/observer/ResizeObserverController.cpp |
diff --git a/third_party/WebKit/Source/core/observer/ResizeObserverController.cpp b/third_party/WebKit/Source/core/observer/ResizeObserverController.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b71e6f12cdb33ccb86d467714907802101f27a86 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/observer/ResizeObserverController.cpp |
@@ -0,0 +1,47 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "core/observer/ResizeObserverController.h" |
+ |
+#include "core/observer/ResizeObserver.h" |
+ |
+ |
+namespace blink { |
+ |
+ResizeObserverController::ResizeObserverController() |
+{ |
+} |
+ |
+void ResizeObserverController::addObserver(ResizeObserver& observer) |
+{ |
+ m_observers.add(&observer); |
+} |
+ |
+void ResizeObserverController::gatherObservations() |
+{ |
+ for (auto it = m_observers.begin(); it != m_observers.end(); ++it) |
szager1
2016/05/23 19:49:12
for (auto& observer : m_observers)
observer->gat
atotic1
2016/05/25 00:15:53
Done.
|
+ (**it).gatherObservations(); |
+} |
+ |
+bool ResizeObserverController::hasObservations() |
+{ |
+ for (auto it = m_observers.begin(); it != m_observers.end(); ++it) { |
szager1
2016/05/23 19:49:12
This shouldn't do an iteration. Consider making R
atotic1
2016/05/25 00:15:53
That was my original design, broke it apart to exp
|
+ if ((**it).hasObservations()) |
+ return true; |
+ } |
+ return false; |
+} |
+ |
+void ResizeObserverController::deliverObservations() |
+{ |
+ for (auto it = m_observers.begin(); it != m_observers.end(); ++it) |
szager1
2016/05/23 19:49:12
ditto iterator syntax.
atotic1
2016/05/25 00:15:53
Done.
|
+ (**it).deliverObservations(); |
+} |
+ |
+DEFINE_TRACE(ResizeObserverController) |
+{ |
+ visitor->trace(m_observers); |
+} |
+ |
+} // namespace blink |