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 #ifndef CompositorProxy_h | 5 #ifndef CompositorProxy_h |
6 #define CompositorProxy_h | 6 #define CompositorProxy_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "core/dom/CompositorProxyClient.h" | 10 #include "core/dom/CompositorProxyClient.h" |
11 #include "core/dom/DOMMatrix.h" | 11 #include "core/dom/DOMMatrix.h" |
12 #include "core/dom/Element.h" | 12 #include "core/dom/Element.h" |
| 13 #include "platform/graphics/CompositorMutableState.h" |
13 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
14 #include "wtf/text/WTFString.h" | 15 #include "wtf/text/WTFString.h" |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 | 18 |
18 class DOMMatrix; | 19 class DOMMatrix; |
19 class ExceptionState; | 20 class ExceptionState; |
20 class ExecutionContext; | 21 class ExecutionContext; |
21 | 22 |
22 class CORE_EXPORT CompositorProxy final : public GarbageCollectedFinalized<Compo
sitorProxy>, public ScriptWrappable { | 23 class CORE_EXPORT CompositorProxy final : public GarbageCollectedFinalized<Compo
sitorProxy>, public ScriptWrappable { |
23 DEFINE_WRAPPERTYPEINFO(); | 24 DEFINE_WRAPPERTYPEINFO(); |
24 public: | 25 public: |
25 static CompositorProxy* create(ExecutionContext*, Element*, const Vector<Str
ing>& attributeArray, ExceptionState&); | 26 static CompositorProxy* create(ExecutionContext*, Element*, const Vector<Str
ing>& attributeArray, ExceptionState&); |
26 static CompositorProxy* create(ExecutionContext*, uint64_t element, uint32_t
compositorMutableProperties); | 27 static CompositorProxy* create(ExecutionContext*, uint64_t element, uint32_t
compositorMutableProperties); |
27 virtual ~CompositorProxy(); | 28 virtual ~CompositorProxy(); |
28 | 29 |
29 DEFINE_INLINE_TRACE() | 30 DEFINE_INLINE_TRACE() |
30 { | 31 { |
31 visitor->trace(m_transform); | |
32 visitor->trace(m_client); | 32 visitor->trace(m_client); |
33 } | 33 } |
34 | 34 |
35 uint64_t elementId() const { return m_elementId; } | 35 uint64_t elementId() const { return m_elementId; } |
36 uint32_t compositorMutableProperties() const { return m_compositorMutablePro
perties; } | 36 uint32_t compositorMutableProperties() const { return m_compositorMutablePro
perties; } |
37 bool supports(const String& attribute) const; | 37 bool supports(const String& attribute) const; |
38 | 38 |
| 39 bool initialized() const { return m_connected && m_state.get(); } |
39 bool connected() const { return m_connected; } | 40 bool connected() const { return m_connected; } |
40 void disconnect(); | 41 void disconnect(); |
41 | 42 |
42 double opacity(ExceptionState&) const; | 43 double opacity(ExceptionState&) const; |
43 double scrollLeft(ExceptionState&) const; | 44 double scrollLeft(ExceptionState&) const; |
44 double scrollTop(ExceptionState&) const; | 45 double scrollTop(ExceptionState&) const; |
45 DOMMatrix* transform(ExceptionState&) const; | 46 DOMMatrix* transform(ExceptionState&) const; |
46 | 47 |
47 void setOpacity(double, ExceptionState&); | 48 void setOpacity(double, ExceptionState&); |
48 void setScrollLeft(double, ExceptionState&); | 49 void setScrollLeft(double, ExceptionState&); |
49 void setScrollTop(double, ExceptionState&); | 50 void setScrollTop(double, ExceptionState&); |
50 void setTransform(DOMMatrix*, ExceptionState&); | 51 void setTransform(DOMMatrix*, ExceptionState&); |
51 | 52 |
| 53 void takeCompositorMutableState(std::unique_ptr<CompositorMutableState>); |
| 54 |
52 protected: | 55 protected: |
53 CompositorProxy(uint64_t elementId, uint32_t compositorMutableProperties); | 56 CompositorProxy(uint64_t elementId, uint32_t compositorMutableProperties); |
54 CompositorProxy(Element&, const Vector<String>& attributeArray); | 57 CompositorProxy(Element&, const Vector<String>& attributeArray); |
55 CompositorProxy(uint64_t element, uint32_t compositorMutableProperties, Comp
ositorProxyClient*); | 58 CompositorProxy(uint64_t element, uint32_t compositorMutableProperties, Comp
ositorProxyClient*); |
56 | 59 |
57 private: | 60 private: |
58 bool raiseExceptionIfNotMutable(uint32_t compositorMutableProperty, Exceptio
nState&) const; | 61 bool raiseExceptionIfNotMutable(uint32_t compositorMutableProperty, Exceptio
nState&) const; |
59 void disconnectInternal(); | 62 void disconnectInternal(); |
60 | 63 |
61 const uint64_t m_elementId = 0; | 64 const uint64_t m_elementId = 0; |
62 const uint32_t m_compositorMutableProperties = 0; | 65 const uint32_t m_compositorMutableProperties = 0; |
63 uint32_t m_mutatedProperties = 0; | |
64 | |
65 double m_opacity = 0; | |
66 double m_scrollLeft = 0; | |
67 double m_scrollTop = 0; | |
68 Member<DOMMatrix> m_transform; | |
69 | 66 |
70 bool m_connected = true; | 67 bool m_connected = true; |
71 Member<CompositorProxyClient> m_client; | 68 Member<CompositorProxyClient> m_client; |
| 69 std::unique_ptr<CompositorMutableState> m_state; |
72 }; | 70 }; |
73 | 71 |
74 } // namespace blink | 72 } // namespace blink |
75 | 73 |
76 #endif // CompositorProxy_h | 74 #endif // CompositorProxy_h |
OLD | NEW |