OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CCThreadProxy_h | 5 #ifndef CCThreadProxy_h |
6 #define CCThreadProxy_h | 6 #define CCThreadProxy_h |
7 | 7 |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "cc/animation_events.h" | 9 #include "cc/animation_events.h" |
10 #include "cc/completion_event.h" | 10 #include "cc/completion_event.h" |
11 #include "cc/layer_tree_host_impl.h" | 11 #include "cc/layer_tree_host_impl.h" |
12 #include "cc/proxy.h" | 12 #include "cc/proxy.h" |
| 13 #include "cc/resource_update_controller.h" |
13 #include "cc/scheduler.h" | 14 #include "cc/scheduler.h" |
14 #include "cc/texture_update_controller.h" | |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 class InputHandler; | 18 class InputHandler; |
19 class LayerTreeHost; | 19 class LayerTreeHost; |
| 20 class ResourceUpdateQueue; |
20 class Scheduler; | 21 class Scheduler; |
21 class ScopedThreadProxy; | 22 class ScopedThreadProxy; |
22 class TextureUpdateQueue; | |
23 class Thread; | 23 class Thread; |
24 class ThreadProxyContextRecreationTimer; | 24 class ThreadProxyContextRecreationTimer; |
25 | 25 |
26 class ThreadProxy : public Proxy, LayerTreeHostImplClient, SchedulerClient, Text
ureUpdateControllerClient { | 26 class ThreadProxy : public Proxy, LayerTreeHostImplClient, SchedulerClient, Reso
urceUpdateControllerClient { |
27 public: | 27 public: |
28 static scoped_ptr<Proxy> create(LayerTreeHost*); | 28 static scoped_ptr<Proxy> create(LayerTreeHost*); |
29 | 29 |
30 virtual ~ThreadProxy(); | 30 virtual ~ThreadProxy(); |
31 | 31 |
32 // Proxy implementation | 32 // Proxy implementation |
33 virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE; | 33 virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE; |
34 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool use
Anchor, float scale, double duration) OVERRIDE; | 34 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool use
Anchor, float scale, double duration) OVERRIDE; |
35 virtual void finishAllRendering() OVERRIDE; | 35 virtual void finishAllRendering() OVERRIDE; |
36 virtual bool isStarted() const OVERRIDE; | 36 virtual bool isStarted() const OVERRIDE; |
(...skipping 28 matching lines...) Expand all Loading... |
65 | 65 |
66 // SchedulerClient implementation | 66 // SchedulerClient implementation |
67 virtual void scheduledActionBeginFrame() OVERRIDE; | 67 virtual void scheduledActionBeginFrame() OVERRIDE; |
68 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossibl
e() OVERRIDE; | 68 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossibl
e() OVERRIDE; |
69 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced()
OVERRIDE; | 69 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced()
OVERRIDE; |
70 virtual void scheduledActionCommit() OVERRIDE; | 70 virtual void scheduledActionCommit() OVERRIDE; |
71 virtual void scheduledActionBeginContextRecreation() OVERRIDE; | 71 virtual void scheduledActionBeginContextRecreation() OVERRIDE; |
72 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; | 72 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; |
73 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE; | 73 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE; |
74 | 74 |
75 // TextureUpdateControllerClient implementation | 75 // ResourceUpdateControllerClient implementation |
76 virtual void readyToFinalizeTextureUpdates() OVERRIDE; | 76 virtual void readyToFinalizeTextureUpdates() OVERRIDE; |
77 | 77 |
78 private: | 78 private: |
79 explicit ThreadProxy(LayerTreeHost*); | 79 explicit ThreadProxy(LayerTreeHost*); |
80 friend class ThreadProxyContextRecreationTimer; | 80 friend class ThreadProxyContextRecreationTimer; |
81 | 81 |
82 // Set on impl thread, read on main thread. | 82 // Set on impl thread, read on main thread. |
83 struct BeginFrameAndCommitState { | 83 struct BeginFrameAndCommitState { |
84 BeginFrameAndCommitState(); | 84 BeginFrameAndCommitState(); |
85 ~BeginFrameAndCommitState(); | 85 ~BeginFrameAndCommitState(); |
(...skipping 15 matching lines...) Expand all Loading... |
101 void tryToRecreateContext(); | 101 void tryToRecreateContext(); |
102 | 102 |
103 // Called on impl thread | 103 // Called on impl thread |
104 struct ReadbackRequest { | 104 struct ReadbackRequest { |
105 CompletionEvent completion; | 105 CompletionEvent completion; |
106 bool success; | 106 bool success; |
107 void* pixels; | 107 void* pixels; |
108 IntRect rect; | 108 IntRect rect; |
109 }; | 109 }; |
110 void forceBeginFrameOnImplThread(CompletionEvent*); | 110 void forceBeginFrameOnImplThread(CompletionEvent*); |
111 void beginFrameCompleteOnImplThread(CompletionEvent*, TextureUpdateQueue*); | 111 void beginFrameCompleteOnImplThread(CompletionEvent*, ResourceUpdateQueue*); |
112 void beginFrameAbortedOnImplThread(); | 112 void beginFrameAbortedOnImplThread(); |
113 void requestReadbackOnImplThread(ReadbackRequest*); | 113 void requestReadbackOnImplThread(ReadbackRequest*); |
114 void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool
useAnchor, float scale, double durationSec); | 114 void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool
useAnchor, float scale, double durationSec); |
115 void finishAllRenderingOnImplThread(CompletionEvent*); | 115 void finishAllRenderingOnImplThread(CompletionEvent*); |
116 void initializeImplOnImplThread(CompletionEvent*, InputHandler*); | 116 void initializeImplOnImplThread(CompletionEvent*, InputHandler*); |
117 void setSurfaceReadyOnImplThread(); | 117 void setSurfaceReadyOnImplThread(); |
118 void setVisibleOnImplThread(CompletionEvent*, bool); | 118 void setVisibleOnImplThread(CompletionEvent*, bool); |
119 void initializeContextOnImplThread(GraphicsContext*); | 119 void initializeContextOnImplThread(GraphicsContext*); |
120 void initializeRendererOnImplThread(CompletionEvent*, bool* initializeSuccee
ded, RendererCapabilities*); | 120 void initializeRendererOnImplThread(CompletionEvent*, bool* initializeSuccee
ded, RendererCapabilities*); |
121 void layerTreeHostClosedOnImplThread(CompletionEvent*); | 121 void layerTreeHostClosedOnImplThread(CompletionEvent*); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 // Set when the main thread is waiting on a readback. | 158 // Set when the main thread is waiting on a readback. |
159 ReadbackRequest* m_readbackRequestOnImplThread; | 159 ReadbackRequest* m_readbackRequestOnImplThread; |
160 | 160 |
161 // Set when the main thread is waiting on a commit to complete. | 161 // Set when the main thread is waiting on a commit to complete. |
162 CompletionEvent* m_commitCompletionEventOnImplThread; | 162 CompletionEvent* m_commitCompletionEventOnImplThread; |
163 | 163 |
164 // Set when the main thread is waiting on layers to be drawn. | 164 // Set when the main thread is waiting on layers to be drawn. |
165 CompletionEvent* m_textureAcquisitionCompletionEventOnImplThread; | 165 CompletionEvent* m_textureAcquisitionCompletionEventOnImplThread; |
166 | 166 |
167 scoped_ptr<TextureUpdateController> m_currentTextureUpdateControllerOnImplTh
read; | 167 scoped_ptr<ResourceUpdateController> m_currentResourceUpdateControllerOnImpl
Thread; |
168 | 168 |
169 // Set when the next draw should post didCommitAndDrawFrame to the main thre
ad. | 169 // Set when the next draw should post didCommitAndDrawFrame to the main thre
ad. |
170 bool m_nextFrameIsNewlyCommittedFrameOnImplThread; | 170 bool m_nextFrameIsNewlyCommittedFrameOnImplThread; |
171 | 171 |
172 bool m_renderVSyncEnabled; | 172 bool m_renderVSyncEnabled; |
173 | 173 |
174 base::TimeDelta m_totalCommitTime; | 174 base::TimeDelta m_totalCommitTime; |
175 size_t m_totalCommitCount; | 175 size_t m_totalCommitCount; |
176 }; | 176 }; |
177 | 177 |
178 } | 178 } |
179 | 179 |
180 #endif | 180 #endif |
OLD | NEW |