| 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_TREES_SINGLE_THREAD_PROXY_H_ | 5 #ifndef CC_TREES_SINGLE_THREAD_PROXY_H_ |
| 6 #define CC_TREES_SINGLE_THREAD_PROXY_H_ | 6 #define CC_TREES_SINGLE_THREAD_PROXY_H_ |
| 7 | 7 |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "cc/animation/animation_events.h" | 11 #include "cc/animation/animation_events.h" |
| 12 #include "cc/output/begin_frame_args.h" | 12 #include "cc/output/begin_frame_args.h" |
| 13 #include "cc/trees/layer_tree_host_impl.h" | 13 #include "cc/trees/layer_tree_host_impl.h" |
| 14 #include "cc/trees/proxy.h" | 14 #include "cc/trees/proxy.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 class ContextProvider; | 18 class ContextProvider; |
| 19 class LayerTreeHost; | 19 class LayerTreeHost; |
| 20 class LayerTreeHostSingleThreadClient; | 20 class LayerTreeHostSingleThreadClient; |
| 21 | 21 |
| 22 class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { | 22 class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { |
| 23 public: | 23 public: |
| 24 static scoped_ptr<Proxy> Create( | 24 static scoped_ptr<Proxy> Create( |
| 25 LayerTreeHost* layer_tree_host, | 25 LayerTreeHost* layer_tree_host, |
| 26 LayerTreeHostSingleThreadClient* client); | 26 LayerTreeHostSingleThreadClient* client); |
| 27 virtual ~SingleThreadProxy(); | 27 virtual ~SingleThreadProxy(); |
| 28 | 28 |
| 29 // Proxy implementation | 29 // Proxy implementation |
| 30 virtual bool CompositeAndReadback(void* pixels, gfx::Rect rect) OVERRIDE; | 30 virtual bool CompositeAndReadback(void* pixels, |
| 31 const gfx::Rect& rect) OVERRIDE; |
| 31 virtual void FinishAllRendering() OVERRIDE; | 32 virtual void FinishAllRendering() OVERRIDE; |
| 32 virtual bool IsStarted() const OVERRIDE; | 33 virtual bool IsStarted() const OVERRIDE; |
| 33 virtual void SetLayerTreeHostClientReady() OVERRIDE; | 34 virtual void SetLayerTreeHostClientReady() OVERRIDE; |
| 34 virtual void SetVisible(bool visible) OVERRIDE; | 35 virtual void SetVisible(bool visible) OVERRIDE; |
| 35 virtual void CreateAndInitializeOutputSurface() OVERRIDE; | 36 virtual void CreateAndInitializeOutputSurface() OVERRIDE; |
| 36 virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; | 37 virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; |
| 37 virtual void SetNeedsAnimate() OVERRIDE; | 38 virtual void SetNeedsAnimate() OVERRIDE; |
| 38 virtual void SetNeedsUpdateLayers() OVERRIDE; | 39 virtual void SetNeedsUpdateLayers() OVERRIDE; |
| 39 virtual void SetNeedsCommit() OVERRIDE; | 40 virtual void SetNeedsCommit() OVERRIDE; |
| 40 virtual void SetNeedsRedraw(gfx::Rect damage_rect) OVERRIDE; | 41 virtual void SetNeedsRedraw(const gfx::Rect& damage_rect) OVERRIDE; |
| 41 virtual void SetNextCommitWaitsForActivation() OVERRIDE; | 42 virtual void SetNextCommitWaitsForActivation() OVERRIDE; |
| 42 virtual void NotifyInputThrottledUntilCommit() OVERRIDE {} | 43 virtual void NotifyInputThrottledUntilCommit() OVERRIDE {} |
| 43 virtual void SetDeferCommits(bool defer_commits) OVERRIDE; | 44 virtual void SetDeferCommits(bool defer_commits) OVERRIDE; |
| 44 virtual bool CommitRequested() const OVERRIDE; | 45 virtual bool CommitRequested() const OVERRIDE; |
| 45 virtual bool BeginMainFrameRequested() const OVERRIDE; | 46 virtual bool BeginMainFrameRequested() const OVERRIDE; |
| 46 virtual void MainThreadHasStoppedFlinging() OVERRIDE {} | 47 virtual void MainThreadHasStoppedFlinging() OVERRIDE {} |
| 47 virtual void Start() OVERRIDE; | 48 virtual void Start() OVERRIDE; |
| 48 virtual void Stop() OVERRIDE; | 49 virtual void Stop() OVERRIDE; |
| 49 virtual size_t MaxPartialTextureUpdates() const OVERRIDE; | 50 virtual size_t MaxPartialTextureUpdates() const OVERRIDE; |
| 50 virtual void AcquireLayerTextures() OVERRIDE {} | 51 virtual void AcquireLayerTextures() OVERRIDE {} |
| 51 virtual void ForceSerializeOnSwapBuffers() OVERRIDE; | 52 virtual void ForceSerializeOnSwapBuffers() OVERRIDE; |
| 52 virtual scoped_ptr<base::Value> AsValue() const OVERRIDE; | 53 virtual scoped_ptr<base::Value> AsValue() const OVERRIDE; |
| 53 virtual bool CommitPendingForTesting() OVERRIDE; | 54 virtual bool CommitPendingForTesting() OVERRIDE; |
| 54 | 55 |
| 55 // LayerTreeHostImplClient implementation | 56 // LayerTreeHostImplClient implementation |
| 56 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; | 57 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; |
| 57 virtual void DidSwapBuffersOnImplThread() OVERRIDE; | 58 virtual void DidSwapBuffersOnImplThread() OVERRIDE; |
| 58 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE; | 59 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE; |
| 59 virtual void BeginImplFrame(const BeginFrameArgs& args) | 60 virtual void BeginImplFrame(const BeginFrameArgs& args) |
| 60 OVERRIDE {} | 61 OVERRIDE {} |
| 61 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; | 62 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; |
| 62 virtual void NotifyReadyToActivate() OVERRIDE; | 63 virtual void NotifyReadyToActivate() OVERRIDE; |
| 63 virtual void SetNeedsRedrawOnImplThread() OVERRIDE; | 64 virtual void SetNeedsRedrawOnImplThread() OVERRIDE; |
| 64 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect dirty_rect) OVERRIDE; | 65 virtual void SetNeedsRedrawRectOnImplThread( |
| 66 const gfx::Rect& dirty_rect) OVERRIDE; |
| 65 virtual void SetNeedsManageTilesOnImplThread() OVERRIDE; | 67 virtual void SetNeedsManageTilesOnImplThread() OVERRIDE; |
| 66 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE; | 68 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE; |
| 67 virtual void SetNeedsCommitOnImplThread() OVERRIDE; | 69 virtual void SetNeedsCommitOnImplThread() OVERRIDE; |
| 68 virtual void PostAnimationEventsToMainThreadOnImplThread( | 70 virtual void PostAnimationEventsToMainThreadOnImplThread( |
| 69 scoped_ptr<AnimationEventsVector> events, | 71 scoped_ptr<AnimationEventsVector> events, |
| 70 base::Time wall_clock_time) OVERRIDE; | 72 base::Time wall_clock_time) OVERRIDE; |
| 71 virtual bool ReduceContentsTextureMemoryOnImplThread( | 73 virtual bool ReduceContentsTextureMemoryOnImplThread( |
| 72 size_t limit_bytes, | 74 size_t limit_bytes, |
| 73 int priority_cutoff) OVERRIDE; | 75 int priority_cutoff) OVERRIDE; |
| 74 virtual void SendManagedMemoryStats() OVERRIDE; | 76 virtual void SendManagedMemoryStats() OVERRIDE; |
| 75 virtual bool IsInsideDraw() OVERRIDE; | 77 virtual bool IsInsideDraw() OVERRIDE; |
| 76 virtual void RenewTreePriority() OVERRIDE {} | 78 virtual void RenewTreePriority() OVERRIDE {} |
| 77 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) | 79 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) |
| 78 OVERRIDE {} | 80 OVERRIDE {} |
| 79 virtual void DidActivatePendingTree() OVERRIDE {} | 81 virtual void DidActivatePendingTree() OVERRIDE {} |
| 80 virtual void DidManageTiles() OVERRIDE {} | 82 virtual void DidManageTiles() OVERRIDE {} |
| 81 | 83 |
| 82 // Called by the legacy path where RenderWidget does the scheduling. | 84 // Called by the legacy path where RenderWidget does the scheduling. |
| 83 void CompositeImmediately(base::TimeTicks frame_begin_time); | 85 void CompositeImmediately(base::TimeTicks frame_begin_time); |
| 84 | 86 |
| 85 private: | 87 private: |
| 86 SingleThreadProxy(LayerTreeHost* layer_tree_host, | 88 SingleThreadProxy(LayerTreeHost* layer_tree_host, |
| 87 LayerTreeHostSingleThreadClient* client); | 89 LayerTreeHostSingleThreadClient* client); |
| 88 | 90 |
| 89 void OnOutputSurfaceInitializeAttempted(bool success); | 91 void OnOutputSurfaceInitializeAttempted(bool success); |
| 90 bool CommitAndComposite(base::TimeTicks frame_begin_time, | 92 bool CommitAndComposite(base::TimeTicks frame_begin_time, |
| 91 gfx::Rect device_viewport_damage_rect, | 93 const gfx::Rect& device_viewport_damage_rect, |
| 92 bool for_readback, | 94 bool for_readback, |
| 93 LayerTreeHostImpl::FrameData* frame); | 95 LayerTreeHostImpl::FrameData* frame); |
| 94 void DoCommit(scoped_ptr<ResourceUpdateQueue> queue); | 96 void DoCommit(scoped_ptr<ResourceUpdateQueue> queue); |
| 95 bool DoComposite(scoped_refptr<ContextProvider> offscreen_context_provider, | 97 bool DoComposite(scoped_refptr<ContextProvider> offscreen_context_provider, |
| 96 base::TimeTicks frame_begin_time, | 98 base::TimeTicks frame_begin_time, |
| 97 gfx::Rect device_viewport_damage_rect, | 99 const gfx::Rect& device_viewport_damage_rect, |
| 98 bool for_readback, | 100 bool for_readback, |
| 99 LayerTreeHostImpl::FrameData* frame); | 101 LayerTreeHostImpl::FrameData* frame); |
| 100 void DidSwapFrame(); | 102 void DidSwapFrame(); |
| 101 | 103 |
| 102 bool ShouldComposite() const; | 104 bool ShouldComposite() const; |
| 103 void UpdateBackgroundAnimateTicking(); | 105 void UpdateBackgroundAnimateTicking(); |
| 104 | 106 |
| 105 // Accessed on main thread only. | 107 // Accessed on main thread only. |
| 106 LayerTreeHost* layer_tree_host_; | 108 LayerTreeHost* layer_tree_host_; |
| 107 LayerTreeHostSingleThreadClient* client_; | 109 LayerTreeHostSingleThreadClient* client_; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 private: | 178 private: |
| 177 DebugScopedSetImplThread impl_thread_; | 179 DebugScopedSetImplThread impl_thread_; |
| 178 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 180 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
| 179 | 181 |
| 180 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 182 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
| 181 }; | 183 }; |
| 182 | 184 |
| 183 } // namespace cc | 185 } // namespace cc |
| 184 | 186 |
| 185 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 187 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
| OLD | NEW |