| 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" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 | 120 |
| 121 CompositorProxy* CompositorProxy::create(ExecutionContext* context, | 121 CompositorProxy* CompositorProxy::create(ExecutionContext* context, |
| 122 uint64_t elementId, | 122 uint64_t elementId, |
| 123 uint32_t compositorMutableProperties) { | 123 uint32_t compositorMutableProperties) { |
| 124 if (context->isCompositorWorkerGlobalScope()) { | 124 if (context->isCompositorWorkerGlobalScope()) { |
| 125 WorkerClients* clients = toWorkerGlobalScope(context)->clients(); | 125 WorkerClients* clients = toWorkerGlobalScope(context)->clients(); |
| 126 DCHECK(clients); | 126 DCHECK(clients); |
| 127 CompositorWorkerProxyClient* client = | 127 CompositorWorkerProxyClient* client = |
| 128 CompositorWorkerProxyClient::from(clients); | 128 CompositorWorkerProxyClient::from(clients); |
| 129 return new CompositorProxy(elementId, compositorMutableProperties, client); | 129 return new CompositorProxy(elementId, compositorMutableProperties, |
| 130 client->compositorProxyClient()); |
| 130 } | 131 } |
| 131 | 132 |
| 132 return new CompositorProxy(elementId, compositorMutableProperties); | 133 return new CompositorProxy(elementId, compositorMutableProperties); |
| 133 } | 134 } |
| 134 | 135 |
| 135 CompositorProxy::CompositorProxy(uint64_t elementId, | 136 CompositorProxy::CompositorProxy(uint64_t elementId, |
| 136 uint32_t compositorMutableProperties) | 137 uint32_t compositorMutableProperties) |
| 137 : m_elementId(elementId), | 138 : m_elementId(elementId), |
| 138 m_compositorMutableProperties(compositorMutableProperties), | 139 m_compositorMutableProperties(compositorMutableProperties), |
| 139 m_client(nullptr) { | 140 m_client(nullptr) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 172 } |
| 172 | 173 |
| 173 CompositorProxy::~CompositorProxy() { | 174 CompositorProxy::~CompositorProxy() { |
| 174 // We do not explicitly unregister from client here. The client has a weak | 175 // We do not explicitly unregister from client here. The client has a weak |
| 175 // reference to us which gets collected on its own. This way we avoid using | 176 // reference to us which gets collected on its own. This way we avoid using |
| 176 // a pre-finalizer. | 177 // a pre-finalizer. |
| 177 disconnectInternal(); | 178 disconnectInternal(); |
| 178 DCHECK(!m_connected); | 179 DCHECK(!m_connected); |
| 179 } | 180 } |
| 180 | 181 |
| 182 DEFINE_TRACE(CompositorProxy) { |
| 183 visitor->trace(m_client); |
| 184 } |
| 185 |
| 181 bool CompositorProxy::supports(const String& attributeName) const { | 186 bool CompositorProxy::supports(const String& attributeName) const { |
| 182 return m_compositorMutableProperties & | 187 return m_compositorMutableProperties & |
| 183 compositorMutablePropertyForName(attributeName); | 188 compositorMutablePropertyForName(attributeName); |
| 184 } | 189 } |
| 185 | 190 |
| 186 double CompositorProxy::opacity(ExceptionState& exceptionState) const { | 191 double CompositorProxy::opacity(ExceptionState& exceptionState) const { |
| 187 if (raiseExceptionIfMutationNotAllowed(exceptionState)) | 192 if (raiseExceptionIfMutationNotAllowed(exceptionState)) |
| 188 return 0.0; | 193 return 0.0; |
| 189 if (raiseExceptionIfNotMutable(CompositorMutableProperty::kOpacity, | 194 if (raiseExceptionIfNotMutable(CompositorMutableProperty::kOpacity, |
| 190 exceptionState)) | 195 exceptionState)) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 m_elementId, m_compositorMutableProperties); | 304 m_elementId, m_compositorMutableProperties); |
| 300 } else { | 305 } else { |
| 301 Platform::current()->mainThread()->getWebTaskRunner()->postTask( | 306 Platform::current()->mainThread()->getWebTaskRunner()->postTask( |
| 302 BLINK_FROM_HERE, | 307 BLINK_FROM_HERE, |
| 303 crossThreadBind(&decrementCompositorProxiedPropertiesForElement, | 308 crossThreadBind(&decrementCompositorProxiedPropertiesForElement, |
| 304 m_elementId, m_compositorMutableProperties)); | 309 m_elementId, m_compositorMutableProperties)); |
| 305 } | 310 } |
| 306 } | 311 } |
| 307 | 312 |
| 308 } // namespace blink | 313 } // namespace blink |
| OLD | NEW |