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

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

Issue 2553343002: Avoid WTF::Vector::at() and operator[] in core/dom. (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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/CompositorProxy.h" 5 #include "core/dom/CompositorProxy.h"
6 6
7 #include "bindings/core/v8/ExceptionMessages.h" 7 #include "bindings/core/v8/ExceptionMessages.h"
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "core/dom/DOMNodeIds.h" 9 #include "core/dom/DOMNodeIds.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 for (const auto& attribute : attributeArray) { 91 for (const auto& attribute : attributeArray) {
92 properties |= compositorMutablePropertyForName(attribute); 92 properties |= compositorMutablePropertyForName(attribute);
93 } 93 }
94 return properties; 94 return properties;
95 } 95 }
96 96
97 #if DCHECK_IS_ON() 97 #if DCHECK_IS_ON()
98 static bool sanityCheckMutableProperties(uint32_t properties) { 98 static bool sanityCheckMutableProperties(uint32_t properties) {
99 // Ensures that we only have bits set for valid mutable properties. 99 // Ensures that we only have bits set for valid mutable properties.
100 uint32_t sanityCheckProperties = properties; 100 uint32_t sanityCheckProperties = properties;
101 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(allowedProperties); ++i) { 101 for (const auto& property : allowedProperties)
102 sanityCheckProperties &= 102 sanityCheckProperties &= ~static_cast<uint32_t>(property.property);
103 ~static_cast<uint32_t>(allowedProperties[i].property);
104 }
105 return !sanityCheckProperties; 103 return !sanityCheckProperties;
106 } 104 }
107 #endif 105 #endif
108 106
109 CompositorProxy* CompositorProxy::create(ExecutionContext* context, 107 CompositorProxy* CompositorProxy::create(ExecutionContext* context,
110 Element* element, 108 Element* element,
111 const Vector<String>& attributeArray, 109 const Vector<String>& attributeArray,
112 ExceptionState& exceptionState) { 110 ExceptionState& exceptionState) {
113 if (!context->isDocument()) { 111 if (!context->isDocument()) {
114 exceptionState.throwTypeError(ExceptionMessages::failedToConstruct( 112 exceptionState.throwTypeError(ExceptionMessages::failedToConstruct(
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 m_elementId, m_compositorMutableProperties); 297 m_elementId, m_compositorMutableProperties);
300 } else { 298 } else {
301 Platform::current()->mainThread()->getWebTaskRunner()->postTask( 299 Platform::current()->mainThread()->getWebTaskRunner()->postTask(
302 BLINK_FROM_HERE, 300 BLINK_FROM_HERE,
303 crossThreadBind(&decrementCompositorProxiedPropertiesForElement, 301 crossThreadBind(&decrementCompositorProxiedPropertiesForElement,
304 m_elementId, m_compositorMutableProperties)); 302 m_elementId, m_compositorMutableProperties));
305 } 303 }
306 } 304 }
307 305
308 } // namespace blink 306 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ClientRectList.cpp ('k') | third_party/WebKit/Source/core/dom/DOMStringList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698