| 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_THREAD_PROXY_H_ | 5 #ifndef CC_TREES_THREAD_PROXY_H_ |
| 6 #define CC_TREES_THREAD_PROXY_H_ | 6 #define CC_TREES_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/animation_events.h" | 11 #include "cc/animation/animation_events.h" |
| 12 #include "cc/base/completion_event.h" | 12 #include "cc/base/completion_event.h" |
| 13 #include "cc/resources/resource_update_controller.h" | 13 #include "cc/resources/resource_update_controller.h" |
| 14 #include "cc/scheduler/scheduler.h" | 14 #include "cc/scheduler/scheduler.h" |
| 15 #include "cc/scheduler/vsync_time_source.h" |
| 15 #include "cc/trees/layer_tree_host_impl.h" | 16 #include "cc/trees/layer_tree_host_impl.h" |
| 16 #include "cc/trees/proxy.h" | 17 #include "cc/trees/proxy.h" |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 | 20 |
| 20 class ContextProvider; | 21 class ContextProvider; |
| 21 class InputHandler; | 22 class InputHandler; |
| 22 class LayerTreeHost; | 23 class LayerTreeHost; |
| 23 class ResourceUpdateQueue; | 24 class ResourceUpdateQueue; |
| 24 class Scheduler; | 25 class Scheduler; |
| 25 class ScopedThreadProxy; | 26 class ScopedThreadProxy; |
| 26 class Thread; | 27 class Thread; |
| 27 | 28 |
| 28 class ThreadProxy : public Proxy, | 29 class ThreadProxy : public Proxy, |
| 29 LayerTreeHostImplClient, | 30 LayerTreeHostImplClient, |
| 30 SchedulerClient, | 31 SchedulerClient, |
| 31 ResourceUpdateControllerClient { | 32 ResourceUpdateControllerClient, |
| 33 VSyncProvider { |
| 32 public: | 34 public: |
| 33 static scoped_ptr<Proxy> Create(LayerTreeHost* layer_tree_host, | 35 static scoped_ptr<Proxy> Create(LayerTreeHost* layer_tree_host, |
| 34 scoped_ptr<Thread> impl_thread); | 36 scoped_ptr<Thread> impl_thread); |
| 35 | 37 |
| 36 virtual ~ThreadProxy(); | 38 virtual ~ThreadProxy(); |
| 37 | 39 |
| 38 // Proxy implementation | 40 // Proxy implementation |
| 39 virtual bool CompositeAndReadback(void* pixels, gfx::Rect rect) OVERRIDE; | 41 virtual bool CompositeAndReadback(void* pixels, gfx::Rect rect) OVERRIDE; |
| 40 virtual void StartPageScaleAnimation(gfx::Vector2d target_offset, | 42 virtual void StartPageScaleAnimation(gfx::Vector2d target_offset, |
| 41 bool use_anchor, | 43 bool use_anchor, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 62 virtual void ForceSerializeOnSwapBuffers() OVERRIDE; | 64 virtual void ForceSerializeOnSwapBuffers() OVERRIDE; |
| 63 virtual skia::RefPtr<SkPicture> CapturePicture() OVERRIDE; | 65 virtual skia::RefPtr<SkPicture> CapturePicture() OVERRIDE; |
| 64 virtual scoped_ptr<base::Value> AsValue() const OVERRIDE; | 66 virtual scoped_ptr<base::Value> AsValue() const OVERRIDE; |
| 65 virtual bool CommitPendingForTesting() OVERRIDE; | 67 virtual bool CommitPendingForTesting() OVERRIDE; |
| 66 | 68 |
| 67 // LayerTreeHostImplClient implementation | 69 // LayerTreeHostImplClient implementation |
| 68 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; | 70 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; |
| 69 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE; | 71 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE; |
| 70 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, | 72 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, |
| 71 base::TimeDelta interval) OVERRIDE; | 73 base::TimeDelta interval) OVERRIDE; |
| 74 virtual void DidVSync(base::TimeTicks frame_time) OVERRIDE; |
| 72 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; | 75 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; |
| 73 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE; | 76 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE; |
| 74 virtual void SetNeedsRedrawOnImplThread() OVERRIDE; | 77 virtual void SetNeedsRedrawOnImplThread() OVERRIDE; |
| 75 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE; | 78 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE; |
| 76 virtual void SetNeedsCommitOnImplThread() OVERRIDE; | 79 virtual void SetNeedsCommitOnImplThread() OVERRIDE; |
| 77 virtual void SetNeedsManageTilesOnImplThread() OVERRIDE; | 80 virtual void SetNeedsManageTilesOnImplThread() OVERRIDE; |
| 78 virtual void PostAnimationEventsToMainThreadOnImplThread( | 81 virtual void PostAnimationEventsToMainThreadOnImplThread( |
| 79 scoped_ptr<AnimationEventsVector> queue, | 82 scoped_ptr<AnimationEventsVector> queue, |
| 80 base::Time wall_clock_time) OVERRIDE; | 83 base::Time wall_clock_time) OVERRIDE; |
| 81 virtual bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, | 84 virtual bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 97 virtual void ScheduledActionCommit() OVERRIDE; | 100 virtual void ScheduledActionCommit() OVERRIDE; |
| 98 virtual void ScheduledActionCheckForCompletedTileUploads() OVERRIDE; | 101 virtual void ScheduledActionCheckForCompletedTileUploads() OVERRIDE; |
| 99 virtual void ScheduledActionActivatePendingTreeIfNeeded() OVERRIDE; | 102 virtual void ScheduledActionActivatePendingTreeIfNeeded() OVERRIDE; |
| 100 virtual void ScheduledActionBeginContextRecreation() OVERRIDE; | 103 virtual void ScheduledActionBeginContextRecreation() OVERRIDE; |
| 101 virtual void ScheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; | 104 virtual void ScheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; |
| 102 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) OVERRIDE; | 105 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) OVERRIDE; |
| 103 | 106 |
| 104 // ResourceUpdateControllerClient implementation | 107 // ResourceUpdateControllerClient implementation |
| 105 virtual void ReadyToFinalizeTextureUpdates() OVERRIDE; | 108 virtual void ReadyToFinalizeTextureUpdates() OVERRIDE; |
| 106 | 109 |
| 110 // VSyncProvider implementation |
| 111 virtual void RequestVSyncNotification(VSyncClient* client) OVERRIDE; |
| 112 |
| 107 int MaxFramesPendingForTesting() const { | 113 int MaxFramesPendingForTesting() const { |
| 108 return scheduler_on_impl_thread_->MaxFramesPending(); | 114 return scheduler_on_impl_thread_->MaxFramesPending(); |
| 109 } | 115 } |
| 110 | 116 |
| 111 private: | 117 private: |
| 112 ThreadProxy(LayerTreeHost* layer_tree_host, scoped_ptr<Thread> impl_thread); | 118 ThreadProxy(LayerTreeHost* layer_tree_host, scoped_ptr<Thread> impl_thread); |
| 113 | 119 |
| 114 struct BeginFrameAndCommitState { | 120 struct BeginFrameAndCommitState { |
| 115 BeginFrameAndCommitState(); | 121 BeginFrameAndCommitState(); |
| 116 ~BeginFrameAndCommitState(); | 122 ~BeginFrameAndCommitState(); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 CompletionEvent* texture_acquisition_completion_event_on_impl_thread_; | 247 CompletionEvent* texture_acquisition_completion_event_on_impl_thread_; |
| 242 | 248 |
| 243 scoped_ptr<ResourceUpdateController> | 249 scoped_ptr<ResourceUpdateController> |
| 244 current_resource_update_controller_on_impl_thread_; | 250 current_resource_update_controller_on_impl_thread_; |
| 245 | 251 |
| 246 // Set when the next draw should post didCommitAndDrawFrame to the main | 252 // Set when the next draw should post didCommitAndDrawFrame to the main |
| 247 // thread. | 253 // thread. |
| 248 bool next_frame_is_newly_committed_frame_on_impl_thread_; | 254 bool next_frame_is_newly_committed_frame_on_impl_thread_; |
| 249 | 255 |
| 250 bool render_vsync_enabled_; | 256 bool render_vsync_enabled_; |
| 257 bool render_vsync_notification_enabled_; |
| 258 VSyncClient* vsync_client_; |
| 251 | 259 |
| 252 bool inside_draw_; | 260 bool inside_draw_; |
| 253 | 261 |
| 254 bool defer_commits_; | 262 bool defer_commits_; |
| 255 scoped_ptr<BeginFrameAndCommitState> pending_deferred_commit_; | 263 scoped_ptr<BeginFrameAndCommitState> pending_deferred_commit_; |
| 256 | 264 |
| 257 base::TimeTicks smoothness_takes_priority_expiration_time_; | 265 base::TimeTicks smoothness_takes_priority_expiration_time_; |
| 258 bool renew_tree_priority_on_impl_thread_pending_; | 266 bool renew_tree_priority_on_impl_thread_pending_; |
| 259 }; | 267 }; |
| 260 | 268 |
| 261 } // namespace cc | 269 } // namespace cc |
| 262 | 270 |
| 263 #endif // CC_TREES_THREAD_PROXY_H_ | 271 #endif // CC_TREES_THREAD_PROXY_H_ |
| OLD | NEW |