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

Side by Side Diff: cc/trees/layer_tree_host.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: 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 auto layer_it = layer_id_map.find(layer_id); 76 auto layer_it = layer_id_map.find(layer_id);
77 DCHECK(layer_it != layer_id_map.end()); 77 DCHECK(layer_it != layer_id_map.end());
78 if (current_layer && current_layer != layer_it->second) 78 if (current_layer && current_layer != layer_it->second)
79 current_layer->SetLayerTreeHost(nullptr); 79 current_layer->SetLayerTreeHost(nullptr);
80 80
81 return layer_it->second; 81 return layer_it->second;
82 } 82 }
83 83
84 scoped_ptr<base::trace_event::TracedValue> 84 std::unique_ptr<base::trace_event::TracedValue>
85 ComputeLayerTreeHostProtoSizeSplitAsValue(proto::LayerTreeHost* proto) { 85 ComputeLayerTreeHostProtoSizeSplitAsValue(proto::LayerTreeHost* proto) {
86 scoped_ptr<base::trace_event::TracedValue> value( 86 std::unique_ptr<base::trace_event::TracedValue> value(
87 new base::trace_event::TracedValue()); 87 new base::trace_event::TracedValue());
88 base::CheckedNumeric<int> base_layer_properties_size = 0; 88 base::CheckedNumeric<int> base_layer_properties_size = 0;
89 base::CheckedNumeric<int> picture_layer_properties_size = 0; 89 base::CheckedNumeric<int> picture_layer_properties_size = 0;
90 base::CheckedNumeric<int> display_item_list_size = 0; 90 base::CheckedNumeric<int> display_item_list_size = 0;
91 base::CheckedNumeric<int> drawing_display_items_size = 0; 91 base::CheckedNumeric<int> drawing_display_items_size = 0;
92 92
93 const proto::LayerUpdate& layer_update_proto = proto->layer_updates(); 93 const proto::LayerUpdate& layer_update_proto = proto->layer_updates();
94 for (int i = 0; i < layer_update_proto.layers_size(); ++i) { 94 for (int i = 0; i < layer_update_proto.layers_size(); ++i) {
95 const proto::LayerProperties layer_properties_proto = 95 const proto::LayerProperties layer_properties_proto =
96 layer_update_proto.layers(i); 96 layer_update_proto.layers(i);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 133 }
134 134
135 } // namespace 135 } // namespace
136 136
137 LayerTreeHost::InitParams::InitParams() { 137 LayerTreeHost::InitParams::InitParams() {
138 } 138 }
139 139
140 LayerTreeHost::InitParams::~InitParams() { 140 LayerTreeHost::InitParams::~InitParams() {
141 } 141 }
142 142
143 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded( 143 std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded(
144 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 144 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
145 InitParams* params) { 145 InitParams* params) {
146 DCHECK(params->main_task_runner.get()); 146 DCHECK(params->main_task_runner.get());
147 DCHECK(impl_task_runner.get()); 147 DCHECK(impl_task_runner.get());
148 DCHECK(params->settings); 148 DCHECK(params->settings);
149 scoped_ptr<LayerTreeHost> layer_tree_host( 149 std::unique_ptr<LayerTreeHost> layer_tree_host(
150 new LayerTreeHost(params, CompositorMode::THREADED)); 150 new LayerTreeHost(params, CompositorMode::THREADED));
151 layer_tree_host->InitializeThreaded( 151 layer_tree_host->InitializeThreaded(
152 params->main_task_runner, impl_task_runner, 152 params->main_task_runner, impl_task_runner,
153 std::move(params->external_begin_frame_source)); 153 std::move(params->external_begin_frame_source));
154 return layer_tree_host; 154 return layer_tree_host;
155 } 155 }
156 156
157 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( 157 std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded(
158 LayerTreeHostSingleThreadClient* single_thread_client, 158 LayerTreeHostSingleThreadClient* single_thread_client,
159 InitParams* params) { 159 InitParams* params) {
160 DCHECK(params->settings); 160 DCHECK(params->settings);
161 scoped_ptr<LayerTreeHost> layer_tree_host( 161 std::unique_ptr<LayerTreeHost> layer_tree_host(
162 new LayerTreeHost(params, CompositorMode::SINGLE_THREADED)); 162 new LayerTreeHost(params, CompositorMode::SINGLE_THREADED));
163 layer_tree_host->InitializeSingleThreaded( 163 layer_tree_host->InitializeSingleThreaded(
164 single_thread_client, params->main_task_runner, 164 single_thread_client, params->main_task_runner,
165 std::move(params->external_begin_frame_source)); 165 std::move(params->external_begin_frame_source));
166 return layer_tree_host; 166 return layer_tree_host;
167 } 167 }
168 168
169 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateRemoteServer( 169 std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateRemoteServer(
170 RemoteProtoChannel* remote_proto_channel, 170 RemoteProtoChannel* remote_proto_channel,
171 InitParams* params) { 171 InitParams* params) {
172 DCHECK(params->main_task_runner.get()); 172 DCHECK(params->main_task_runner.get());
173 DCHECK(params->settings); 173 DCHECK(params->settings);
174 DCHECK(remote_proto_channel); 174 DCHECK(remote_proto_channel);
175 175
176 // Using an external begin frame source is not supported on the server in 176 // Using an external begin frame source is not supported on the server in
177 // remote mode. 177 // remote mode.
178 DCHECK(!params->settings->use_external_begin_frame_source); 178 DCHECK(!params->settings->use_external_begin_frame_source);
179 DCHECK(!params->external_begin_frame_source); 179 DCHECK(!params->external_begin_frame_source);
180 DCHECK(params->image_serialization_processor); 180 DCHECK(params->image_serialization_processor);
181 181
182 scoped_ptr<LayerTreeHost> layer_tree_host( 182 std::unique_ptr<LayerTreeHost> layer_tree_host(
183 new LayerTreeHost(params, CompositorMode::REMOTE)); 183 new LayerTreeHost(params, CompositorMode::REMOTE));
184 layer_tree_host->InitializeRemoteServer(remote_proto_channel, 184 layer_tree_host->InitializeRemoteServer(remote_proto_channel,
185 params->main_task_runner); 185 params->main_task_runner);
186 return layer_tree_host; 186 return layer_tree_host;
187 } 187 }
188 188
189 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateRemoteClient( 189 std::unique_ptr<LayerTreeHost> LayerTreeHost::CreateRemoteClient(
190 RemoteProtoChannel* remote_proto_channel, 190 RemoteProtoChannel* remote_proto_channel,
191 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 191 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
192 InitParams* params) { 192 InitParams* params) {
193 DCHECK(params->main_task_runner.get()); 193 DCHECK(params->main_task_runner.get());
194 DCHECK(params->settings); 194 DCHECK(params->settings);
195 DCHECK(remote_proto_channel); 195 DCHECK(remote_proto_channel);
196 196
197 // Using an external begin frame source is not supported in remote mode. 197 // Using an external begin frame source is not supported in remote mode.
198 // TODO(khushalsagar): Add support for providing an external begin frame 198 // TODO(khushalsagar): Add support for providing an external begin frame
199 // source on the client LayerTreeHost. crbug/576962 199 // source on the client LayerTreeHost. crbug/576962
200 DCHECK(!params->settings->use_external_begin_frame_source); 200 DCHECK(!params->settings->use_external_begin_frame_source);
201 DCHECK(!params->external_begin_frame_source); 201 DCHECK(!params->external_begin_frame_source);
202 DCHECK(params->image_serialization_processor); 202 DCHECK(params->image_serialization_processor);
203 203
204 scoped_ptr<LayerTreeHost> layer_tree_host( 204 std::unique_ptr<LayerTreeHost> layer_tree_host(
205 new LayerTreeHost(params, CompositorMode::REMOTE)); 205 new LayerTreeHost(params, CompositorMode::REMOTE));
206 layer_tree_host->InitializeRemoteClient( 206 layer_tree_host->InitializeRemoteClient(
207 remote_proto_channel, params->main_task_runner, impl_task_runner); 207 remote_proto_channel, params->main_task_runner, impl_task_runner);
208 return layer_tree_host; 208 return layer_tree_host;
209 } 209 }
210 210
211 LayerTreeHost::LayerTreeHost(InitParams* params, CompositorMode mode) 211 LayerTreeHost::LayerTreeHost(InitParams* params, CompositorMode mode)
212 : micro_benchmark_controller_(this), 212 : micro_benchmark_controller_(this),
213 next_ui_resource_id_(1), 213 next_ui_resource_id_(1),
214 compositor_mode_(mode), 214 compositor_mode_(mode),
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 animation_host_ = AnimationHost::Create(ThreadInstance::MAIN); 252 animation_host_ = AnimationHost::Create(ThreadInstance::MAIN);
253 animation_host_->SetMutatorHostClient(this); 253 animation_host_->SetMutatorHostClient(this);
254 254
255 rendering_stats_instrumentation_->set_record_rendering_stats( 255 rendering_stats_instrumentation_->set_record_rendering_stats(
256 debug_state_.RecordRenderingStats()); 256 debug_state_.RecordRenderingStats());
257 } 257 }
258 258
259 void LayerTreeHost::InitializeThreaded( 259 void LayerTreeHost::InitializeThreaded(
260 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 260 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
261 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 261 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
262 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 262 std::unique_ptr<BeginFrameSource> external_begin_frame_source) {
263 task_runner_provider_ = 263 task_runner_provider_ =
264 TaskRunnerProvider::Create(main_task_runner, impl_task_runner); 264 TaskRunnerProvider::Create(main_task_runner, impl_task_runner);
265 scoped_ptr<ProxyMain> proxy_main = 265 std::unique_ptr<ProxyMain> proxy_main =
266 ProxyMain::CreateThreaded(this, task_runner_provider_.get()); 266 ProxyMain::CreateThreaded(this, task_runner_provider_.get());
267 InitializeProxy(std::move(proxy_main), 267 InitializeProxy(std::move(proxy_main),
268 std::move(external_begin_frame_source)); 268 std::move(external_begin_frame_source));
269 } 269 }
270 270
271 void LayerTreeHost::InitializeSingleThreaded( 271 void LayerTreeHost::InitializeSingleThreaded(
272 LayerTreeHostSingleThreadClient* single_thread_client, 272 LayerTreeHostSingleThreadClient* single_thread_client,
273 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 273 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
274 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 274 std::unique_ptr<BeginFrameSource> external_begin_frame_source) {
275 task_runner_provider_ = TaskRunnerProvider::Create(main_task_runner, nullptr); 275 task_runner_provider_ = TaskRunnerProvider::Create(main_task_runner, nullptr);
276 InitializeProxy(SingleThreadProxy::Create(this, single_thread_client, 276 InitializeProxy(SingleThreadProxy::Create(this, single_thread_client,
277 task_runner_provider_.get()), 277 task_runner_provider_.get()),
278 std::move(external_begin_frame_source)); 278 std::move(external_begin_frame_source));
279 } 279 }
280 280
281 void LayerTreeHost::InitializeRemoteServer( 281 void LayerTreeHost::InitializeRemoteServer(
282 RemoteProtoChannel* remote_proto_channel, 282 RemoteProtoChannel* remote_proto_channel,
283 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { 283 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) {
284 task_runner_provider_ = TaskRunnerProvider::Create(main_task_runner, nullptr); 284 task_runner_provider_ = TaskRunnerProvider::Create(main_task_runner, nullptr);
(...skipping 21 matching lines...) Expand all
306 // to handled locally, for instance the Output Surface creation to the 306 // to handled locally, for instance the Output Surface creation to the
307 // LayerTreeHost on the client, while the other requests are sent to the 307 // LayerTreeHost on the client, while the other requests are sent to the
308 // RemoteChannelMain on the server which directs them to ProxyMain and the 308 // RemoteChannelMain on the server which directs them to ProxyMain and the
309 // remote server LayerTreeHost. 309 // remote server LayerTreeHost.
310 InitializeProxy(RemoteChannelImpl::Create(this, remote_proto_channel, 310 InitializeProxy(RemoteChannelImpl::Create(this, remote_proto_channel,
311 task_runner_provider_.get()), 311 task_runner_provider_.get()),
312 nullptr); 312 nullptr);
313 } 313 }
314 314
315 void LayerTreeHost::InitializeForTesting( 315 void LayerTreeHost::InitializeForTesting(
316 scoped_ptr<TaskRunnerProvider> task_runner_provider, 316 std::unique_ptr<TaskRunnerProvider> task_runner_provider,
317 scoped_ptr<Proxy> proxy_for_testing, 317 std::unique_ptr<Proxy> proxy_for_testing,
318 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 318 std::unique_ptr<BeginFrameSource> external_begin_frame_source) {
319 task_runner_provider_ = std::move(task_runner_provider); 319 task_runner_provider_ = std::move(task_runner_provider);
320 InitializeProxy(std::move(proxy_for_testing), 320 InitializeProxy(std::move(proxy_for_testing),
321 std::move(external_begin_frame_source)); 321 std::move(external_begin_frame_source));
322 } 322 }
323 323
324 void LayerTreeHost::SetTaskRunnerProviderForTesting( 324 void LayerTreeHost::SetTaskRunnerProviderForTesting(
325 scoped_ptr<TaskRunnerProvider> task_runner_provider) { 325 std::unique_ptr<TaskRunnerProvider> task_runner_provider) {
326 DCHECK(!task_runner_provider_); 326 DCHECK(!task_runner_provider_);
327 task_runner_provider_ = std::move(task_runner_provider); 327 task_runner_provider_ = std::move(task_runner_provider);
328 } 328 }
329 329
330 void LayerTreeHost::InitializeProxy( 330 void LayerTreeHost::InitializeProxy(
331 scoped_ptr<Proxy> proxy, 331 std::unique_ptr<Proxy> proxy,
332 scoped_ptr<BeginFrameSource> external_begin_frame_source) { 332 std::unique_ptr<BeginFrameSource> external_begin_frame_source) {
333 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); 333 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal");
334 DCHECK(task_runner_provider_); 334 DCHECK(task_runner_provider_);
335 335
336 proxy_ = std::move(proxy); 336 proxy_ = std::move(proxy);
337 proxy_->Start(std::move(external_begin_frame_source)); 337 proxy_->Start(std::move(external_begin_frame_source));
338 338
339 animation_host_->SetSupportsScrollAnimations(proxy_->SupportsImplScrolling()); 339 animation_host_->SetSupportsScrollAnimations(proxy_->SupportsImplScrolling());
340 } 340 }
341 341
342 LayerTreeHost::~LayerTreeHost() { 342 LayerTreeHost::~LayerTreeHost() {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 566
567 void LayerTreeHost::CommitComplete() { 567 void LayerTreeHost::CommitComplete() {
568 source_frame_number_++; 568 source_frame_number_++;
569 client_->DidCommit(); 569 client_->DidCommit();
570 if (did_complete_scale_animation_) { 570 if (did_complete_scale_animation_) {
571 client_->DidCompletePageScaleAnimation(); 571 client_->DidCompletePageScaleAnimation();
572 did_complete_scale_animation_ = false; 572 did_complete_scale_animation_ = false;
573 } 573 }
574 } 574 }
575 575
576 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { 576 void LayerTreeHost::SetOutputSurface(std::unique_ptr<OutputSurface> surface) {
577 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); 577 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface");
578 DCHECK(output_surface_lost_); 578 DCHECK(output_surface_lost_);
579 DCHECK(surface); 579 DCHECK(surface);
580 580
581 DCHECK(!new_output_surface_); 581 DCHECK(!new_output_surface_);
582 new_output_surface_ = std::move(surface); 582 new_output_surface_ = std::move(surface);
583 proxy_->SetOutputSurface(new_output_surface_.get()); 583 proxy_->SetOutputSurface(new_output_surface_.get());
584 } 584 }
585 585
586 scoped_ptr<OutputSurface> LayerTreeHost::ReleaseOutputSurface() { 586 std::unique_ptr<OutputSurface> LayerTreeHost::ReleaseOutputSurface() {
587 DCHECK(!visible_); 587 DCHECK(!visible_);
588 DCHECK(!output_surface_lost_); 588 DCHECK(!output_surface_lost_);
589 589
590 DidLoseOutputSurface(); 590 DidLoseOutputSurface();
591 proxy_->ReleaseOutputSurface(); 591 proxy_->ReleaseOutputSurface();
592 return std::move(current_output_surface_); 592 return std::move(current_output_surface_);
593 } 593 }
594 594
595 void LayerTreeHost::RequestNewOutputSurface() { 595 void LayerTreeHost::RequestNewOutputSurface() {
596 client_->RequestNewOutputSurface(); 596 client_->RequestNewOutputSurface();
(...skipping 10 matching lines...) Expand all
607 DCHECK(output_surface_lost_); 607 DCHECK(output_surface_lost_);
608 DCHECK(new_output_surface_); 608 DCHECK(new_output_surface_);
609 // Note: It is safe to drop all output surface references here as 609 // Note: It is safe to drop all output surface references here as
610 // LayerTreeHostImpl will not keep a pointer to either the old or 610 // LayerTreeHostImpl will not keep a pointer to either the old or
611 // new output surface after failing to initialize the new one. 611 // new output surface after failing to initialize the new one.
612 current_output_surface_ = nullptr; 612 current_output_surface_ = nullptr;
613 new_output_surface_ = nullptr; 613 new_output_surface_ = nullptr;
614 client_->DidFailToInitializeOutputSurface(); 614 client_->DidFailToInitializeOutputSurface();
615 } 615 }
616 616
617 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( 617 std::unique_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
618 LayerTreeHostImplClient* client) { 618 LayerTreeHostImplClient* client) {
619 DCHECK(!IsRemoteServer()); 619 DCHECK(!IsRemoteServer());
620 DCHECK(task_runner_provider_->IsImplThread()); 620 DCHECK(task_runner_provider_->IsImplThread());
621 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( 621 std::unique_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
622 settings_, client, task_runner_provider_.get(), 622 settings_, client, task_runner_provider_.get(),
623 rendering_stats_instrumentation_.get(), shared_bitmap_manager_, 623 rendering_stats_instrumentation_.get(), shared_bitmap_manager_,
624 gpu_memory_buffer_manager_, task_graph_runner_, id_); 624 gpu_memory_buffer_manager_, task_graph_runner_, id_);
625 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); 625 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_);
626 host_impl->SetContentIsSuitableForGpuRasterization( 626 host_impl->SetContentIsSuitableForGpuRasterization(
627 content_is_suitable_for_gpu_rasterization_); 627 content_is_suitable_for_gpu_rasterization_);
628 shared_bitmap_manager_ = NULL; 628 shared_bitmap_manager_ = NULL;
629 gpu_memory_buffer_manager_ = NULL; 629 gpu_memory_buffer_manager_ = NULL;
630 task_graph_runner_ = NULL; 630 task_graph_runner_ = NULL;
631 input_handler_weak_ptr_ = host_impl->AsWeakPtr(); 631 input_handler_weak_ptr_ = host_impl->AsWeakPtr();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 723
724 void LayerTreeHost::SetNextCommitWaitsForActivation() { 724 void LayerTreeHost::SetNextCommitWaitsForActivation() {
725 proxy_->SetNextCommitWaitsForActivation(); 725 proxy_->SetNextCommitWaitsForActivation();
726 } 726 }
727 727
728 void LayerTreeHost::SetNextCommitForcesRedraw() { 728 void LayerTreeHost::SetNextCommitForcesRedraw() {
729 next_commit_forces_redraw_ = true; 729 next_commit_forces_redraw_ = true;
730 proxy_->SetNeedsUpdateLayers(); 730 proxy_->SetNeedsUpdateLayers();
731 } 731 }
732 732
733 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEvents> events) { 733 void LayerTreeHost::SetAnimationEvents(
734 std::unique_ptr<AnimationEvents> events) {
734 DCHECK(task_runner_provider_->IsMainThread()); 735 DCHECK(task_runner_provider_->IsMainThread());
735 animation_host_->SetAnimationEvents(std::move(events)); 736 animation_host_->SetAnimationEvents(std::move(events));
736 } 737 }
737 738
738 void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) { 739 void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) {
739 if (root_layer_.get() == root_layer.get()) 740 if (root_layer_.get() == root_layer.get())
740 return; 741 return;
741 742
742 if (root_layer_.get()) 743 if (root_layer_.get())
743 root_layer_->SetLayerTreeHost(NULL); 744 root_layer_->SetLayerTreeHost(NULL);
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 1094
1094 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, 1095 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints,
1095 TopControlsState current, 1096 TopControlsState current,
1096 bool animate) { 1097 bool animate) {
1097 // Top controls are only used in threaded or remote mode. 1098 // Top controls are only used in threaded or remote mode.
1098 DCHECK(IsThreaded() || IsRemoteServer()); 1099 DCHECK(IsThreaded() || IsRemoteServer());
1099 proxy_->UpdateTopControlsState(constraints, current, animate); 1100 proxy_->UpdateTopControlsState(constraints, current, animate);
1100 } 1101 }
1101 1102
1102 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { 1103 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) {
1103 scoped_ptr<AnimationEvents> events = animation_host_->CreateEvents(); 1104 std::unique_ptr<AnimationEvents> events = animation_host_->CreateEvents();
1104 1105
1105 if (animation_host_->AnimateLayers(monotonic_time)) 1106 if (animation_host_->AnimateLayers(monotonic_time))
1106 animation_host_->UpdateAnimationState(true, events.get()); 1107 animation_host_->UpdateAnimationState(true, events.get());
1107 1108
1108 if (!events->events_.empty()) 1109 if (!events->events_.empty())
1109 property_trees_.needs_rebuild = true; 1110 property_trees_.needs_rebuild = true;
1110 } 1111 }
1111 1112
1112 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) { 1113 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) {
1113 DCHECK(client); 1114 DCHECK(client);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 const size_t index = static_cast<size_t>(event_class); 1199 const size_t index = static_cast<size_t>(event_class);
1199 if (event_listener_properties_[index] == properties) 1200 if (event_listener_properties_[index] == properties)
1200 return; 1201 return;
1201 1202
1202 event_listener_properties_[index] = properties; 1203 event_listener_properties_[index] = properties;
1203 SetNeedsCommit(); 1204 SetNeedsCommit();
1204 } 1205 }
1205 1206
1206 int LayerTreeHost::ScheduleMicroBenchmark( 1207 int LayerTreeHost::ScheduleMicroBenchmark(
1207 const std::string& benchmark_name, 1208 const std::string& benchmark_name,
1208 scoped_ptr<base::Value> value, 1209 std::unique_ptr<base::Value> value,
1209 const MicroBenchmark::DoneCallback& callback) { 1210 const MicroBenchmark::DoneCallback& callback) {
1210 return micro_benchmark_controller_.ScheduleRun(benchmark_name, 1211 return micro_benchmark_controller_.ScheduleRun(benchmark_name,
1211 std::move(value), callback); 1212 std::move(value), callback);
1212 } 1213 }
1213 1214
1214 bool LayerTreeHost::SendMessageToMicroBenchmark(int id, 1215 bool LayerTreeHost::SendMessageToMicroBenchmark(
1215 scoped_ptr<base::Value> value) { 1216 int id,
1217 std::unique_ptr<base::Value> value) {
1216 return micro_benchmark_controller_.SendMessage(id, std::move(value)); 1218 return micro_benchmark_controller_.SendMessage(id, std::move(value));
1217 } 1219 }
1218 1220
1219 void LayerTreeHost::InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) { 1221 void LayerTreeHost::InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) {
1220 swap_promise_monitor_.insert(monitor); 1222 swap_promise_monitor_.insert(monitor);
1221 } 1223 }
1222 1224
1223 void LayerTreeHost::RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) { 1225 void LayerTreeHost::RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) {
1224 swap_promise_monitor_.erase(monitor); 1226 swap_promise_monitor_.erase(monitor);
1225 } 1227 }
1226 1228
1227 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { 1229 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() {
1228 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 1230 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
1229 for (; it != swap_promise_monitor_.end(); it++) 1231 for (; it != swap_promise_monitor_.end(); it++)
1230 (*it)->OnSetNeedsCommitOnMain(); 1232 (*it)->OnSetNeedsCommitOnMain();
1231 } 1233 }
1232 1234
1233 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { 1235 void LayerTreeHost::QueueSwapPromise(
1236 std::unique_ptr<SwapPromise> swap_promise) {
1234 DCHECK(swap_promise); 1237 DCHECK(swap_promise);
1235 swap_promise_list_.push_back(std::move(swap_promise)); 1238 swap_promise_list_.push_back(std::move(swap_promise));
1236 } 1239 }
1237 1240
1238 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1241 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1239 for (const auto& swap_promise : swap_promise_list_) 1242 for (const auto& swap_promise : swap_promise_list_)
1240 swap_promise->DidNotSwap(reason); 1243 swap_promise->DidNotSwap(reason);
1241 swap_promise_list_.clear(); 1244 swap_promise_list_.clear();
1242 } 1245 }
1243 1246
(...skipping 19 matching lines...) Expand all
1263 const BeginFrameArgs& args) const { 1266 const BeginFrameArgs& args) const {
1264 client_->SendBeginFramesToChildren(args); 1267 client_->SendBeginFramesToChildren(args);
1265 } 1268 }
1266 1269
1267 void LayerTreeHost::SetAuthoritativeVSyncInterval( 1270 void LayerTreeHost::SetAuthoritativeVSyncInterval(
1268 const base::TimeDelta& interval) { 1271 const base::TimeDelta& interval) {
1269 proxy_->SetAuthoritativeVSyncInterval(interval); 1272 proxy_->SetAuthoritativeVSyncInterval(interval);
1270 } 1273 }
1271 1274
1272 void LayerTreeHost::RecordFrameTimingEvents( 1275 void LayerTreeHost::RecordFrameTimingEvents(
1273 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 1276 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
1274 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { 1277 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
1275 client_->RecordFrameTimingEvents(std::move(composite_events), 1278 client_->RecordFrameTimingEvents(std::move(composite_events),
1276 std::move(main_frame_events)); 1279 std::move(main_frame_events));
1277 } 1280 }
1278 1281
1279 Layer* LayerTreeHost::LayerById(int id) const { 1282 Layer* LayerTreeHost::LayerById(int id) const {
1280 LayerIdMap::const_iterator iter = layer_id_map_.find(id); 1283 LayerIdMap::const_iterator iter = layer_id_map_.find(id);
1281 return iter != layer_id_map_.end() ? iter->second : NULL; 1284 return iter != layer_id_map_.end() ? iter->second : NULL;
1282 } 1285 }
1283 1286
1284 void LayerTreeHost::AddLayerShouldPushProperties(Layer* layer) { 1287 void LayerTreeHost::AddLayerShouldPushProperties(Layer* layer) {
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 int seq_num = property_trees_.sequence_number; 1634 int seq_num = property_trees_.sequence_number;
1632 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) { 1635 LayerTreeHostCommon::CallFunctionForEveryLayer(this, [seq_num](Layer* layer) {
1633 layer->set_property_tree_sequence_number(seq_num); 1636 layer->set_property_tree_sequence_number(seq_num);
1634 }); 1637 });
1635 1638
1636 surface_id_namespace_ = proto.surface_id_namespace(); 1639 surface_id_namespace_ = proto.surface_id_namespace();
1637 next_surface_sequence_ = proto.next_surface_sequence(); 1640 next_surface_sequence_ = proto.next_surface_sequence();
1638 } 1641 }
1639 1642
1640 } // namespace cc 1643 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698