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

Side by Side Diff: cc/trees/remote_channel_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_main.cc ('k') | cc/trees/remote_channel_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_REMOTE_CHANNEL_IMPL_H_ 5 #ifndef CC_TREES_REMOTE_CHANNEL_IMPL_H_
6 #define CC_TREES_REMOTE_CHANNEL_IMPL_H_ 6 #define CC_TREES_REMOTE_CHANNEL_IMPL_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "cc/base/cc_export.h" 10 #include "cc/base/cc_export.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // The RemoteChannelImpl receives and processes messages from the remote server 71 // The RemoteChannelImpl receives and processes messages from the remote server
72 // compositor on the main thread. The requests from ProxyImpl are received on 72 // compositor on the main thread. The requests from ProxyImpl are received on
73 // the impl thread which may be directed to the LayerTreeHost on the client 73 // the impl thread which may be directed to the LayerTreeHost on the client
74 // (for instance output surface requests) or sent to the LayerTreeHost on the 74 // (for instance output surface requests) or sent to the LayerTreeHost on the
75 // server. The messages to the server are created on the impl thread and sent 75 // server. The messages to the server are created on the impl thread and sent
76 // using the RemoteProtoChannel on the main thread. 76 // using the RemoteProtoChannel on the main thread.
77 class CC_EXPORT RemoteChannelImpl : public ChannelImpl, 77 class CC_EXPORT RemoteChannelImpl : public ChannelImpl,
78 public RemoteProtoChannel::ProtoReceiver, 78 public RemoteProtoChannel::ProtoReceiver,
79 public Proxy { 79 public Proxy {
80 public: 80 public:
81 static scoped_ptr<RemoteChannelImpl> Create( 81 static std::unique_ptr<RemoteChannelImpl> Create(
82 LayerTreeHost* layer_tree_host, 82 LayerTreeHost* layer_tree_host,
83 RemoteProtoChannel* remote_proto_channel, 83 RemoteProtoChannel* remote_proto_channel,
84 TaskRunnerProvider* task_runner_provider); 84 TaskRunnerProvider* task_runner_provider);
85 85
86 ~RemoteChannelImpl() override; 86 ~RemoteChannelImpl() override;
87 87
88 protected: 88 protected:
89 RemoteChannelImpl(LayerTreeHost* layer_tree_host, 89 RemoteChannelImpl(LayerTreeHost* layer_tree_host,
90 RemoteProtoChannel* remote_proto_channel, 90 RemoteProtoChannel* remote_proto_channel,
91 TaskRunnerProvider* task_runner_provider); 91 TaskRunnerProvider* task_runner_provider);
92 92
93 // virtual for testing. 93 // virtual for testing.
94 virtual scoped_ptr<ProxyImpl> CreateProxyImpl( 94 virtual std::unique_ptr<ProxyImpl> CreateProxyImpl(
95 ChannelImpl* channel_impl, 95 ChannelImpl* channel_impl,
96 LayerTreeHost* layer_tree_host, 96 LayerTreeHost* layer_tree_host,
97 TaskRunnerProvider* task_runner_provider, 97 TaskRunnerProvider* task_runner_provider,
98 scoped_ptr<BeginFrameSource> external_begin_frame_source); 98 std::unique_ptr<BeginFrameSource> external_begin_frame_source);
99 99
100 private: 100 private:
101 struct MainThreadOnly { 101 struct MainThreadOnly {
102 LayerTreeHost* layer_tree_host; 102 LayerTreeHost* layer_tree_host;
103 RemoteProtoChannel* remote_proto_channel; 103 RemoteProtoChannel* remote_proto_channel;
104 104
105 bool started; 105 bool started;
106 106
107 // This is set to true if we lost the output surface and can not push any 107 // This is set to true if we lost the output surface and can not push any
108 // commits to the impl thread. 108 // commits to the impl thread.
109 bool waiting_for_output_surface_initialization; 109 bool waiting_for_output_surface_initialization;
110 110
111 // The queue of messages received from the server. The messages are added to 111 // The queue of messages received from the server. The messages are added to
112 // this queue if we are waiting for a new output surface to be initialized. 112 // this queue if we are waiting for a new output surface to be initialized.
113 std::queue<proto::CompositorMessageToImpl> pending_messages; 113 std::queue<proto::CompositorMessageToImpl> pending_messages;
114 114
115 RendererCapabilities renderer_capabilities; 115 RendererCapabilities renderer_capabilities;
116 116
117 base::WeakPtrFactory<RemoteChannelImpl> remote_channel_weak_factory; 117 base::WeakPtrFactory<RemoteChannelImpl> remote_channel_weak_factory;
118 118
119 MainThreadOnly(RemoteChannelImpl*, 119 MainThreadOnly(RemoteChannelImpl*,
120 LayerTreeHost* layer_tree_host, 120 LayerTreeHost* layer_tree_host,
121 RemoteProtoChannel* remote_proto_channel); 121 RemoteProtoChannel* remote_proto_channel);
122 ~MainThreadOnly(); 122 ~MainThreadOnly();
123 }; 123 };
124 124
125 struct CompositorThreadOnly { 125 struct CompositorThreadOnly {
126 scoped_ptr<ProxyImpl> proxy_impl; 126 std::unique_ptr<ProxyImpl> proxy_impl;
127 scoped_ptr<base::WeakPtrFactory<ProxyImpl>> proxy_impl_weak_factory; 127 std::unique_ptr<base::WeakPtrFactory<ProxyImpl>> proxy_impl_weak_factory;
128 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr; 128 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr;
129 129
130 CompositorThreadOnly( 130 CompositorThreadOnly(
131 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr); 131 base::WeakPtr<RemoteChannelImpl> remote_channel_weak_ptr);
132 ~CompositorThreadOnly(); 132 ~CompositorThreadOnly();
133 }; 133 };
134 134
135 // called on main thread. 135 // called on main thread.
136 // RemoteProtoChannel::ProtoReceiver implementation. 136 // RemoteProtoChannel::ProtoReceiver implementation.
137 void OnProtoReceived(scoped_ptr<proto::CompositorMessage> proto) override; 137 void OnProtoReceived(
138 std::unique_ptr<proto::CompositorMessage> proto) override;
138 139
139 // Proxy implementation 140 // Proxy implementation
140 void FinishAllRendering() override; 141 void FinishAllRendering() override;
141 bool IsStarted() const override; 142 bool IsStarted() const override;
142 bool CommitToActiveTree() const override; 143 bool CommitToActiveTree() const override;
143 void SetOutputSurface(OutputSurface* output_surface) override; 144 void SetOutputSurface(OutputSurface* output_surface) override;
144 void ReleaseOutputSurface() override; 145 void ReleaseOutputSurface() override;
145 void SetVisible(bool visible) override; 146 void SetVisible(bool visible) override;
146 const RendererCapabilities& GetRendererCapabilities() const override; 147 const RendererCapabilities& GetRendererCapabilities() const override;
147 void SetNeedsAnimate() override; 148 void SetNeedsAnimate() override;
148 void SetNeedsUpdateLayers() override; 149 void SetNeedsUpdateLayers() override;
149 void SetNeedsCommit() override; 150 void SetNeedsCommit() override;
150 void SetNeedsRedraw(const gfx::Rect& damage_rect) override; 151 void SetNeedsRedraw(const gfx::Rect& damage_rect) override;
151 void SetNextCommitWaitsForActivation() override; 152 void SetNextCommitWaitsForActivation() override;
152 void NotifyInputThrottledUntilCommit() override; 153 void NotifyInputThrottledUntilCommit() override;
153 void SetDeferCommits(bool defer_commits) override; 154 void SetDeferCommits(bool defer_commits) override;
154 void MainThreadHasStoppedFlinging() override; 155 void MainThreadHasStoppedFlinging() override;
155 bool CommitRequested() const override; 156 bool CommitRequested() const override;
156 bool BeginMainFrameRequested() const override; 157 bool BeginMainFrameRequested() const override;
157 void Start(scoped_ptr<BeginFrameSource> external_begin_frame_source) override; 158 void Start(
159 std::unique_ptr<BeginFrameSource> external_begin_frame_source) override;
158 void Stop() override; 160 void Stop() override;
159 bool SupportsImplScrolling() const override; 161 bool SupportsImplScrolling() const override;
160 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) override; 162 void SetChildrenNeedBeginFrames(bool children_need_begin_frames) override;
161 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval) override; 163 void SetAuthoritativeVSyncInterval(const base::TimeDelta& interval) override;
162 void UpdateTopControlsState(TopControlsState constraints, 164 void UpdateTopControlsState(TopControlsState constraints,
163 TopControlsState current, 165 TopControlsState current,
164 bool animate) override; 166 bool animate) override;
165 void SetOutputIsSecure(bool output_is_secure) override; 167 void SetOutputIsSecure(bool output_is_secure) override;
166 bool MainFrameWillHappenForTesting() override; 168 bool MainFrameWillHappenForTesting() override;
167 169
168 // Called on impl thread. 170 // Called on impl thread.
169 // ChannelImpl implementation 171 // ChannelImpl implementation
170 void DidCompleteSwapBuffers() override; 172 void DidCompleteSwapBuffers() override;
171 void SetRendererCapabilitiesMainCopy( 173 void SetRendererCapabilitiesMainCopy(
172 const RendererCapabilities& capabilities) override; 174 const RendererCapabilities& capabilities) override;
173 void BeginMainFrameNotExpectedSoon() override; 175 void BeginMainFrameNotExpectedSoon() override;
174 void DidCommitAndDrawFrame() override; 176 void DidCommitAndDrawFrame() override;
175 void SetAnimationEvents(scoped_ptr<AnimationEvents> queue) override; 177 void SetAnimationEvents(std::unique_ptr<AnimationEvents> queue) override;
176 void DidLoseOutputSurface() override; 178 void DidLoseOutputSurface() override;
177 void RequestNewOutputSurface() override; 179 void RequestNewOutputSurface() override;
178 void DidInitializeOutputSurface( 180 void DidInitializeOutputSurface(
179 bool success, 181 bool success,
180 const RendererCapabilities& capabilities) override; 182 const RendererCapabilities& capabilities) override;
181 void DidCompletePageScaleAnimation() override; 183 void DidCompletePageScaleAnimation() override;
182 void PostFrameTimingEventsOnMain( 184 void PostFrameTimingEventsOnMain(
183 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 185 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
184 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) 186 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events)
185 override; 187 override;
186 void BeginMainFrame( 188 void BeginMainFrame(std::unique_ptr<BeginMainFrameAndCommitState>
187 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) override; 189 begin_main_frame_state) override;
188 190
189 void SendMessageProto(scoped_ptr<proto::CompositorMessage> proto); 191 void SendMessageProto(std::unique_ptr<proto::CompositorMessage> proto);
190 192
191 // called on main thread. 193 // called on main thread.
192 void HandleProto(const proto::CompositorMessageToImpl& proto); 194 void HandleProto(const proto::CompositorMessageToImpl& proto);
193 void DidLoseOutputSurfaceOnMain(); 195 void DidLoseOutputSurfaceOnMain();
194 void RequestNewOutputSurfaceOnMain(); 196 void RequestNewOutputSurfaceOnMain();
195 void DidInitializeOutputSurfaceOnMain( 197 void DidInitializeOutputSurfaceOnMain(
196 bool success, 198 bool success,
197 const RendererCapabilities& capabilities); 199 const RendererCapabilities& capabilities);
198 void SendMessageProtoOnMain(scoped_ptr<proto::CompositorMessage> proto); 200 void SendMessageProtoOnMain(std::unique_ptr<proto::CompositorMessage> proto);
199 void PostSetNeedsRedrawToImpl(const gfx::Rect& damaged_rect); 201 void PostSetNeedsRedrawToImpl(const gfx::Rect& damaged_rect);
200 202
201 void InitializeImplOnImpl(CompletionEvent* completion, 203 void InitializeImplOnImpl(CompletionEvent* completion,
202 LayerTreeHost* layer_tree_host); 204 LayerTreeHost* layer_tree_host);
203 void ShutdownImplOnImpl(CompletionEvent* completion); 205 void ShutdownImplOnImpl(CompletionEvent* completion);
204 206
205 MainThreadOnly& main(); 207 MainThreadOnly& main();
206 const MainThreadOnly& main() const; 208 const MainThreadOnly& main() const;
207 CompositorThreadOnly& impl(); 209 CompositorThreadOnly& impl();
208 const CompositorThreadOnly& impl() const; 210 const CompositorThreadOnly& impl() const;
209 211
210 base::SingleThreadTaskRunner* MainThreadTaskRunner() const; 212 base::SingleThreadTaskRunner* MainThreadTaskRunner() const;
211 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const; 213 base::SingleThreadTaskRunner* ImplThreadTaskRunner() const;
212 214
213 TaskRunnerProvider* task_runner_provider_; 215 TaskRunnerProvider* task_runner_provider_;
214 216
215 // use accessors instead of these variables directly 217 // use accessors instead of these variables directly
216 MainThreadOnly main_thread_vars_unsafe_; 218 MainThreadOnly main_thread_vars_unsafe_;
217 CompositorThreadOnly compositor_thread_vars_unsafe_; 219 CompositorThreadOnly compositor_thread_vars_unsafe_;
218 220
219 base::WeakPtr<ProxyImpl> proxy_impl_weak_ptr_; 221 base::WeakPtr<ProxyImpl> proxy_impl_weak_ptr_;
220 222
221 DISALLOW_COPY_AND_ASSIGN(RemoteChannelImpl); 223 DISALLOW_COPY_AND_ASSIGN(RemoteChannelImpl);
222 }; 224 };
223 225
224 } // namespace cc 226 } // namespace cc
225 227
226 #endif // CC_TREES_REMOTE_CHANNEL_IMPL_H_ 228 #endif // CC_TREES_REMOTE_CHANNEL_IMPL_H_
OLDNEW
« no previous file with comments | « cc/trees/proxy_main.cc ('k') | cc/trees/remote_channel_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698