OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "core/dom/ProxiedPropertyCounts.h" |
| 7 |
| 8 namespace blink { |
| 9 |
| 10 PassOwnPtrWillBeRawPtr<ProxiedPropertyCounts> ProxiedPropertyCounts::create() |
| 11 { |
| 12 return adoptPtrWillBeNoop(new ProxiedPropertyCounts); |
| 13 } |
| 14 |
| 15 ProxiedPropertyCounts::ProxiedPropertyCounts() |
| 16 { |
| 17 memset(m_counts, 0, sizeof(m_counts)); |
| 18 } |
| 19 |
| 20 ProxiedPropertyCounts::~ProxiedPropertyCounts() {} |
| 21 |
| 22 bool ProxiedPropertyCounts::empty() const |
| 23 { |
| 24 return !proxiedProperties(); |
| 25 } |
| 26 |
| 27 void ProxiedPropertyCounts::increment(uint32_t mutableProperties) |
| 28 { |
| 29 for (int i = 0; i < kNumWebCompositorMutableProperties; ++i) { |
| 30 if (mutableProperties & (1 << i)) |
| 31 ++m_counts[i]; |
| 32 } |
| 33 } |
| 34 |
| 35 void ProxiedPropertyCounts::decrement(uint32_t mutableProperties) |
| 36 { |
| 37 for (int i = 0; i < kNumWebCompositorMutableProperties; ++i) { |
| 38 if (mutableProperties & (1 << i)) { |
| 39 ASSERT(m_counts[i]); |
| 40 --m_counts[i]; |
| 41 } |
| 42 } |
| 43 } |
| 44 |
| 45 uint32_t ProxiedPropertyCounts::proxiedProperties() const |
| 46 { |
| 47 uint32_t properties = WebCompositorMutablePropertyNone; |
| 48 for (int i = 0; i < kNumWebCompositorMutableProperties; ++i) { |
| 49 if (m_counts[i]) |
| 50 properties |= 1 << i; |
| 51 } |
| 52 return properties; |
| 53 } |
| 54 |
| 55 } // namespace blink |
OLD | NEW |