| 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/CompositorWorkerProxyClient.h" | 9 #include "core/dom/CompositorWorkerProxyClient.h" |
| 10 #include "core/dom/DOMNodeIds.h" | 10 #include "core/dom/DOMNodeIds.h" |
| 11 #include "core/dom/ExceptionCode.h" | 11 #include "core/dom/ExceptionCode.h" |
| 12 #include "core/dom/ExecutionContext.h" | 12 #include "core/dom/ExecutionContext.h" |
| 13 #include "core/workers/WorkerClients.h" | 13 #include "core/workers/WorkerClients.h" |
| 14 #include "core/workers/WorkerGlobalScope.h" | 14 #include "core/workers/WorkerGlobalScope.h" |
| 15 #include "platform/CrossThreadFunctional.h" | 15 #include "platform/CrossThreadFunctional.h" |
| 16 #include "platform/graphics/CompositorMutableProperties.h" | 16 #include "platform/graphics/CompositorMutableProperties.h" |
| 17 #include "public/platform/Platform.h" | 17 #include "public/platform/Platform.h" |
| 18 #include "public/platform/WebTraceLocation.h" | 18 #include "public/platform/WebTraceLocation.h" |
| 19 #include <algorithm> | 19 #include <algorithm> |
| 20 | 20 |
| 21 namespace blink { | 21 namespace blink { |
| 22 namespace { |
| 23 uint64_t uniqueId = 0; |
| 24 } // namespace |
| 22 | 25 |
| 23 static const struct { | 26 static const struct { |
| 24 const char* name; | 27 const char* name; |
| 25 uint32_t property; | 28 uint32_t property; |
| 26 } allowedProperties[] = { | 29 } allowedProperties[] = { |
| 27 {"opacity", CompositorMutableProperty::kOpacity}, | 30 {"opacity", CompositorMutableProperty::kOpacity}, |
| 28 {"scrollleft", CompositorMutableProperty::kScrollLeft}, | 31 {"scrollleft", CompositorMutableProperty::kScrollLeft}, |
| 29 {"scrolltop", CompositorMutableProperty::kScrollTop}, | 32 {"scrolltop", CompositorMutableProperty::kScrollTop}, |
| 30 {"transform", CompositorMutableProperty::kTransform}, | 33 {"transform", CompositorMutableProperty::kTransform}, |
| 31 }; | 34 }; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 CompositorWorkerProxyClient::from(clients); | 131 CompositorWorkerProxyClient::from(clients); |
| 129 return new CompositorProxy(elementId, compositorMutableProperties, client); | 132 return new CompositorProxy(elementId, compositorMutableProperties, client); |
| 130 } | 133 } |
| 131 | 134 |
| 132 return new CompositorProxy(elementId, compositorMutableProperties); | 135 return new CompositorProxy(elementId, compositorMutableProperties); |
| 133 } | 136 } |
| 134 | 137 |
| 135 CompositorProxy::CompositorProxy(uint64_t elementId, | 138 CompositorProxy::CompositorProxy(uint64_t elementId, |
| 136 uint32_t compositorMutableProperties) | 139 uint32_t compositorMutableProperties) |
| 137 : m_elementId(elementId), | 140 : m_elementId(elementId), |
| 141 m_proxyId(uniqueId++), |
| 138 m_compositorMutableProperties(compositorMutableProperties), | 142 m_compositorMutableProperties(compositorMutableProperties), |
| 139 m_client(nullptr) { | 143 m_client(nullptr) { |
| 140 DCHECK(m_compositorMutableProperties); | 144 DCHECK(m_compositorMutableProperties); |
| 141 #if DCHECK_IS_ON() | 145 #if DCHECK_IS_ON() |
| 142 DCHECK(sanityCheckMutableProperties(m_compositorMutableProperties)); | 146 DCHECK(sanityCheckMutableProperties(m_compositorMutableProperties)); |
| 143 #endif | 147 #endif |
| 144 | 148 |
| 145 if (isMainThread()) { | 149 if (isMainThread()) { |
| 146 incrementCompositorProxiedPropertiesForElement( | 150 incrementCompositorProxiedPropertiesForElement( |
| 147 m_elementId, m_compositorMutableProperties); | 151 m_elementId, m_compositorMutableProperties); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 m_elementId, m_compositorMutableProperties); | 303 m_elementId, m_compositorMutableProperties); |
| 300 } else { | 304 } else { |
| 301 Platform::current()->mainThread()->getWebTaskRunner()->postTask( | 305 Platform::current()->mainThread()->getWebTaskRunner()->postTask( |
| 302 BLINK_FROM_HERE, | 306 BLINK_FROM_HERE, |
| 303 crossThreadBind(&decrementCompositorProxiedPropertiesForElement, | 307 crossThreadBind(&decrementCompositorProxiedPropertiesForElement, |
| 304 m_elementId, m_compositorMutableProperties)); | 308 m_elementId, m_compositorMutableProperties)); |
| 305 } | 309 } |
| 306 } | 310 } |
| 307 | 311 |
| 308 } // namespace blink | 312 } // namespace blink |
| OLD | NEW |