Index: third_party/WebKit/Source/core/dom/ProxiedPropertyCounts.cpp |
diff --git a/third_party/WebKit/Source/core/dom/ProxiedPropertyCounts.cpp b/third_party/WebKit/Source/core/dom/ProxiedPropertyCounts.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1cf7f079ca3c1fe862d84cda51bb2402ea189765 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/dom/ProxiedPropertyCounts.cpp |
@@ -0,0 +1,55 @@ |
+// Copyright 2015 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 "config.h" |
+#include "core/dom/ProxiedPropertyCounts.h" |
+ |
+namespace blink { |
+ |
+PassOwnPtrWillBeRawPtr<ProxiedPropertyCounts> ProxiedPropertyCounts::create() |
+{ |
+ return adoptPtrWillBeNoop(new ProxiedPropertyCounts); |
+} |
+ |
+ProxiedPropertyCounts::ProxiedPropertyCounts() |
+{ |
+ memset(m_counts, 0, sizeof(m_counts)); |
+} |
+ |
+ProxiedPropertyCounts::~ProxiedPropertyCounts() {} |
+ |
+bool ProxiedPropertyCounts::empty() const |
+{ |
+ return !proxiedProperties(); |
+} |
+ |
+void ProxiedPropertyCounts::increment(uint32_t mutableProperties) |
+{ |
+ for (int i = 0; i < kNumWebCompositorMutableProperties; ++i) { |
+ if (mutableProperties & (1 << i)) |
+ ++m_counts[i]; |
+ } |
+} |
+ |
+void ProxiedPropertyCounts::decrement(uint32_t mutableProperties) |
+{ |
+ for (int i = 0; i < kNumWebCompositorMutableProperties; ++i) { |
+ if (mutableProperties & (1 << i)) { |
+ ASSERT(m_counts[i]); |
+ --m_counts[i]; |
+ } |
+ } |
+} |
+ |
+uint32_t ProxiedPropertyCounts::proxiedProperties() const |
+{ |
+ uint32_t properties = WebCompositorMutablePropertyNone; |
+ for (int i = 0; i < kNumWebCompositorMutableProperties; ++i) { |
+ if (m_counts[i]) |
+ properties |= 1 << i; |
+ } |
+ return properties; |
+} |
+ |
+} // namespace blink |