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