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

Side by Side Diff: cc/trees/proxy_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/proxy_main.h ('k') | cc/trees/remote_channel_impl.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 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 #include "cc/trees/proxy_main.h" 5 #include "cc/trees/proxy_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "base/trace_event/trace_event_argument.h" 11 #include "base/trace_event/trace_event_argument.h"
12 #include "base/trace_event/trace_event_synthetic_delay.h" 12 #include "base/trace_event/trace_event_synthetic_delay.h"
13 #include "cc/animation/animation_events.h" 13 #include "cc/animation/animation_events.h"
14 #include "cc/debug/benchmark_instrumentation.h" 14 #include "cc/debug/benchmark_instrumentation.h"
15 #include "cc/debug/devtools_instrumentation.h" 15 #include "cc/debug/devtools_instrumentation.h"
16 #include "cc/output/output_surface.h" 16 #include "cc/output/output_surface.h"
17 #include "cc/output/swap_promise.h" 17 #include "cc/output/swap_promise.h"
18 #include "cc/trees/blocking_task_runner.h" 18 #include "cc/trees/blocking_task_runner.h"
19 #include "cc/trees/layer_tree_host.h" 19 #include "cc/trees/layer_tree_host.h"
20 #include "cc/trees/remote_channel_main.h" 20 #include "cc/trees/remote_channel_main.h"
21 #include "cc/trees/scoped_abort_remaining_swap_promises.h" 21 #include "cc/trees/scoped_abort_remaining_swap_promises.h"
22 #include "cc/trees/threaded_channel.h" 22 #include "cc/trees/threaded_channel.h"
23 23
24 namespace cc { 24 namespace cc {
25 25
26 scoped_ptr<ProxyMain> ProxyMain::CreateThreaded( 26 std::unique_ptr<ProxyMain> ProxyMain::CreateThreaded(
27 LayerTreeHost* layer_tree_host, 27 LayerTreeHost* layer_tree_host,
28 TaskRunnerProvider* task_runner_provider) { 28 TaskRunnerProvider* task_runner_provider) {
29 scoped_ptr<ProxyMain> proxy_main( 29 std::unique_ptr<ProxyMain> proxy_main(
30 new ProxyMain(layer_tree_host, task_runner_provider)); 30 new ProxyMain(layer_tree_host, task_runner_provider));
31 proxy_main->SetChannel( 31 proxy_main->SetChannel(
32 ThreadedChannel::Create(proxy_main.get(), task_runner_provider)); 32 ThreadedChannel::Create(proxy_main.get(), task_runner_provider));
33 return proxy_main; 33 return proxy_main;
34 } 34 }
35 35
36 scoped_ptr<ProxyMain> ProxyMain::CreateRemote( 36 std::unique_ptr<ProxyMain> ProxyMain::CreateRemote(
37 RemoteProtoChannel* remote_proto_channel, 37 RemoteProtoChannel* remote_proto_channel,
38 LayerTreeHost* layer_tree_host, 38 LayerTreeHost* layer_tree_host,
39 TaskRunnerProvider* task_runner_provider) { 39 TaskRunnerProvider* task_runner_provider) {
40 scoped_ptr<ProxyMain> proxy_main( 40 std::unique_ptr<ProxyMain> proxy_main(
41 new ProxyMain(layer_tree_host, task_runner_provider)); 41 new ProxyMain(layer_tree_host, task_runner_provider));
42 proxy_main->SetChannel(RemoteChannelMain::Create( 42 proxy_main->SetChannel(RemoteChannelMain::Create(
43 remote_proto_channel, proxy_main.get(), task_runner_provider)); 43 remote_proto_channel, proxy_main.get(), task_runner_provider));
44 return proxy_main; 44 return proxy_main;
45 } 45 }
46 46
47 ProxyMain::ProxyMain(LayerTreeHost* layer_tree_host, 47 ProxyMain::ProxyMain(LayerTreeHost* layer_tree_host,
48 TaskRunnerProvider* task_runner_provider) 48 TaskRunnerProvider* task_runner_provider)
49 : layer_tree_host_(layer_tree_host), 49 : layer_tree_host_(layer_tree_host),
50 task_runner_provider_(task_runner_provider), 50 task_runner_provider_(task_runner_provider),
51 layer_tree_host_id_(layer_tree_host->id()), 51 layer_tree_host_id_(layer_tree_host->id()),
52 max_requested_pipeline_stage_(NO_PIPELINE_STAGE), 52 max_requested_pipeline_stage_(NO_PIPELINE_STAGE),
53 current_pipeline_stage_(NO_PIPELINE_STAGE), 53 current_pipeline_stage_(NO_PIPELINE_STAGE),
54 final_pipeline_stage_(NO_PIPELINE_STAGE), 54 final_pipeline_stage_(NO_PIPELINE_STAGE),
55 commit_waits_for_activation_(false), 55 commit_waits_for_activation_(false),
56 started_(false), 56 started_(false),
57 defer_commits_(false) { 57 defer_commits_(false) {
58 TRACE_EVENT0("cc", "ProxyMain::ProxyMain"); 58 TRACE_EVENT0("cc", "ProxyMain::ProxyMain");
59 DCHECK(task_runner_provider_); 59 DCHECK(task_runner_provider_);
60 DCHECK(IsMainThread()); 60 DCHECK(IsMainThread());
61 } 61 }
62 62
63 ProxyMain::~ProxyMain() { 63 ProxyMain::~ProxyMain() {
64 TRACE_EVENT0("cc", "ProxyMain::~ProxyMain"); 64 TRACE_EVENT0("cc", "ProxyMain::~ProxyMain");
65 DCHECK(IsMainThread()); 65 DCHECK(IsMainThread());
66 DCHECK(!started_); 66 DCHECK(!started_);
67 } 67 }
68 68
69 void ProxyMain::SetChannel(scoped_ptr<ChannelMain> channel_main) { 69 void ProxyMain::SetChannel(std::unique_ptr<ChannelMain> channel_main) {
70 DCHECK(!channel_main_); 70 DCHECK(!channel_main_);
71 channel_main_ = std::move(channel_main); 71 channel_main_ = std::move(channel_main);
72 } 72 }
73 73
74 void ProxyMain::DidCompleteSwapBuffers() { 74 void ProxyMain::DidCompleteSwapBuffers() {
75 DCHECK(IsMainThread()); 75 DCHECK(IsMainThread());
76 layer_tree_host_->DidCompleteSwapBuffers(); 76 layer_tree_host_->DidCompleteSwapBuffers();
77 } 77 }
78 78
79 void ProxyMain::SetRendererCapabilities( 79 void ProxyMain::SetRendererCapabilities(
80 const RendererCapabilities& capabilities) { 80 const RendererCapabilities& capabilities) {
81 DCHECK(IsMainThread()); 81 DCHECK(IsMainThread());
82 renderer_capabilities_ = capabilities; 82 renderer_capabilities_ = capabilities;
83 } 83 }
84 84
85 void ProxyMain::BeginMainFrameNotExpectedSoon() { 85 void ProxyMain::BeginMainFrameNotExpectedSoon() {
86 TRACE_EVENT0("cc", "ProxyMain::BeginMainFrameNotExpectedSoon"); 86 TRACE_EVENT0("cc", "ProxyMain::BeginMainFrameNotExpectedSoon");
87 DCHECK(IsMainThread()); 87 DCHECK(IsMainThread());
88 layer_tree_host_->BeginMainFrameNotExpectedSoon(); 88 layer_tree_host_->BeginMainFrameNotExpectedSoon();
89 } 89 }
90 90
91 void ProxyMain::DidCommitAndDrawFrame() { 91 void ProxyMain::DidCommitAndDrawFrame() {
92 DCHECK(IsMainThread()); 92 DCHECK(IsMainThread());
93 layer_tree_host_->DidCommitAndDrawFrame(); 93 layer_tree_host_->DidCommitAndDrawFrame();
94 } 94 }
95 95
96 void ProxyMain::SetAnimationEvents(scoped_ptr<AnimationEvents> events) { 96 void ProxyMain::SetAnimationEvents(std::unique_ptr<AnimationEvents> events) {
97 TRACE_EVENT0("cc", "ProxyMain::SetAnimationEvents"); 97 TRACE_EVENT0("cc", "ProxyMain::SetAnimationEvents");
98 DCHECK(IsMainThread()); 98 DCHECK(IsMainThread());
99 layer_tree_host_->SetAnimationEvents(std::move(events)); 99 layer_tree_host_->SetAnimationEvents(std::move(events));
100 } 100 }
101 101
102 void ProxyMain::DidLoseOutputSurface() { 102 void ProxyMain::DidLoseOutputSurface() {
103 TRACE_EVENT0("cc", "ProxyMain::DidLoseOutputSurface"); 103 TRACE_EVENT0("cc", "ProxyMain::DidLoseOutputSurface");
104 DCHECK(IsMainThread()); 104 DCHECK(IsMainThread());
105 layer_tree_host_->DidLoseOutputSurface(); 105 layer_tree_host_->DidLoseOutputSurface();
106 } 106 }
(...skipping 16 matching lines...) Expand all
123 renderer_capabilities_ = capabilities; 123 renderer_capabilities_ = capabilities;
124 layer_tree_host_->DidInitializeOutputSurface(); 124 layer_tree_host_->DidInitializeOutputSurface();
125 } 125 }
126 126
127 void ProxyMain::DidCompletePageScaleAnimation() { 127 void ProxyMain::DidCompletePageScaleAnimation() {
128 DCHECK(IsMainThread()); 128 DCHECK(IsMainThread());
129 layer_tree_host_->DidCompletePageScaleAnimation(); 129 layer_tree_host_->DidCompletePageScaleAnimation();
130 } 130 }
131 131
132 void ProxyMain::PostFrameTimingEventsOnMain( 132 void ProxyMain::PostFrameTimingEventsOnMain(
133 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 133 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
134 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { 134 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
135 DCHECK(IsMainThread()); 135 DCHECK(IsMainThread());
136 layer_tree_host_->RecordFrameTimingEvents(std::move(composite_events), 136 layer_tree_host_->RecordFrameTimingEvents(std::move(composite_events),
137 std::move(main_frame_events)); 137 std::move(main_frame_events));
138 } 138 }
139 139
140 void ProxyMain::BeginMainFrame( 140 void ProxyMain::BeginMainFrame(
141 scoped_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { 141 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) {
142 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( 142 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task(
143 benchmark_instrumentation::kDoBeginFrame, 143 benchmark_instrumentation::kDoBeginFrame,
144 begin_main_frame_state->begin_frame_id); 144 begin_main_frame_state->begin_frame_id);
145 145
146 base::TimeTicks begin_main_frame_start_time = base::TimeTicks::Now(); 146 base::TimeTicks begin_main_frame_start_time = base::TimeTicks::Now();
147 147
148 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame"); 148 TRACE_EVENT_SYNTHETIC_DELAY_BEGIN("cc.BeginMainFrame");
149 DCHECK(IsMainThread()); 149 DCHECK(IsMainThread());
150 DCHECK_EQ(NO_PIPELINE_STAGE, current_pipeline_stage_); 150 DCHECK_EQ(NO_PIPELINE_STAGE, current_pipeline_stage_);
151 151
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 DCHECK(IsMainThread()); 375 DCHECK(IsMainThread());
376 return max_requested_pipeline_stage_ != NO_PIPELINE_STAGE; 376 return max_requested_pipeline_stage_ != NO_PIPELINE_STAGE;
377 } 377 }
378 378
379 void ProxyMain::MainThreadHasStoppedFlinging() { 379 void ProxyMain::MainThreadHasStoppedFlinging() {
380 DCHECK(IsMainThread()); 380 DCHECK(IsMainThread());
381 channel_main_->MainThreadHasStoppedFlingingOnImpl(); 381 channel_main_->MainThreadHasStoppedFlingingOnImpl();
382 } 382 }
383 383
384 void ProxyMain::Start( 384 void ProxyMain::Start(
385 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 385 std::unique_ptr<BeginFrameSource> external_begin_frame_source) {
386 DCHECK(IsMainThread()); 386 DCHECK(IsMainThread());
387 DCHECK(layer_tree_host_->IsThreaded() || layer_tree_host_->IsRemoteServer()); 387 DCHECK(layer_tree_host_->IsThreaded() || layer_tree_host_->IsRemoteServer());
388 DCHECK(channel_main_); 388 DCHECK(channel_main_);
389 DCHECK(!layer_tree_host_->settings().use_external_begin_frame_source || 389 DCHECK(!layer_tree_host_->settings().use_external_begin_frame_source ||
390 external_begin_frame_source); 390 external_begin_frame_source);
391 391
392 // Create LayerTreeHostImpl. 392 // Create LayerTreeHostImpl.
393 channel_main_->SynchronouslyInitializeImpl( 393 channel_main_->SynchronouslyInitializeImpl(
394 layer_tree_host_, std::move(external_begin_frame_source)); 394 layer_tree_host_, std::move(external_begin_frame_source));
395 395
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 return false; 464 return false;
465 channel_main_->SetNeedsCommitOnImpl(); 465 channel_main_->SetNeedsCommitOnImpl();
466 return true; 466 return true;
467 } 467 }
468 468
469 bool ProxyMain::IsMainThread() const { 469 bool ProxyMain::IsMainThread() const {
470 return task_runner_provider_->IsMainThread(); 470 return task_runner_provider_->IsMainThread();
471 } 471 }
472 472
473 } // namespace cc 473 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/proxy_main.h ('k') | cc/trees/remote_channel_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698