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

Side by Side Diff: cc/trees/remote_channel_main.cc

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/remote_channel_main.h ('k') | cc/trees/remote_proto_channel.h » ('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 #include "cc/trees/remote_channel_main.h" 5 #include "cc/trees/remote_channel_main.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include <memory>
8
9 #include "base/memory/ptr_util.h"
8 #include "cc/proto/base_conversions.h" 10 #include "cc/proto/base_conversions.h"
9 #include "cc/proto/compositor_message.pb.h" 11 #include "cc/proto/compositor_message.pb.h"
10 #include "cc/proto/compositor_message_to_impl.pb.h" 12 #include "cc/proto/compositor_message_to_impl.pb.h"
11 #include "cc/proto/compositor_message_to_main.pb.h" 13 #include "cc/proto/compositor_message_to_main.pb.h"
12 #include "cc/proto/gfx_conversions.h" 14 #include "cc/proto/gfx_conversions.h"
13 #include "cc/trees/layer_tree_host.h" 15 #include "cc/trees/layer_tree_host.h"
14 #include "cc/trees/proxy_main.h" 16 #include "cc/trees/proxy_main.h"
15 17
16 namespace cc { 18 namespace cc {
17 19
18 scoped_ptr<RemoteChannelMain> RemoteChannelMain::Create( 20 std::unique_ptr<RemoteChannelMain> RemoteChannelMain::Create(
19 RemoteProtoChannel* remote_proto_channel, 21 RemoteProtoChannel* remote_proto_channel,
20 ProxyMain* proxy_main, 22 ProxyMain* proxy_main,
21 TaskRunnerProvider* task_runner_provider) { 23 TaskRunnerProvider* task_runner_provider) {
22 return make_scoped_ptr(new RemoteChannelMain(remote_proto_channel, proxy_main, 24 return base::WrapUnique(new RemoteChannelMain(
23 task_runner_provider)); 25 remote_proto_channel, proxy_main, task_runner_provider));
24 } 26 }
25 27
26 RemoteChannelMain::RemoteChannelMain(RemoteProtoChannel* remote_proto_channel, 28 RemoteChannelMain::RemoteChannelMain(RemoteProtoChannel* remote_proto_channel,
27 ProxyMain* proxy_main, 29 ProxyMain* proxy_main,
28 TaskRunnerProvider* task_runner_provider) 30 TaskRunnerProvider* task_runner_provider)
29 : remote_proto_channel_(remote_proto_channel), 31 : remote_proto_channel_(remote_proto_channel),
30 proxy_main_(proxy_main), 32 proxy_main_(proxy_main),
31 task_runner_provider_(task_runner_provider), 33 task_runner_provider_(task_runner_provider),
32 initialized_(false), 34 initialized_(false),
33 weak_factory_(this) { 35 weak_factory_(this) {
34 DCHECK(remote_proto_channel_); 36 DCHECK(remote_proto_channel_);
35 DCHECK(proxy_main_); 37 DCHECK(proxy_main_);
36 DCHECK(task_runner_provider_); 38 DCHECK(task_runner_provider_);
37 DCHECK(task_runner_provider_->IsMainThread()); 39 DCHECK(task_runner_provider_->IsMainThread());
38 remote_proto_channel_->SetProtoReceiver(this); 40 remote_proto_channel_->SetProtoReceiver(this);
39 } 41 }
40 42
41 RemoteChannelMain::~RemoteChannelMain() { 43 RemoteChannelMain::~RemoteChannelMain() {
42 DCHECK(task_runner_provider_->IsMainThread()); 44 DCHECK(task_runner_provider_->IsMainThread());
43 DCHECK(!initialized_); 45 DCHECK(!initialized_);
44 46
45 remote_proto_channel_->SetProtoReceiver(nullptr); 47 remote_proto_channel_->SetProtoReceiver(nullptr);
46 } 48 }
47 49
48 void RemoteChannelMain::OnProtoReceived( 50 void RemoteChannelMain::OnProtoReceived(
49 scoped_ptr<proto::CompositorMessage> proto) { 51 std::unique_ptr<proto::CompositorMessage> proto) {
50 DCHECK(task_runner_provider_->IsMainThread()); 52 DCHECK(task_runner_provider_->IsMainThread());
51 DCHECK(proto->has_to_main()); 53 DCHECK(proto->has_to_main());
52 54
53 HandleProto(proto->to_main()); 55 HandleProto(proto->to_main());
54 } 56 }
55 57
56 void RemoteChannelMain::UpdateTopControlsStateOnImpl( 58 void RemoteChannelMain::UpdateTopControlsStateOnImpl(
57 TopControlsState constraints, 59 TopControlsState constraints,
58 TopControlsState current, 60 TopControlsState current,
59 bool animate) {} 61 bool animate) {}
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // behaviour in the threaded compositor. 186 // behaviour in the threaded compositor.
185 MainThreadTaskRunner()->PostTask( 187 MainThreadTaskRunner()->PostTask(
186 FROM_HERE, base::Bind(&RemoteChannelMain::DidCommitAndDrawFrame, 188 FROM_HERE, base::Bind(&RemoteChannelMain::DidCommitAndDrawFrame,
187 weak_factory_.GetWeakPtr())); 189 weak_factory_.GetWeakPtr()));
188 190
189 completion->Signal(); 191 completion->Signal();
190 } 192 }
191 193
192 void RemoteChannelMain::SynchronouslyInitializeImpl( 194 void RemoteChannelMain::SynchronouslyInitializeImpl(
193 LayerTreeHost* layer_tree_host, 195 LayerTreeHost* layer_tree_host,
194 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 196 std::unique_ptr<BeginFrameSource> external_begin_frame_source) {
195 DCHECK(!initialized_); 197 DCHECK(!initialized_);
196 198
197 proto::CompositorMessage proto; 199 proto::CompositorMessage proto;
198 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl(); 200 proto::CompositorMessageToImpl* to_impl_proto = proto.mutable_to_impl();
199 to_impl_proto->set_message_type( 201 to_impl_proto->set_message_type(
200 proto::CompositorMessageToImpl::INITIALIZE_IMPL); 202 proto::CompositorMessageToImpl::INITIALIZE_IMPL);
201 proto::InitializeImpl* initialize_impl_proto = 203 proto::InitializeImpl* initialize_impl_proto =
202 to_impl_proto->mutable_initialize_impl_message(); 204 to_impl_proto->mutable_initialize_impl_message();
203 proto::LayerTreeSettings* settings_proto = 205 proto::LayerTreeSettings* settings_proto =
204 initialize_impl_proto->mutable_layer_tree_settings(); 206 initialize_impl_proto->mutable_layer_tree_settings();
(...skipping 25 matching lines...) Expand all
230 DCHECK(proto.has_message_type()); 232 DCHECK(proto.has_message_type());
231 233
232 switch (proto.message_type()) { 234 switch (proto.message_type()) {
233 case proto::CompositorMessageToMain::UNKNOWN: 235 case proto::CompositorMessageToMain::UNKNOWN:
234 NOTIMPLEMENTED() << "Ignoring message proto of unknown type"; 236 NOTIMPLEMENTED() << "Ignoring message proto of unknown type";
235 break; 237 break;
236 case proto::CompositorMessageToMain::BEGIN_MAIN_FRAME: { 238 case proto::CompositorMessageToMain::BEGIN_MAIN_FRAME: {
237 VLOG(1) << "Received BeginMainFrame request from client."; 239 VLOG(1) << "Received BeginMainFrame request from client.";
238 const proto::BeginMainFrame& begin_main_frame_message = 240 const proto::BeginMainFrame& begin_main_frame_message =
239 proto.begin_main_frame_message(); 241 proto.begin_main_frame_message();
240 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state; 242 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state;
241 begin_main_frame_state.reset(new BeginMainFrameAndCommitState); 243 begin_main_frame_state.reset(new BeginMainFrameAndCommitState);
242 begin_main_frame_state->FromProtobuf( 244 begin_main_frame_state->FromProtobuf(
243 begin_main_frame_message.begin_main_frame_state()); 245 begin_main_frame_message.begin_main_frame_state());
244 proxy_main_->BeginMainFrame(std::move(begin_main_frame_state)); 246 proxy_main_->BeginMainFrame(std::move(begin_main_frame_state));
245 } break; 247 } break;
246 } 248 }
247 } 249 }
248 250
249 void RemoteChannelMain::DidCommitAndDrawFrame() { 251 void RemoteChannelMain::DidCommitAndDrawFrame() {
250 proxy_main_->DidCommitAndDrawFrame(); 252 proxy_main_->DidCommitAndDrawFrame();
251 DidCompleteSwapBuffers(); 253 DidCompleteSwapBuffers();
252 } 254 }
253 255
254 void RemoteChannelMain::DidCompleteSwapBuffers() { 256 void RemoteChannelMain::DidCompleteSwapBuffers() {
255 proxy_main_->DidCompleteSwapBuffers(); 257 proxy_main_->DidCompleteSwapBuffers();
256 } 258 }
257 259
258 base::SingleThreadTaskRunner* RemoteChannelMain::MainThreadTaskRunner() const { 260 base::SingleThreadTaskRunner* RemoteChannelMain::MainThreadTaskRunner() const {
259 return task_runner_provider_->MainThreadTaskRunner(); 261 return task_runner_provider_->MainThreadTaskRunner();
260 } 262 }
261 263
262 } // namespace cc 264 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/remote_channel_main.h ('k') | cc/trees/remote_proto_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698