| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PROXY_IMPL_H_ | 5 #ifndef CC_TREES_PROXY_IMPL_H_ |
| 6 #define CC_TREES_PROXY_IMPL_H_ | 6 #define CC_TREES_PROXY_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 ProxyImpl(ChannelImpl* channel_impl, | 26 ProxyImpl(ChannelImpl* channel_impl, |
| 27 LayerTreeHost* layer_tree_host, | 27 LayerTreeHost* layer_tree_host, |
| 28 TaskRunnerProvider* task_runner_provider, | 28 TaskRunnerProvider* task_runner_provider, |
| 29 std::unique_ptr<BeginFrameSource> external_begin_frame_source); | 29 std::unique_ptr<BeginFrameSource> external_begin_frame_source); |
| 30 ~ProxyImpl() override; | 30 ~ProxyImpl() override; |
| 31 | 31 |
| 32 // Virtual for testing. | 32 // Virtual for testing. |
| 33 void UpdateTopControlsStateOnImpl(TopControlsState constraints, | 33 void UpdateTopControlsStateOnImpl(TopControlsState constraints, |
| 34 TopControlsState current, | 34 TopControlsState current, |
| 35 bool animate); | 35 bool animate); |
| 36 void InitializeOutputSurfaceOnImpl(OutputSurface* output_surface); | 36 void InitializeCompositorFrameSinkOnImpl( |
| 37 CompositorFrameSink* compositor_frame_sink); |
| 37 void InitializeMutatorOnImpl(std::unique_ptr<LayerTreeMutator> mutator); | 38 void InitializeMutatorOnImpl(std::unique_ptr<LayerTreeMutator> mutator); |
| 38 void MainThreadHasStoppedFlingingOnImpl(); | 39 void MainThreadHasStoppedFlingingOnImpl(); |
| 39 void SetInputThrottledUntilCommitOnImpl(bool is_throttled); | 40 void SetInputThrottledUntilCommitOnImpl(bool is_throttled); |
| 40 void SetDeferCommitsOnImpl(bool defer_commits) const; | 41 void SetDeferCommitsOnImpl(bool defer_commits) const; |
| 41 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect); | 42 void SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect); |
| 42 void SetNeedsCommitOnImpl(); | 43 void SetNeedsCommitOnImpl(); |
| 43 void BeginMainFrameAbortedOnImpl( | 44 void BeginMainFrameAbortedOnImpl( |
| 44 CommitEarlyOutReason reason, | 45 CommitEarlyOutReason reason, |
| 45 base::TimeTicks main_thread_start_time, | 46 base::TimeTicks main_thread_start_time, |
| 46 std::vector<std::unique_ptr<SwapPromise>> swap_promises); | 47 std::vector<std::unique_ptr<SwapPromise>> swap_promises); |
| 47 void SetVisibleOnImpl(bool visible); | 48 void SetVisibleOnImpl(bool visible); |
| 48 void ReleaseOutputSurfaceOnImpl(CompletionEvent* completion); | 49 void ReleaseCompositorFrameSinkOnImpl(CompletionEvent* completion); |
| 49 void FinishGLOnImpl(CompletionEvent* completion); | 50 void FinishGLOnImpl(CompletionEvent* completion); |
| 50 void NotifyReadyToCommitOnImpl(CompletionEvent* completion, | 51 void NotifyReadyToCommitOnImpl(CompletionEvent* completion, |
| 51 LayerTreeHost* layer_tree_host, | 52 LayerTreeHost* layer_tree_host, |
| 52 base::TimeTicks main_thread_start_time, | 53 base::TimeTicks main_thread_start_time, |
| 53 bool hold_commit_for_activation); | 54 bool hold_commit_for_activation); |
| 54 | 55 |
| 55 void MainFrameWillHappenOnImplForTesting(CompletionEvent* completion, | 56 void MainFrameWillHappenOnImplForTesting(CompletionEvent* completion, |
| 56 bool* main_frame_will_happen); | 57 bool* main_frame_will_happen); |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 // The members of this struct should be accessed on the impl thread only when | 60 // The members of this struct should be accessed on the impl thread only when |
| 60 // the main thread is blocked for a commit. | 61 // the main thread is blocked for a commit. |
| 61 struct BlockedMainCommitOnly { | 62 struct BlockedMainCommitOnly { |
| 62 BlockedMainCommitOnly(); | 63 BlockedMainCommitOnly(); |
| 63 ~BlockedMainCommitOnly(); | 64 ~BlockedMainCommitOnly(); |
| 64 LayerTreeHost* layer_tree_host; | 65 LayerTreeHost* layer_tree_host; |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 // LayerTreeHostImplClient implementation | 68 // LayerTreeHostImplClient implementation |
| 68 void DidLoseOutputSurfaceOnImplThread() override; | 69 void DidLoseCompositorFrameSinkOnImplThread() override; |
| 69 void SetBeginFrameSource(BeginFrameSource* source) override; | 70 void SetBeginFrameSource(BeginFrameSource* source) override; |
| 70 void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override; | 71 void SetEstimatedParentDrawTime(base::TimeDelta draw_time) override; |
| 71 void DidSwapBuffersCompleteOnImplThread() override; | 72 void DidSwapBuffersCompleteOnImplThread() override; |
| 72 void OnCanDrawStateChanged(bool can_draw) override; | 73 void OnCanDrawStateChanged(bool can_draw) override; |
| 73 void NotifyReadyToActivate() override; | 74 void NotifyReadyToActivate() override; |
| 74 void NotifyReadyToDraw() override; | 75 void NotifyReadyToDraw() override; |
| 75 // Please call these 3 functions through | 76 // Please call these 3 functions through |
| 76 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and | 77 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and |
| 77 // SetNeedsOneBeginImplFrame(). | 78 // SetNeedsOneBeginImplFrame(). |
| 78 void SetNeedsRedrawOnImplThread() override; | 79 void SetNeedsRedrawOnImplThread() override; |
| 79 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) override; | 80 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) override; |
| 80 void SetNeedsOneBeginImplFrameOnImplThread() override; | 81 void SetNeedsOneBeginImplFrameOnImplThread() override; |
| 81 void SetNeedsPrepareTilesOnImplThread() override; | 82 void SetNeedsPrepareTilesOnImplThread() override; |
| 82 void SetNeedsCommitOnImplThread() override; | 83 void SetNeedsCommitOnImplThread() override; |
| 83 void SetVideoNeedsBeginFrames(bool needs_begin_frames) override; | 84 void SetVideoNeedsBeginFrames(bool needs_begin_frames) override; |
| 84 void PostAnimationEventsToMainThreadOnImplThread( | 85 void PostAnimationEventsToMainThreadOnImplThread( |
| 85 std::unique_ptr<AnimationEvents> events) override; | 86 std::unique_ptr<AnimationEvents> events) override; |
| 86 bool IsInsideDraw() override; | 87 bool IsInsideDraw() override; |
| 87 void RenewTreePriority() override; | 88 void RenewTreePriority() override; |
| 88 void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, | 89 void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, |
| 89 base::TimeDelta delay) override; | 90 base::TimeDelta delay) override; |
| 90 void DidActivateSyncTree() override; | 91 void DidActivateSyncTree() override; |
| 91 void WillPrepareTiles() override; | 92 void WillPrepareTiles() override; |
| 92 void DidPrepareTiles() override; | 93 void DidPrepareTiles() override; |
| 93 void DidCompletePageScaleAnimationOnImplThread() override; | 94 void DidCompletePageScaleAnimationOnImplThread() override; |
| 94 void OnDrawForOutputSurface(bool resourceless_software_draw) override; | 95 void OnDrawForCompositorFrameSink(bool resourceless_software_draw) override; |
| 95 | 96 |
| 96 // SchedulerClient implementation | 97 // SchedulerClient implementation |
| 97 void WillBeginImplFrame(const BeginFrameArgs& args) override; | 98 void WillBeginImplFrame(const BeginFrameArgs& args) override; |
| 98 void DidFinishImplFrame() override; | 99 void DidFinishImplFrame() override; |
| 99 void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override; | 100 void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override; |
| 100 DrawResult ScheduledActionDrawAndSwapIfPossible() override; | 101 DrawResult ScheduledActionDrawAndSwapIfPossible() override; |
| 101 DrawResult ScheduledActionDrawAndSwapForced() override; | 102 DrawResult ScheduledActionDrawAndSwapForced() override; |
| 102 void ScheduledActionCommit() override; | 103 void ScheduledActionCommit() override; |
| 103 void ScheduledActionActivateSyncTree() override; | 104 void ScheduledActionActivateSyncTree() override; |
| 104 void ScheduledActionBeginOutputSurfaceCreation() override; | 105 void ScheduledActionBeginCompositorFrameSinkCreation() override; |
| 105 void ScheduledActionPrepareTiles() override; | 106 void ScheduledActionPrepareTiles() override; |
| 106 void ScheduledActionInvalidateOutputSurface() override; | 107 void ScheduledActionInvalidateCompositorFrameSink() override; |
| 107 void SendBeginMainFrameNotExpectedSoon() override; | 108 void SendBeginMainFrameNotExpectedSoon() override; |
| 108 | 109 |
| 109 DrawResult DrawAndSwapInternal(bool forced_draw); | 110 DrawResult DrawAndSwapInternal(bool forced_draw); |
| 110 | 111 |
| 111 bool IsImplThread() const; | 112 bool IsImplThread() const; |
| 112 bool IsMainThreadBlocked() const; | 113 bool IsMainThreadBlocked() const; |
| 113 | 114 |
| 114 const int layer_tree_host_id_; | 115 const int layer_tree_host_id_; |
| 115 | 116 |
| 116 std::unique_ptr<Scheduler> scheduler_; | 117 std::unique_ptr<Scheduler> scheduler_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 146 // Use accessors instead of this variable directly. | 147 // Use accessors instead of this variable directly. |
| 147 BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_; | 148 BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_; |
| 148 BlockedMainCommitOnly& blocked_main_commit(); | 149 BlockedMainCommitOnly& blocked_main_commit(); |
| 149 | 150 |
| 150 DISALLOW_COPY_AND_ASSIGN(ProxyImpl); | 151 DISALLOW_COPY_AND_ASSIGN(ProxyImpl); |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 } // namespace cc | 154 } // namespace cc |
| 154 | 155 |
| 155 #endif // CC_TREES_PROXY_IMPL_H_ | 156 #endif // CC_TREES_PROXY_IMPL_H_ |
| OLD | NEW |