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 // An identifier for CompositorProxy objects. Will be unique across all proxies |
| 24 // created in the same thread. |
| 25 uint64_t uniqueId = 0; |
| 26 } // namespace |
22 | 27 |
23 static const struct { | 28 static const struct { |
24 const char* name; | 29 const char* name; |
25 uint32_t property; | 30 uint32_t property; |
26 } allowedProperties[] = { | 31 } allowedProperties[] = { |
27 {"opacity", CompositorMutableProperty::kOpacity}, | 32 {"opacity", CompositorMutableProperty::kOpacity}, |
28 {"scrollleft", CompositorMutableProperty::kScrollLeft}, | 33 {"scrollleft", CompositorMutableProperty::kScrollLeft}, |
29 {"scrolltop", CompositorMutableProperty::kScrollTop}, | 34 {"scrolltop", CompositorMutableProperty::kScrollTop}, |
30 {"transform", CompositorMutableProperty::kTransform}, | 35 {"transform", CompositorMutableProperty::kTransform}, |
31 }; | 36 }; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 CompositorWorkerProxyClient::from(clients); | 133 CompositorWorkerProxyClient::from(clients); |
129 return new CompositorProxy(elementId, compositorMutableProperties, client); | 134 return new CompositorProxy(elementId, compositorMutableProperties, client); |
130 } | 135 } |
131 | 136 |
132 return new CompositorProxy(elementId, compositorMutableProperties); | 137 return new CompositorProxy(elementId, compositorMutableProperties); |
133 } | 138 } |
134 | 139 |
135 CompositorProxy::CompositorProxy(uint64_t elementId, | 140 CompositorProxy::CompositorProxy(uint64_t elementId, |
136 uint32_t compositorMutableProperties) | 141 uint32_t compositorMutableProperties) |
137 : m_elementId(elementId), | 142 : m_elementId(elementId), |
| 143 m_proxyId(uniqueId++), |
138 m_compositorMutableProperties(compositorMutableProperties), | 144 m_compositorMutableProperties(compositorMutableProperties), |
139 m_client(nullptr) { | 145 m_client(nullptr) { |
140 DCHECK(m_compositorMutableProperties); | 146 DCHECK(m_compositorMutableProperties); |
141 #if DCHECK_IS_ON() | 147 #if DCHECK_IS_ON() |
142 DCHECK(sanityCheckMutableProperties(m_compositorMutableProperties)); | 148 DCHECK(sanityCheckMutableProperties(m_compositorMutableProperties)); |
143 #endif | 149 #endif |
144 | 150 |
145 if (isMainThread()) { | 151 if (isMainThread()) { |
146 incrementCompositorProxiedPropertiesForElement( | 152 incrementCompositorProxiedPropertiesForElement( |
147 m_elementId, m_compositorMutableProperties); | 153 m_elementId, m_compositorMutableProperties); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 m_elementId, m_compositorMutableProperties); | 305 m_elementId, m_compositorMutableProperties); |
300 } else { | 306 } else { |
301 Platform::current()->mainThread()->getWebTaskRunner()->postTask( | 307 Platform::current()->mainThread()->getWebTaskRunner()->postTask( |
302 BLINK_FROM_HERE, | 308 BLINK_FROM_HERE, |
303 crossThreadBind(&decrementCompositorProxiedPropertiesForElement, | 309 crossThreadBind(&decrementCompositorProxiedPropertiesForElement, |
304 m_elementId, m_compositorMutableProperties)); | 310 m_elementId, m_compositorMutableProperties)); |
305 } | 311 } |
306 } | 312 } |
307 | 313 |
308 } // namespace blink | 314 } // namespace blink |
OLD | NEW |