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