Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 if (raiseExceptionIfMutationNotAllowed(exceptionState)) | 209 if (raiseExceptionIfMutationNotAllowed(exceptionState)) |
| 210 return; | 210 return; |
| 211 if (raiseExceptionIfNotMutable(static_cast<uint32_t>(WebCompositorMutablePro pertyScrollTop), exceptionState)) | 211 if (raiseExceptionIfNotMutable(static_cast<uint32_t>(WebCompositorMutablePro pertyScrollTop), exceptionState)) |
| 212 return; | 212 return; |
| 213 m_scrollTop = scrollTop; | 213 m_scrollTop = scrollTop; |
| 214 m_mutatedProperties |= static_cast<uint32_t>(WebCompositorMutablePropertyScr ollTop); | 214 m_mutatedProperties |= static_cast<uint32_t>(WebCompositorMutablePropertyScr ollTop); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void CompositorProxy::setTransform(DOMMatrix* transform, ExceptionState& excepti onState) | 217 void CompositorProxy::setTransform(DOMMatrix* transform, ExceptionState& excepti onState) |
| 218 { | 218 { |
| 219 ASSERT(ThreadState::forObject(transform) == ThreadState::forObject(this)); | |
|
haraken
2016/01/07 08:06:21
Is this useful?
| |
| 219 if (raiseExceptionIfMutationNotAllowed(exceptionState)) | 220 if (raiseExceptionIfMutationNotAllowed(exceptionState)) |
| 220 return; | 221 return; |
| 221 if (raiseExceptionIfNotMutable(static_cast<uint32_t>(WebCompositorMutablePro pertyTransform), exceptionState)) | 222 if (raiseExceptionIfNotMutable(static_cast<uint32_t>(WebCompositorMutablePro pertyTransform), exceptionState)) |
| 222 return; | 223 return; |
| 223 m_transform = transform; | 224 m_transform = transform; |
| 224 m_mutatedProperties |= static_cast<uint32_t>(WebCompositorMutablePropertyTra nsform); | 225 m_mutatedProperties |= static_cast<uint32_t>(WebCompositorMutablePropertyTra nsform); |
| 225 } | 226 } |
| 226 | 227 |
| 227 bool CompositorProxy::raiseExceptionIfNotMutable(uint32_t property, ExceptionSta te& exceptionState) const | 228 bool CompositorProxy::raiseExceptionIfNotMutable(uint32_t property, ExceptionSta te& exceptionState) const |
| 228 { | 229 { |
| 229 if (m_connected && (m_compositorMutableProperties & property)) | 230 if (m_connected && (m_compositorMutableProperties & property)) |
| 230 return false; | 231 return false; |
| 231 exceptionState.throwDOMException(NoModificationAllowedError, | 232 exceptionState.throwDOMException(NoModificationAllowedError, |
| 232 m_connected ? "Attempted to mutate non-mutable attribute." : "Attempted to mutate attribute on a disconnected proxy."); | 233 m_connected ? "Attempted to mutate non-mutable attribute." : "Attempted to mutate attribute on a disconnected proxy."); |
| 233 return true; | 234 return true; |
| 234 } | 235 } |
| 235 | 236 |
| 236 void CompositorProxy::disconnect() | 237 void CompositorProxy::disconnect() |
| 237 { | 238 { |
| 238 m_connected = false; | 239 m_connected = false; |
| 239 if (isMainThread()) | 240 if (isMainThread()) |
| 240 decrementCompositorProxiedPropertiesForElement(m_elementId, m_compositor MutableProperties); | 241 decrementCompositorProxiedPropertiesForElement(m_elementId, m_compositor MutableProperties); |
| 241 else | 242 else |
| 242 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HER E, threadSafeBind(&decrementCompositorProxiedPropertiesForElement, m_elementId, m_compositorMutableProperties)); | 243 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HER E, threadSafeBind(&decrementCompositorProxiedPropertiesForElement, m_elementId, m_compositorMutableProperties)); |
| 243 } | 244 } |
| 244 | 245 |
| 245 } // namespace blink | 246 } // namespace blink |
| OLD | NEW |