| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 virtual bool CommitPendingForTesting() OVERRIDE; | 65 virtual bool CommitPendingForTesting() OVERRIDE; |
| 66 virtual std::string SchedulerStateAsStringForTesting() OVERRIDE; | 66 virtual std::string SchedulerStateAsStringForTesting() OVERRIDE; |
| 67 | 67 |
| 68 // LayerTreeHostImplClient implementation | 68 // LayerTreeHostImplClient implementation |
| 69 virtual void DidTryInitializeRendererOnImplThread( | 69 virtual void DidTryInitializeRendererOnImplThread( |
| 70 bool success, | 70 bool success, |
| 71 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; | 71 scoped_refptr<ContextProvider> offscreen_context_provider) OVERRIDE; |
| 72 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; | 72 virtual void DidLoseOutputSurfaceOnImplThread() OVERRIDE; |
| 73 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE; | 73 virtual void OnSwapBuffersCompleteOnImplThread() OVERRIDE; |
| 74 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) OVERRIDE; | 74 virtual void BeginFrameOnImplThread(const BeginFrameArgs& args) OVERRIDE; |
| 75 virtual void DidBeginFrameDeadlineOnImplThread() OVERRIDE; |
| 75 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; | 76 virtual void OnCanDrawStateChanged(bool can_draw) OVERRIDE; |
| 77 virtual void NotifyReadyToActivate() OVERRIDE; |
| 76 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE; | 78 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) OVERRIDE; |
| 77 virtual void SetNeedsRedrawOnImplThread() OVERRIDE; | 79 virtual void SetNeedsRedrawOnImplThread() OVERRIDE; |
| 78 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect dirty_rect) OVERRIDE; | 80 virtual void SetNeedsRedrawRectOnImplThread(gfx::Rect dirty_rect) OVERRIDE; |
| 79 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE; | 81 virtual void DidInitializeVisibleTileOnImplThread() OVERRIDE; |
| 80 virtual void SetNeedsCommitOnImplThread() OVERRIDE; | 82 virtual void SetNeedsCommitOnImplThread() OVERRIDE; |
| 81 virtual void PostAnimationEventsToMainThreadOnImplThread( | 83 virtual void PostAnimationEventsToMainThreadOnImplThread( |
| 82 scoped_ptr<AnimationEventsVector> queue, | 84 scoped_ptr<AnimationEventsVector> queue, |
| 83 base::Time wall_clock_time) OVERRIDE; | 85 base::Time wall_clock_time) OVERRIDE; |
| 84 virtual bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, | 86 virtual bool ReduceContentsTextureMemoryOnImplThread(size_t limit_bytes, |
| 85 int priority_cutoff) | 87 int priority_cutoff) |
| 86 OVERRIDE; | 88 OVERRIDE; |
| 87 virtual void ReduceWastedContentsTextureMemoryOnImplThread() OVERRIDE; | 89 virtual void ReduceWastedContentsTextureMemoryOnImplThread() OVERRIDE; |
| 88 virtual void SendManagedMemoryStats() OVERRIDE; | 90 virtual void SendManagedMemoryStats() OVERRIDE; |
| 89 virtual bool IsInsideDraw() OVERRIDE; | 91 virtual bool IsInsideDraw() OVERRIDE; |
| 90 virtual void RenewTreePriority() OVERRIDE; | 92 virtual void RenewTreePriority() OVERRIDE; |
| 91 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) | 93 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) |
| 92 OVERRIDE; | 94 OVERRIDE; |
| 93 virtual void DidActivatePendingTree() OVERRIDE; | 95 virtual void DidActivatePendingTree() OVERRIDE; |
| 94 | 96 |
| 95 // SchedulerClient implementation | 97 // SchedulerClient implementation |
| 96 virtual void SetNeedsBeginFrameOnImplThread(bool enable) OVERRIDE; | 98 virtual void SetNeedsBeginFrameOnImplThread(bool enable) OVERRIDE; |
| 97 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE; | 99 virtual void ScheduledActionSendBeginFrameToMainThread() OVERRIDE; |
| 98 virtual ScheduledActionDrawAndSwapResult | 100 virtual DrawSwapReadbackResult |
| 99 ScheduledActionDrawAndSwapIfPossible() OVERRIDE; | 101 ScheduledActionDrawAndSwapIfPossible() OVERRIDE; |
| 100 virtual ScheduledActionDrawAndSwapResult ScheduledActionDrawAndSwapForced() | 102 virtual DrawSwapReadbackResult |
| 101 OVERRIDE; | 103 ScheduledActionDrawAndSwapForced() OVERRIDE; |
| 104 virtual DrawSwapReadbackResult |
| 105 ScheduledActionDrawAndReadback() OVERRIDE; |
| 102 virtual void ScheduledActionCommit() OVERRIDE; | 106 virtual void ScheduledActionCommit() OVERRIDE; |
| 103 virtual void ScheduledActionUpdateVisibleTiles() OVERRIDE; | 107 virtual void ScheduledActionUpdateVisibleTiles() OVERRIDE; |
| 104 virtual void ScheduledActionActivatePendingTreeIfNeeded() OVERRIDE; | 108 virtual void ScheduledActionActivatePendingTree() OVERRIDE; |
| 105 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE; | 109 virtual void ScheduledActionBeginOutputSurfaceCreation() OVERRIDE; |
| 106 virtual void ScheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; | 110 virtual void ScheduledActionAcquireLayerTexturesForMainThread() OVERRIDE; |
| 107 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) OVERRIDE; | 111 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) OVERRIDE; |
| 108 virtual base::TimeDelta DrawDurationEstimate() OVERRIDE; | 112 virtual base::TimeDelta DrawDurationEstimate() OVERRIDE; |
| 109 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() OVERRIDE; | 113 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() OVERRIDE; |
| 110 virtual base::TimeDelta CommitToActivateDurationEstimate() OVERRIDE; | 114 virtual base::TimeDelta CommitToActivateDurationEstimate() OVERRIDE; |
| 115 virtual void PostBeginFrameDeadline(const base::Closure& closure, |
| 116 base::TimeTicks deadline) OVERRIDE; |
| 111 | 117 |
| 112 // ResourceUpdateControllerClient implementation | 118 // ResourceUpdateControllerClient implementation |
| 113 virtual void ReadyToFinalizeTextureUpdates() OVERRIDE; | 119 virtual void ReadyToFinalizeTextureUpdates() OVERRIDE; |
| 114 | 120 |
| 115 private: | 121 private: |
| 116 ThreadProxy(LayerTreeHost* layer_tree_host, | 122 ThreadProxy(LayerTreeHost* layer_tree_host, |
| 117 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 123 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 118 | 124 |
| 119 struct BeginFrameAndCommitState { | 125 struct BeginFrameAndCommitState { |
| 120 BeginFrameAndCommitState(); | 126 BeginFrameAndCommitState(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 137 void OnOutputSurfaceInitializeAttempted( | 143 void OnOutputSurfaceInitializeAttempted( |
| 138 bool success, | 144 bool success, |
| 139 const RendererCapabilities& capabilities); | 145 const RendererCapabilities& capabilities); |
| 140 void SendCommitRequestToImplThreadIfNeeded(); | 146 void SendCommitRequestToImplThreadIfNeeded(); |
| 141 | 147 |
| 142 // Called on impl thread. | 148 // Called on impl thread. |
| 143 struct ReadbackRequest; | 149 struct ReadbackRequest; |
| 144 struct CommitPendingRequest; | 150 struct CommitPendingRequest; |
| 145 struct SchedulerStateRequest; | 151 struct SchedulerStateRequest; |
| 146 | 152 |
| 147 void ForceCommitOnImplThread(CompletionEvent* completion); | 153 void ForceCommitForReadbackOnImplThread( |
| 154 CompletionEvent* completion, |
| 155 ReadbackRequest *request); |
| 148 void StartCommitOnImplThread( | 156 void StartCommitOnImplThread( |
| 149 CompletionEvent* completion, | 157 CompletionEvent* completion, |
| 150 ResourceUpdateQueue* queue, | 158 ResourceUpdateQueue* queue, |
| 151 scoped_refptr<cc::ContextProvider> offscreen_context_provider); | 159 scoped_refptr<cc::ContextProvider> offscreen_context_provider); |
| 152 void BeginFrameAbortedByMainThreadOnImplThread(bool did_handle); | 160 void BeginFrameAbortedByMainThreadOnImplThread(bool did_handle); |
| 153 void RequestReadbackOnImplThread(ReadbackRequest* request); | |
| 154 void FinishAllRenderingOnImplThread(CompletionEvent* completion); | 161 void FinishAllRenderingOnImplThread(CompletionEvent* completion); |
| 155 void InitializeImplOnImplThread(CompletionEvent* completion); | 162 void InitializeImplOnImplThread(CompletionEvent* completion); |
| 156 void SetLayerTreeHostClientReadyOnImplThread(); | 163 void SetLayerTreeHostClientReadyOnImplThread(); |
| 157 void SetVisibleOnImplThread(CompletionEvent* completion, bool visible); | 164 void SetVisibleOnImplThread(CompletionEvent* completion, bool visible); |
| 158 void HasInitializedOutputSurfaceOnImplThread( | 165 void HasInitializedOutputSurfaceOnImplThread( |
| 159 CompletionEvent* completion, | 166 CompletionEvent* completion, |
| 160 bool* has_initialized_output_surface); | 167 bool* has_initialized_output_surface); |
| 161 void InitializeOutputSurfaceOnImplThread( | 168 void InitializeOutputSurfaceOnImplThread( |
| 162 CompletionEvent* completion, | 169 CompletionEvent* completion, |
| 163 scoped_ptr<OutputSurface> output_surface, | 170 scoped_ptr<OutputSurface> output_surface, |
| 164 scoped_refptr<ContextProvider> offscreen_context_provider, | 171 scoped_refptr<ContextProvider> offscreen_context_provider, |
| 165 bool* success, | 172 bool* success, |
| 166 RendererCapabilities* capabilities); | 173 RendererCapabilities* capabilities); |
| 167 void FinishGLOnImplThread(CompletionEvent* completion); | 174 void FinishGLOnImplThread(CompletionEvent* completion); |
| 168 void LayerTreeHostClosedOnImplThread(CompletionEvent* completion); | 175 void LayerTreeHostClosedOnImplThread(CompletionEvent* completion); |
| 169 void AcquireLayerTexturesForMainThreadOnImplThread( | 176 void AcquireLayerTexturesForMainThreadOnImplThread( |
| 170 CompletionEvent* completion); | 177 CompletionEvent* completion); |
| 171 ScheduledActionDrawAndSwapResult ScheduledActionDrawAndSwapInternal( | 178 DrawSwapReadbackResult ScheduledActionDrawSwapReadbackInternal( |
| 172 bool forced_draw); | 179 bool forced_draw, bool swap_requested, bool readback_requested); |
| 173 void ForceSerializeOnSwapBuffersOnImplThread(CompletionEvent* completion); | 180 void ForceSerializeOnSwapBuffersOnImplThread(CompletionEvent* completion); |
| 174 void CheckOutputSurfaceStatusOnImplThread(); | 181 void CheckOutputSurfaceStatusOnImplThread(); |
| 175 void CommitPendingOnImplThreadForTesting(CommitPendingRequest* request); | 182 void CommitPendingOnImplThreadForTesting(CommitPendingRequest* request); |
| 176 void SchedulerStateAsStringOnImplThreadForTesting( | 183 void SchedulerStateAsStringOnImplThreadForTesting( |
| 177 SchedulerStateRequest* request); | 184 SchedulerStateRequest* request); |
| 178 void AsValueOnImplThread(CompletionEvent* completion, | 185 void AsValueOnImplThread(CompletionEvent* completion, |
| 179 base::DictionaryValue* state) const; | 186 base::DictionaryValue* state) const; |
| 180 void RenewTreePriorityOnImplThread(); | 187 void RenewTreePriorityOnImplThread(); |
| 181 void DidSwapUseIncompleteTileOnImplThread(); | 188 void DidSwapUseIncompleteTileOnImplThread(); |
| 182 void StartScrollbarAnimationOnImplThread(); | 189 void StartScrollbarAnimationOnImplThread(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 207 scoped_ptr<OutputSurface> first_output_surface_; | 214 scoped_ptr<OutputSurface> first_output_surface_; |
| 208 | 215 |
| 209 base::WeakPtrFactory<ThreadProxy> weak_factory_on_impl_thread_; | 216 base::WeakPtrFactory<ThreadProxy> weak_factory_on_impl_thread_; |
| 210 | 217 |
| 211 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; | 218 base::WeakPtr<ThreadProxy> main_thread_weak_ptr_; |
| 212 base::WeakPtrFactory<ThreadProxy> weak_factory_; | 219 base::WeakPtrFactory<ThreadProxy> weak_factory_; |
| 213 | 220 |
| 214 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; | 221 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; |
| 215 | 222 |
| 216 scoped_ptr<Scheduler> scheduler_on_impl_thread_; | 223 scoped_ptr<Scheduler> scheduler_on_impl_thread_; |
| 224 bool frame_did_draw_; |
| 217 | 225 |
| 218 // Set when the main thread is waiting on a | 226 // Set when the main thread is waiting on a |
| 219 // ScheduledActionSendBeginFrameToMainThread to be issued. | 227 // ScheduledActionSendBeginFrameToMainThread to be issued. |
| 220 CompletionEvent* | 228 CompletionEvent* |
| 221 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_; | 229 begin_frame_sent_to_main_thread_completion_event_on_impl_thread_; |
| 222 | 230 |
| 223 // Set when the main thread is waiting on a readback. | 231 // Set when the main thread is waiting on a readback. |
| 224 ReadbackRequest* readback_request_on_impl_thread_; | 232 ReadbackRequest* readback_request_on_impl_thread_; |
| 225 | 233 |
| 226 // Set when the main thread is waiting on a commit to complete. | 234 // Set when the main thread is waiting on a commit to complete. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // activation_duration_history_. | 271 // activation_duration_history_. |
| 264 base::TimeTicks begin_frame_sent_to_main_thread_time_; | 272 base::TimeTicks begin_frame_sent_to_main_thread_time_; |
| 265 base::TimeTicks commit_complete_time_; | 273 base::TimeTicks commit_complete_time_; |
| 266 | 274 |
| 267 DISALLOW_COPY_AND_ASSIGN(ThreadProxy); | 275 DISALLOW_COPY_AND_ASSIGN(ThreadProxy); |
| 268 }; | 276 }; |
| 269 | 277 |
| 270 } // namespace cc | 278 } // namespace cc |
| 271 | 279 |
| 272 #endif // CC_TREES_THREAD_PROXY_H_ | 280 #endif // CC_TREES_THREAD_PROXY_H_ |
| OLD | NEW |