| 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 | 21 |
| 21 class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { | 22 class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { |
| 22 public: | 23 public: |
| 23 static scoped_ptr<Proxy> Create(LayerTreeHost* layer_tree_host); | 24 static scoped_ptr<Proxy> Create( |
| 25 LayerTreeHost* layer_tree_host, |
| 26 LayerTreeHostSingleThreadClient* client); |
| 24 virtual ~SingleThreadProxy(); | 27 virtual ~SingleThreadProxy(); |
| 25 | 28 |
| 26 // Proxy implementation | 29 // Proxy implementation |
| 27 virtual bool CompositeAndReadback(void* pixels, gfx::Rect rect) OVERRIDE; | 30 virtual bool CompositeAndReadback(void* pixels, gfx::Rect rect) OVERRIDE; |
| 28 virtual void FinishAllRendering() OVERRIDE; | 31 virtual void FinishAllRendering() OVERRIDE; |
| 29 virtual bool IsStarted() const OVERRIDE; | 32 virtual bool IsStarted() const OVERRIDE; |
| 30 virtual void SetLayerTreeHostClientReady() OVERRIDE; | 33 virtual void SetLayerTreeHostClientReady() OVERRIDE; |
| 31 virtual void SetVisible(bool visible) OVERRIDE; | 34 virtual void SetVisible(bool visible) OVERRIDE; |
| 32 virtual void CreateAndInitializeOutputSurface() OVERRIDE; | 35 virtual void CreateAndInitializeOutputSurface() OVERRIDE; |
| 33 virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; | 36 virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 virtual void RenewTreePriority() OVERRIDE {} | 75 virtual void RenewTreePriority() OVERRIDE {} |
| 73 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) | 76 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) |
| 74 OVERRIDE {} | 77 OVERRIDE {} |
| 75 virtual void DidActivatePendingTree() OVERRIDE {} | 78 virtual void DidActivatePendingTree() OVERRIDE {} |
| 76 virtual void DidManageTiles() OVERRIDE {} | 79 virtual void DidManageTiles() OVERRIDE {} |
| 77 | 80 |
| 78 // Called by the legacy path where RenderWidget does the scheduling. | 81 // Called by the legacy path where RenderWidget does the scheduling. |
| 79 void CompositeImmediately(base::TimeTicks frame_begin_time); | 82 void CompositeImmediately(base::TimeTicks frame_begin_time); |
| 80 | 83 |
| 81 private: | 84 private: |
| 82 explicit SingleThreadProxy(LayerTreeHost* layer_tree_host); | 85 SingleThreadProxy(LayerTreeHost* layer_tree_host, |
| 86 LayerTreeHostSingleThreadClient* client); |
| 83 | 87 |
| 84 void OnOutputSurfaceInitializeAttempted(bool success); | 88 void OnOutputSurfaceInitializeAttempted(bool success); |
| 85 bool CommitAndComposite(base::TimeTicks frame_begin_time, | 89 bool CommitAndComposite(base::TimeTicks frame_begin_time, |
| 86 gfx::Rect device_viewport_damage_rect, | 90 gfx::Rect device_viewport_damage_rect, |
| 87 bool for_readback, | 91 bool for_readback, |
| 88 LayerTreeHostImpl::FrameData* frame); | 92 LayerTreeHostImpl::FrameData* frame); |
| 89 void DoCommit(scoped_ptr<ResourceUpdateQueue> queue); | 93 void DoCommit(scoped_ptr<ResourceUpdateQueue> queue); |
| 90 bool DoComposite( | 94 bool DoComposite( |
| 91 scoped_refptr<cc::ContextProvider> offscreen_context_provider, | 95 scoped_refptr<cc::ContextProvider> offscreen_context_provider, |
| 92 base::TimeTicks frame_begin_time, | 96 base::TimeTicks frame_begin_time, |
| 93 gfx::Rect device_viewport_damage_rect, | 97 gfx::Rect device_viewport_damage_rect, |
| 94 bool for_readback, | 98 bool for_readback, |
| 95 LayerTreeHostImpl::FrameData* frame); | 99 LayerTreeHostImpl::FrameData* frame); |
| 96 void DidSwapFrame(); | 100 void DidSwapFrame(); |
| 97 | 101 |
| 98 bool ShouldComposite() const; | 102 bool ShouldComposite() const; |
| 99 void UpdateBackgroundAnimateTicking(); | 103 void UpdateBackgroundAnimateTicking(); |
| 100 | 104 |
| 101 // Accessed on main thread only. | 105 // Accessed on main thread only. |
| 102 LayerTreeHost* layer_tree_host_; | 106 LayerTreeHost* layer_tree_host_; |
| 107 LayerTreeHostSingleThreadClient* client_; |
| 103 bool created_offscreen_context_provider_; | 108 bool created_offscreen_context_provider_; |
| 104 | 109 |
| 105 // Holds the first output surface passed from Start. Should not be used for | 110 // Holds the first output surface passed from Start. Should not be used for |
| 106 // anything else. | 111 // anything else. |
| 107 scoped_ptr<OutputSurface> first_output_surface_; | 112 scoped_ptr<OutputSurface> first_output_surface_; |
| 108 | 113 |
| 109 // Used on the Thread, but checked on main thread during | 114 // Used on the Thread, but checked on main thread during |
| 110 // initialization/shutdown. | 115 // initialization/shutdown. |
| 111 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 116 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
| 112 RendererCapabilities renderer_capabilities_for_main_thread_; | 117 RendererCapabilities renderer_capabilities_for_main_thread_; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 private: | 180 private: |
| 176 DebugScopedSetImplThread impl_thread_; | 181 DebugScopedSetImplThread impl_thread_; |
| 177 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 182 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
| 178 | 183 |
| 179 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 184 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
| 180 }; | 185 }; |
| 181 | 186 |
| 182 } // namespace cc | 187 } // namespace cc |
| 183 | 188 |
| 184 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 189 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
| OLD | NEW |