Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: cc/trees/proxy_impl.h

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/proxy_common.h ('k') | cc/trees/proxy_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/base/completion_event.h" 11 #include "cc/base/completion_event.h"
11 #include "cc/base/delayed_unique_notifier.h" 12 #include "cc/base/delayed_unique_notifier.h"
12 #include "cc/input/top_controls_state.h" 13 #include "cc/input/top_controls_state.h"
13 #include "cc/scheduler/scheduler.h" 14 #include "cc/scheduler/scheduler.h"
14 #include "cc/trees/channel_impl.h" 15 #include "cc/trees/channel_impl.h"
15 #include "cc/trees/layer_tree_host_impl.h" 16 #include "cc/trees/layer_tree_host_impl.h"
16 17
17 namespace cc { 18 namespace cc {
18 19
19 // This class aggregates all the interactions that the main side of the 20 // This class aggregates all the interactions that the main side of the
20 // compositor needs to have with the impl side. It is created and owned by the 21 // compositor needs to have with the impl side. It is created and owned by the
21 // ChannelImpl implementation. The class lives entirely on the impl thread. 22 // ChannelImpl implementation. The class lives entirely on the impl thread.
22 class CC_EXPORT ProxyImpl : public NON_EXPORTED_BASE(LayerTreeHostImplClient), 23 class CC_EXPORT ProxyImpl : public NON_EXPORTED_BASE(LayerTreeHostImplClient),
23 public NON_EXPORTED_BASE(SchedulerClient) { 24 public NON_EXPORTED_BASE(SchedulerClient) {
24 public: 25 public:
25 static scoped_ptr<ProxyImpl> Create( 26 static std::unique_ptr<ProxyImpl> Create(
26 ChannelImpl* channel_impl, 27 ChannelImpl* channel_impl,
27 LayerTreeHost* layer_tree_host, 28 LayerTreeHost* layer_tree_host,
28 TaskRunnerProvider* task_runner_provider, 29 TaskRunnerProvider* task_runner_provider,
29 scoped_ptr<BeginFrameSource> external_begin_frame_source); 30 std::unique_ptr<BeginFrameSource> external_begin_frame_source);
30 31
31 ~ProxyImpl() override; 32 ~ProxyImpl() override;
32 33
33 // Virtual for testing. 34 // Virtual for testing.
34 virtual void UpdateTopControlsStateOnImpl(TopControlsState constraints, 35 virtual void UpdateTopControlsStateOnImpl(TopControlsState constraints,
35 TopControlsState current, 36 TopControlsState current,
36 bool animate); 37 bool animate);
37 virtual void InitializeOutputSurfaceOnImpl(OutputSurface* output_surface); 38 virtual void InitializeOutputSurfaceOnImpl(OutputSurface* output_surface);
38 virtual void MainThreadHasStoppedFlingingOnImpl(); 39 virtual void MainThreadHasStoppedFlingingOnImpl();
39 virtual void SetInputThrottledUntilCommitOnImpl(bool is_throttled); 40 virtual void SetInputThrottledUntilCommitOnImpl(bool is_throttled);
(...skipping 13 matching lines...) Expand all
53 virtual void StartCommitOnImpl(CompletionEvent* completion, 54 virtual void StartCommitOnImpl(CompletionEvent* completion,
54 LayerTreeHost* layer_tree_host, 55 LayerTreeHost* layer_tree_host,
55 base::TimeTicks main_thread_start_time, 56 base::TimeTicks main_thread_start_time,
56 bool hold_commit_for_activation); 57 bool hold_commit_for_activation);
57 58
58 protected: 59 protected:
59 // protected for testing. 60 // protected for testing.
60 ProxyImpl(ChannelImpl* channel_impl, 61 ProxyImpl(ChannelImpl* channel_impl,
61 LayerTreeHost* layer_tree_host, 62 LayerTreeHost* layer_tree_host,
62 TaskRunnerProvider* task_runner_provider, 63 TaskRunnerProvider* task_runner_provider,
63 scoped_ptr<BeginFrameSource> external_begin_frame_source); 64 std::unique_ptr<BeginFrameSource> external_begin_frame_source);
64 65
65 private: 66 private:
66 // The members of this struct should be accessed on the impl thread only when 67 // The members of this struct should be accessed on the impl thread only when
67 // the main thread is blocked for a commit. 68 // the main thread is blocked for a commit.
68 struct BlockedMainCommitOnly { 69 struct BlockedMainCommitOnly {
69 BlockedMainCommitOnly(); 70 BlockedMainCommitOnly();
70 ~BlockedMainCommitOnly(); 71 ~BlockedMainCommitOnly();
71 LayerTreeHost* layer_tree_host; 72 LayerTreeHost* layer_tree_host;
72 }; 73 };
73 74
(...skipping 13 matching lines...) Expand all
87 // Please call these 3 functions through 88 // Please call these 3 functions through
88 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and 89 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and
89 // SetNeedsOneBeginImplFrame(). 90 // SetNeedsOneBeginImplFrame().
90 void SetNeedsRedrawOnImplThread() override; 91 void SetNeedsRedrawOnImplThread() override;
91 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) override; 92 void SetNeedsRedrawRectOnImplThread(const gfx::Rect& dirty_rect) override;
92 void SetNeedsOneBeginImplFrameOnImplThread() override; 93 void SetNeedsOneBeginImplFrameOnImplThread() override;
93 void SetNeedsPrepareTilesOnImplThread() override; 94 void SetNeedsPrepareTilesOnImplThread() override;
94 void SetNeedsCommitOnImplThread() override; 95 void SetNeedsCommitOnImplThread() override;
95 void SetVideoNeedsBeginFrames(bool needs_begin_frames) override; 96 void SetVideoNeedsBeginFrames(bool needs_begin_frames) override;
96 void PostAnimationEventsToMainThreadOnImplThread( 97 void PostAnimationEventsToMainThreadOnImplThread(
97 scoped_ptr<AnimationEvents> events) override; 98 std::unique_ptr<AnimationEvents> events) override;
98 bool IsInsideDraw() override; 99 bool IsInsideDraw() override;
99 void RenewTreePriority() override; 100 void RenewTreePriority() override;
100 void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, 101 void PostDelayedAnimationTaskOnImplThread(const base::Closure& task,
101 base::TimeDelta delay) override; 102 base::TimeDelta delay) override;
102 void DidActivateSyncTree() override; 103 void DidActivateSyncTree() override;
103 void WillPrepareTiles() override; 104 void WillPrepareTiles() override;
104 void DidPrepareTiles() override; 105 void DidPrepareTiles() override;
105 void DidCompletePageScaleAnimationOnImplThread() override; 106 void DidCompletePageScaleAnimationOnImplThread() override;
106 void OnDrawForOutputSurface(bool resourceless_software_draw) override; 107 void OnDrawForOutputSurface(bool resourceless_software_draw) override;
107 // This should only be called by LayerTreeHostImpl::PostFrameTimingEvents. 108 // This should only be called by LayerTreeHostImpl::PostFrameTimingEvents.
108 void PostFrameTimingEventsOnImplThread( 109 void PostFrameTimingEventsOnImplThread(
109 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 110 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
110 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) 111 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events)
111 override; 112 override;
112 113
113 // SchedulerClient implementation 114 // SchedulerClient implementation
114 void WillBeginImplFrame(const BeginFrameArgs& args) override; 115 void WillBeginImplFrame(const BeginFrameArgs& args) override;
115 void DidFinishImplFrame() override; 116 void DidFinishImplFrame() override;
116 void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override; 117 void ScheduledActionSendBeginMainFrame(const BeginFrameArgs& args) override;
117 DrawResult ScheduledActionDrawAndSwapIfPossible() override; 118 DrawResult ScheduledActionDrawAndSwapIfPossible() override;
118 DrawResult ScheduledActionDrawAndSwapForced() override; 119 DrawResult ScheduledActionDrawAndSwapForced() override;
119 void ScheduledActionCommit() override; 120 void ScheduledActionCommit() override;
120 void ScheduledActionActivateSyncTree() override; 121 void ScheduledActionActivateSyncTree() override;
121 void ScheduledActionBeginOutputSurfaceCreation() override; 122 void ScheduledActionBeginOutputSurfaceCreation() override;
122 void ScheduledActionPrepareTiles() override; 123 void ScheduledActionPrepareTiles() override;
123 void ScheduledActionInvalidateOutputSurface() override; 124 void ScheduledActionInvalidateOutputSurface() override;
124 void SendBeginFramesToChildren(const BeginFrameArgs& args) override; 125 void SendBeginFramesToChildren(const BeginFrameArgs& args) override;
125 void SendBeginMainFrameNotExpectedSoon() override; 126 void SendBeginMainFrameNotExpectedSoon() override;
126 127
127 DrawResult DrawAndSwapInternal(bool forced_draw); 128 DrawResult DrawAndSwapInternal(bool forced_draw);
128 129
129 bool IsImplThread() const; 130 bool IsImplThread() const;
130 bool IsMainThreadBlocked() const; 131 bool IsMainThreadBlocked() const;
131 132
132 const int layer_tree_host_id_; 133 const int layer_tree_host_id_;
133 134
134 scoped_ptr<Scheduler> scheduler_; 135 std::unique_ptr<Scheduler> scheduler_;
135 136
136 // Set when the main thread is waiting on a pending tree activation. 137 // Set when the main thread is waiting on a pending tree activation.
137 bool next_commit_waits_for_activation_; 138 bool next_commit_waits_for_activation_;
138 139
139 // Set when the main thread is waiting on a commit to complete or on a 140 // Set when the main thread is waiting on a commit to complete or on a
140 // pending tree activation. 141 // pending tree activation.
141 CompletionEvent* commit_completion_event_; 142 CompletionEvent* commit_completion_event_;
142 143
143 // Set when the next draw should post DidCommitAndDrawFrame to the main 144 // Set when the next draw should post DidCommitAndDrawFrame to the main
144 // thread. 145 // thread.
145 bool next_frame_is_newly_committed_frame_; 146 bool next_frame_is_newly_committed_frame_;
146 147
147 bool inside_draw_; 148 bool inside_draw_;
148 bool input_throttled_until_commit_; 149 bool input_throttled_until_commit_;
149 150
150 TaskRunnerProvider* task_runner_provider_; 151 TaskRunnerProvider* task_runner_provider_;
151 152
152 DelayedUniqueNotifier smoothness_priority_expiration_notifier_; 153 DelayedUniqueNotifier smoothness_priority_expiration_notifier_;
153 154
154 scoped_ptr<BeginFrameSource> external_begin_frame_source_; 155 std::unique_ptr<BeginFrameSource> external_begin_frame_source_;
155 scoped_ptr<BeginFrameSource> unthrottled_begin_frame_source_; 156 std::unique_ptr<BeginFrameSource> unthrottled_begin_frame_source_;
156 scoped_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_; 157 std::unique_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source_;
157 158
158 RenderingStatsInstrumentation* rendering_stats_instrumentation_; 159 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
159 160
160 // Values used to keep track of frame durations. Used only in frame timing. 161 // Values used to keep track of frame durations. Used only in frame timing.
161 BeginFrameArgs last_begin_main_frame_args_; 162 BeginFrameArgs last_begin_main_frame_args_;
162 BeginFrameArgs last_processed_begin_main_frame_args_; 163 BeginFrameArgs last_processed_begin_main_frame_args_;
163 164
164 scoped_ptr<LayerTreeHostImpl> layer_tree_host_impl_; 165 std::unique_ptr<LayerTreeHostImpl> layer_tree_host_impl_;
165 166
166 ChannelImpl* channel_impl_; 167 ChannelImpl* channel_impl_;
167 168
168 // Use accessors instead of this variable directly. 169 // Use accessors instead of this variable directly.
169 BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_; 170 BlockedMainCommitOnly main_thread_blocked_commit_vars_unsafe_;
170 BlockedMainCommitOnly& blocked_main_commit(); 171 BlockedMainCommitOnly& blocked_main_commit();
171 172
172 DISALLOW_COPY_AND_ASSIGN(ProxyImpl); 173 DISALLOW_COPY_AND_ASSIGN(ProxyImpl);
173 }; 174 };
174 175
175 } // namespace cc 176 } // namespace cc
176 177
177 #endif // CC_TREES_PROXY_IMPL_H_ 178 #endif // CC_TREES_PROXY_IMPL_H_
OLDNEW
« no previous file with comments | « cc/trees/proxy_common.h ('k') | cc/trees/proxy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698