| 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, | |
| 31 const gfx::Rect& rect) OVERRIDE; | |
| 32 virtual void FinishAllRendering() OVERRIDE; | 30 virtual void FinishAllRendering() OVERRIDE; |
| 33 virtual bool IsStarted() const OVERRIDE; | 31 virtual bool IsStarted() const OVERRIDE; |
| 34 virtual void SetLayerTreeHostClientReady() OVERRIDE; | 32 virtual void SetLayerTreeHostClientReady() OVERRIDE; |
| 35 virtual void SetVisible(bool visible) OVERRIDE; | 33 virtual void SetVisible(bool visible) OVERRIDE; |
| 36 virtual void CreateAndInitializeOutputSurface() OVERRIDE; | 34 virtual void CreateAndInitializeOutputSurface() OVERRIDE; |
| 37 virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; | 35 virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; |
| 38 virtual void SetNeedsAnimate() OVERRIDE; | 36 virtual void SetNeedsAnimate() OVERRIDE; |
| 39 virtual void SetNeedsUpdateLayers() OVERRIDE; | 37 virtual void SetNeedsUpdateLayers() OVERRIDE; |
| 40 virtual void SetNeedsCommit() OVERRIDE; | 38 virtual void SetNeedsCommit() OVERRIDE; |
| 41 virtual void SetNeedsRedraw(const gfx::Rect& damage_rect) OVERRIDE; | 39 virtual void SetNeedsRedraw(const gfx::Rect& damage_rect) OVERRIDE; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 virtual void SetDebugState(const LayerTreeDebugState& debug_state) OVERRIDE {} | 85 virtual void SetDebugState(const LayerTreeDebugState& debug_state) OVERRIDE {} |
| 88 | 86 |
| 89 // Called by the legacy path where RenderWidget does the scheduling. | 87 // Called by the legacy path where RenderWidget does the scheduling. |
| 90 void CompositeImmediately(base::TimeTicks frame_begin_time); | 88 void CompositeImmediately(base::TimeTicks frame_begin_time); |
| 91 | 89 |
| 92 private: | 90 private: |
| 93 SingleThreadProxy(LayerTreeHost* layer_tree_host, | 91 SingleThreadProxy(LayerTreeHost* layer_tree_host, |
| 94 LayerTreeHostSingleThreadClient* client); | 92 LayerTreeHostSingleThreadClient* client); |
| 95 | 93 |
| 96 bool CommitAndComposite(base::TimeTicks frame_begin_time, | 94 bool CommitAndComposite(base::TimeTicks frame_begin_time, |
| 97 const gfx::Rect& device_viewport_damage_rect, | |
| 98 bool for_readback, | |
| 99 LayerTreeHostImpl::FrameData* frame); | 95 LayerTreeHostImpl::FrameData* frame); |
| 100 void DoCommit(scoped_ptr<ResourceUpdateQueue> queue); | 96 void DoCommit(scoped_ptr<ResourceUpdateQueue> queue); |
| 101 bool DoComposite(base::TimeTicks frame_begin_time, | 97 bool DoComposite(base::TimeTicks frame_begin_time, |
| 102 const gfx::Rect& device_viewport_damage_rect, | |
| 103 bool for_readback, | |
| 104 LayerTreeHostImpl::FrameData* frame); | 98 LayerTreeHostImpl::FrameData* frame); |
| 105 void DidSwapFrame(); | 99 void DidSwapFrame(); |
| 106 | 100 |
| 107 bool ShouldComposite() const; | 101 bool ShouldComposite() const; |
| 108 void UpdateBackgroundAnimateTicking(); | 102 void UpdateBackgroundAnimateTicking(); |
| 109 | 103 |
| 110 // Accessed on main thread only. | 104 // Accessed on main thread only. |
| 111 LayerTreeHost* layer_tree_host_; | 105 LayerTreeHost* layer_tree_host_; |
| 112 LayerTreeHostSingleThreadClient* client_; | 106 LayerTreeHostSingleThreadClient* client_; |
| 113 | 107 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 private: | 174 private: |
| 181 DebugScopedSetImplThread impl_thread_; | 175 DebugScopedSetImplThread impl_thread_; |
| 182 DebugScopedSetMainThreadBlocked main_thread_blocked_; | 176 DebugScopedSetMainThreadBlocked main_thread_blocked_; |
| 183 | 177 |
| 184 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); | 178 DISALLOW_COPY_AND_ASSIGN(DebugScopedSetImplThreadAndMainThreadBlocked); |
| 185 }; | 179 }; |
| 186 | 180 |
| 187 } // namespace cc | 181 } // namespace cc |
| 188 | 182 |
| 189 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ | 183 #endif // CC_TREES_SINGLE_THREAD_PROXY_H_ |
| OLD | NEW |