| 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 #include "cc/vsync_time_source.h" |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 | 20 |
| 20 class InputHandler; | 21 class InputHandler; |
| 21 class LayerTreeHost; | 22 class LayerTreeHost; |
| 22 class ResourceUpdateQueue; | 23 class ResourceUpdateQueue; |
| 23 class Scheduler; | 24 class Scheduler; |
| 24 class ScopedThreadProxy; | 25 class ScopedThreadProxy; |
| 25 class Thread; | 26 class Thread; |
| 26 | 27 |
| 27 class ThreadProxy : public Proxy, LayerTreeHostImplClient, SchedulerClient, Reso
urceUpdateControllerClient { | 28 class ThreadProxy : public Proxy, LayerTreeHostImplClient, SchedulerClient, Reso
urceUpdateControllerClient, VSyncProvider { |
| 28 public: | 29 public: |
| 29 static scoped_ptr<Proxy> create(LayerTreeHost*, scoped_ptr<Thread> implThrea
d); | 30 static scoped_ptr<Proxy> create(LayerTreeHost*, scoped_ptr<Thread> implThrea
d); |
| 30 | 31 |
| 31 virtual ~ThreadProxy(); | 32 virtual ~ThreadProxy(); |
| 32 | 33 |
| 33 // Proxy implementation | 34 // Proxy implementation |
| 34 virtual bool compositeAndReadback(void *pixels, const gfx::Rect&) OVERRIDE; | 35 virtual bool compositeAndReadback(void *pixels, const gfx::Rect&) OVERRIDE; |
| 35 virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnc
hor, float scale, base::TimeDelta duration) OVERRIDE; | 36 virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnc
hor, float scale, base::TimeDelta duration) OVERRIDE; |
| 36 virtual void finishAllRendering() OVERRIDE; | 37 virtual void finishAllRendering() OVERRIDE; |
| 37 virtual bool isStarted() const OVERRIDE; | 38 virtual bool isStarted() const OVERRIDE; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 53 virtual size_t maxPartialTextureUpdates() const OVERRIDE; | 54 virtual size_t maxPartialTextureUpdates() const OVERRIDE; |
| 54 virtual void acquireLayerTextures() OVERRIDE; | 55 virtual void acquireLayerTextures() OVERRIDE; |
| 55 virtual void forceSerializeOnSwapBuffers() OVERRIDE; | 56 virtual void forceSerializeOnSwapBuffers() OVERRIDE; |
| 56 virtual bool commitPendingForTesting() OVERRIDE; | 57 virtual bool commitPendingForTesting() OVERRIDE; |
| 57 virtual skia::RefPtr<SkPicture> capturePicture() OVERRIDE; | 58 virtual skia::RefPtr<SkPicture> capturePicture() OVERRIDE; |
| 58 | 59 |
| 59 // LayerTreeHostImplClient implementation | 60 // LayerTreeHostImplClient implementation |
| 60 virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE; | 61 virtual void didLoseOutputSurfaceOnImplThread() OVERRIDE; |
| 61 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE; | 62 virtual void onSwapBuffersCompleteOnImplThread() OVERRIDE; |
| 62 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDe
lta interval) OVERRIDE; | 63 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDe
lta interval) OVERRIDE; |
| 64 virtual void didVSync(base::TimeTicks frameTime) OVERRIDE; |
| 63 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE; | 65 virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE; |
| 64 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE; | 66 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE; |
| 65 virtual void setNeedsRedrawOnImplThread() OVERRIDE; | 67 virtual void setNeedsRedrawOnImplThread() OVERRIDE; |
| 66 virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE; | 68 virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE; |
| 67 virtual void setNeedsCommitOnImplThread() OVERRIDE; | 69 virtual void setNeedsCommitOnImplThread() OVERRIDE; |
| 68 virtual void setNeedsManageTilesOnImplThread() OVERRIDE; | 70 virtual void setNeedsManageTilesOnImplThread() OVERRIDE; |
| 69 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) OVERRIDE; | 71 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<Animatio
nEventsVector>, base::Time wallClockTime) OVERRIDE; |
| 70 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) OVERRIDE; | 72 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int
priorityCutoff) OVERRIDE; |
| 71 virtual void reduceWastedContentsTextureMemoryOnImplThread() OVERRIDE; | 73 virtual void reduceWastedContentsTextureMemoryOnImplThread() OVERRIDE; |
| 72 virtual void sendManagedMemoryStats() OVERRIDE; | 74 virtual void sendManagedMemoryStats() OVERRIDE; |
| 73 virtual bool isInsideDraw() OVERRIDE; | 75 virtual bool isInsideDraw() OVERRIDE; |
| 74 virtual void renewTreePriority() OVERRIDE; | 76 virtual void renewTreePriority() OVERRIDE; |
| 75 | 77 |
| 76 // SchedulerClient implementation | 78 // SchedulerClient implementation |
| 77 virtual void scheduledActionBeginFrame() OVERRIDE; | 79 virtual void scheduledActionBeginFrame() OVERRIDE; |
| 78 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossibl
e() OVERRIDE; | 80 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapIfPossibl
e() OVERRIDE; |
| 79 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced()
OVERRIDE; | 81 virtual ScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapForced()
OVERRIDE; |
| 80 virtual void scheduledActionCommit() OVERRIDE; | 82 virtual void scheduledActionCommit() OVERRIDE; |
| 81 virtual void scheduledActionCheckForCompletedTileUploads() OVERRIDE; | 83 virtual void scheduledActionCheckForCompletedTileUploads() OVERRIDE; |
| 82 virtual void scheduledActionActivatePendingTreeIfNeeded() OVERRIDE; | 84 virtual void scheduledActionActivatePendingTreeIfNeeded() OVERRIDE; |
| 83 virtual void scheduledActionBeginContextRecreation() OVERRIDE; | 85 virtual void scheduledActionBeginContextRecreation() OVERRIDE; |
| 84 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; | 86 virtual void scheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; |
| 85 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE; | 87 virtual void didAnticipatedDrawTimeChange(base::TimeTicks) OVERRIDE; |
| 86 | 88 |
| 87 // ResourceUpdateControllerClient implementation | 89 // ResourceUpdateControllerClient implementation |
| 88 virtual void readyToFinalizeTextureUpdates() OVERRIDE; | 90 virtual void readyToFinalizeTextureUpdates() OVERRIDE; |
| 89 | 91 |
| 92 // VSyncProvider implementation |
| 93 virtual void RequestVSyncNotification(VSyncClient* client) OVERRIDE; |
| 94 |
| 90 int maxFramesPendingForTesting() const { return m_schedulerOnImplThread->max
FramesPending(); } | 95 int maxFramesPendingForTesting() const { return m_schedulerOnImplThread->max
FramesPending(); } |
| 91 | 96 |
| 92 private: | 97 private: |
| 93 ThreadProxy(LayerTreeHost*, scoped_ptr<Thread> implThread); | 98 ThreadProxy(LayerTreeHost*, scoped_ptr<Thread> implThread); |
| 94 | 99 |
| 95 struct BeginFrameAndCommitState { | 100 struct BeginFrameAndCommitState { |
| 96 BeginFrameAndCommitState(); | 101 BeginFrameAndCommitState(); |
| 97 ~BeginFrameAndCommitState(); | 102 ~BeginFrameAndCommitState(); |
| 98 | 103 |
| 99 base::TimeTicks monotonicFrameBeginTime; | 104 base::TimeTicks monotonicFrameBeginTime; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 196 |
| 192 // Set when the main thread is waiting on layers to be drawn. | 197 // Set when the main thread is waiting on layers to be drawn. |
| 193 CompletionEvent* m_textureAcquisitionCompletionEventOnImplThread; | 198 CompletionEvent* m_textureAcquisitionCompletionEventOnImplThread; |
| 194 | 199 |
| 195 scoped_ptr<ResourceUpdateController> m_currentResourceUpdateControllerOnImpl
Thread; | 200 scoped_ptr<ResourceUpdateController> m_currentResourceUpdateControllerOnImpl
Thread; |
| 196 | 201 |
| 197 // Set when the next draw should post didCommitAndDrawFrame to the main thre
ad. | 202 // Set when the next draw should post didCommitAndDrawFrame to the main thre
ad. |
| 198 bool m_nextFrameIsNewlyCommittedFrameOnImplThread; | 203 bool m_nextFrameIsNewlyCommittedFrameOnImplThread; |
| 199 | 204 |
| 200 bool m_renderVSyncEnabled; | 205 bool m_renderVSyncEnabled; |
| 206 bool m_renderVSyncNotificationEnabled; |
| 207 VSyncClient* m_vsyncClient; |
| 201 | 208 |
| 202 bool m_insideDraw; | 209 bool m_insideDraw; |
| 203 | 210 |
| 204 base::TimeDelta m_totalCommitTime; | 211 base::TimeDelta m_totalCommitTime; |
| 205 size_t m_totalCommitCount; | 212 size_t m_totalCommitCount; |
| 206 | 213 |
| 207 bool m_deferCommits; | 214 bool m_deferCommits; |
| 208 scoped_ptr<BeginFrameAndCommitState> m_pendingDeferredCommit; | 215 scoped_ptr<BeginFrameAndCommitState> m_pendingDeferredCommit; |
| 209 | 216 |
| 210 base::TimeTicks m_smoothnessTakesPriorityExpirationTime; | 217 base::TimeTicks m_smoothnessTakesPriorityExpirationTime; |
| 211 bool m_renewTreePriorityOnImplThreadPending; | 218 bool m_renewTreePriorityOnImplThreadPending; |
| 212 }; | 219 }; |
| 213 | 220 |
| 214 } // namespace cc | 221 } // namespace cc |
| 215 | 222 |
| 216 #endif // CC_THREAD_PROXY_H_ | 223 #endif // CC_THREAD_PROXY_H_ |
| OLD | NEW |