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 CC_THREAD_PROXY_H_ | 5 #ifndef CC_THREAD_PROXY_H_ |
6 #define CC_THREAD_PROXY_H_ | 6 #define CC_THREAD_PROXY_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "cc/animation_events.h" | 11 #include "cc/animation_events.h" |
12 #include "cc/completion_event.h" | 12 #include "cc/completion_event.h" |
13 #include "cc/layer_tree_host_impl.h" | 13 #include "cc/layer_tree_host_impl.h" |
14 #include "cc/proxy.h" | 14 #include "cc/proxy.h" |
15 #include "cc/resource_update_controller.h" | 15 #include "cc/resource_update_controller.h" |
16 #include "cc/scheduler.h" | 16 #include "cc/scheduler.h" |
17 | 17 |
| 18 namespace ui { |
| 19 class ContextProvider; |
| 20 } |
| 21 |
18 namespace cc { | 22 namespace cc { |
19 | 23 |
20 class InputHandler; | 24 class InputHandler; |
21 class LayerTreeHost; | 25 class LayerTreeHost; |
22 class ResourceUpdateQueue; | 26 class ResourceUpdateQueue; |
23 class Scheduler; | 27 class Scheduler; |
24 class ScopedThreadProxy; | 28 class ScopedThreadProxy; |
25 class Thread; | 29 class Thread; |
26 | 30 |
27 class ThreadProxy : public Proxy, LayerTreeHostImplClient, SchedulerClient, Reso
urceUpdateControllerClient { | 31 class ThreadProxy : public Proxy, LayerTreeHostImplClient, SchedulerClient, Reso
urceUpdateControllerClient { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 CompletionEvent completion; | 120 CompletionEvent completion; |
117 bool success; | 121 bool success; |
118 void* pixels; | 122 void* pixels; |
119 gfx::Rect rect; | 123 gfx::Rect rect; |
120 }; | 124 }; |
121 struct CommitPendingRequest { | 125 struct CommitPendingRequest { |
122 CompletionEvent completion; | 126 CompletionEvent completion; |
123 bool commitPending; | 127 bool commitPending; |
124 }; | 128 }; |
125 void forceBeginFrameOnImplThread(CompletionEvent*); | 129 void forceBeginFrameOnImplThread(CompletionEvent*); |
126 void beginFrameCompleteOnImplThread(CompletionEvent*, ResourceUpdateQueue*); | 130 void beginFrameCompleteOnImplThread(CompletionEvent*, ResourceUpdateQueue*,
scoped_refptr<ui::ContextProvider> offscreenContextProvider); |
127 void beginFrameAbortedOnImplThread(); | 131 void beginFrameAbortedOnImplThread(); |
128 void requestReadbackOnImplThread(ReadbackRequest*); | 132 void requestReadbackOnImplThread(ReadbackRequest*); |
129 void requestStartPageScaleAnimationOnImplThread(gfx::Vector2d targetOffset,
bool useAnchor, float scale, base::TimeDelta duration); | 133 void requestStartPageScaleAnimationOnImplThread(gfx::Vector2d targetOffset,
bool useAnchor, float scale, base::TimeDelta duration); |
130 void finishAllRenderingOnImplThread(CompletionEvent*); | 134 void finishAllRenderingOnImplThread(CompletionEvent*); |
131 void initializeImplOnImplThread(CompletionEvent*, InputHandler*); | 135 void initializeImplOnImplThread(CompletionEvent*, InputHandler*); |
132 void setSurfaceReadyOnImplThread(); | 136 void setSurfaceReadyOnImplThread(); |
133 void setVisibleOnImplThread(CompletionEvent*, bool); | 137 void setVisibleOnImplThread(CompletionEvent*, bool); |
134 void initializeOutputSurfaceOnImplThread(scoped_ptr<OutputSurface>); | 138 void initializeOutputSurfaceOnImplThread(scoped_ptr<OutputSurface>); |
135 void initializeRendererOnImplThread(CompletionEvent*, bool* initializeSuccee
ded, RendererCapabilities*); | 139 void initializeRendererOnImplThread(CompletionEvent*, bool* initializeSuccee
ded, RendererCapabilities*); |
136 void layerTreeHostClosedOnImplThread(CompletionEvent*); | 140 void layerTreeHostClosedOnImplThread(CompletionEvent*); |
137 void manageTilesOnImplThread(); | 141 void manageTilesOnImplThread(); |
138 void setFullRootLayerDamageOnImplThread(); | 142 void setFullRootLayerDamageOnImplThread(); |
139 void acquireLayerTexturesForMainThreadOnImplThread(CompletionEvent*); | 143 void acquireLayerTexturesForMainThreadOnImplThread(CompletionEvent*); |
140 void recreateOutputSurfaceOnImplThread(CompletionEvent*, scoped_ptr<OutputSu
rface>, bool* recreateSucceeded, RendererCapabilities*); | 144 void recreateOutputSurfaceOnImplThread(CompletionEvent*, scoped_ptr<OutputSu
rface>, scoped_refptr<ui::ContextProvider> offscreenContextProvider, bool* recre
ateSucceeded, RendererCapabilities*); |
141 void renderingStatsOnImplThread(CompletionEvent*, RenderingStats*); | 145 void renderingStatsOnImplThread(CompletionEvent*, RenderingStats*); |
142 ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool for
cedDraw); | 146 ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool for
cedDraw); |
143 void forceSerializeOnSwapBuffersOnImplThread(CompletionEvent*); | 147 void forceSerializeOnSwapBuffersOnImplThread(CompletionEvent*); |
144 void setNeedsForcedCommitOnImplThread(); | 148 void setNeedsForcedCommitOnImplThread(); |
145 void checkOutputSurfaceStatusOnImplThread(); | 149 void checkOutputSurfaceStatusOnImplThread(); |
146 void commitPendingOnImplThreadForTesting(CommitPendingRequest* request); | 150 void commitPendingOnImplThreadForTesting(CommitPendingRequest* request); |
147 void capturePictureOnImplThread(CompletionEvent*, skia::RefPtr<SkPicture>*); | 151 void capturePictureOnImplThread(CompletionEvent*, skia::RefPtr<SkPicture>*); |
148 void asValueOnImplThread(CompletionEvent*, base::DictionaryValue*) const; | 152 void asValueOnImplThread(CompletionEvent*, base::DictionaryValue*) const; |
149 void renewTreePriorityOnImplThread(); | 153 void renewTreePriorityOnImplThread(); |
150 void didSwapUseIncompleteTileOnImplThread(); | 154 void didSwapUseIncompleteTileOnImplThread(); |
151 | 155 |
152 // Accessed on main thread only. | 156 // Accessed on main thread only. |
153 bool m_animateRequested; // Set only when setNeedsAnimate is called. | 157 bool m_animateRequested; // Set only when setNeedsAnimate is called. |
154 bool m_commitRequested; // Set only when setNeedsCommit is called. | 158 bool m_commitRequested; // Set only when setNeedsCommit is called. |
155 bool m_commitRequestSentToImplThread; // Set by setNeedsCommit and setNeedsA
nimate. | 159 bool m_commitRequestSentToImplThread; // Set by setNeedsCommit and setNeedsA
nimate. |
| 160 bool m_createdOffscreenContextProvider; // Set by beginFrame. |
156 base::CancelableClosure m_outputSurfaceRecreationCallback; | 161 base::CancelableClosure m_outputSurfaceRecreationCallback; |
157 LayerTreeHost* m_layerTreeHost; | 162 LayerTreeHost* m_layerTreeHost; |
158 bool m_rendererInitialized; | 163 bool m_rendererInitialized; |
159 RendererCapabilities m_RendererCapabilitiesMainThreadCopy; | 164 RendererCapabilities m_RendererCapabilitiesMainThreadCopy; |
160 bool m_started; | 165 bool m_started; |
161 bool m_texturesAcquired; | 166 bool m_texturesAcquired; |
162 bool m_inCompositeAndReadback; | 167 bool m_inCompositeAndReadback; |
163 bool m_manageTilesPending; | 168 bool m_manageTilesPending; |
164 // Weak pointer to use when posting tasks to the impl thread. | 169 // Weak pointer to use when posting tasks to the impl thread. |
165 base::WeakPtr<ThreadProxy> m_implThreadWeakPtr; | 170 base::WeakPtr<ThreadProxy> m_implThreadWeakPtr; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 bool m_deferCommits; | 214 bool m_deferCommits; |
210 scoped_ptr<BeginFrameAndCommitState> m_pendingDeferredCommit; | 215 scoped_ptr<BeginFrameAndCommitState> m_pendingDeferredCommit; |
211 | 216 |
212 base::TimeTicks m_smoothnessTakesPriorityExpirationTime; | 217 base::TimeTicks m_smoothnessTakesPriorityExpirationTime; |
213 bool m_renewTreePriorityOnImplThreadPending; | 218 bool m_renewTreePriorityOnImplThreadPending; |
214 }; | 219 }; |
215 | 220 |
216 } // namespace cc | 221 } // namespace cc |
217 | 222 |
218 #endif // CC_THREAD_PROXY_H_ | 223 #endif // CC_THREAD_PROXY_H_ |
OLD | NEW |