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

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: 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/layer_tree_host.h ('k') | cc/trees/layer_tree_host_client.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 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 567
568 void LayerTreeHost::CommitComplete() { 568 void LayerTreeHost::CommitComplete() {
569 source_frame_number_++; 569 source_frame_number_++;
570 client_->DidCommit(); 570 client_->DidCommit();
571 if (did_complete_scale_animation_) { 571 if (did_complete_scale_animation_) {
572 client_->DidCompletePageScaleAnimation(); 572 client_->DidCompletePageScaleAnimation();
573 did_complete_scale_animation_ = false; 573 did_complete_scale_animation_ = false;
574 } 574 }
575 } 575 }
576 576
577 void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) { 577 void LayerTreeHost::SetOutputSurface(std::unique_ptr<OutputSurface> surface) {
578 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); 578 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface");
579 DCHECK(output_surface_lost_); 579 DCHECK(output_surface_lost_);
580 DCHECK(surface); 580 DCHECK(surface);
581 581
582 DCHECK(!new_output_surface_); 582 DCHECK(!new_output_surface_);
583 new_output_surface_ = std::move(surface); 583 new_output_surface_ = std::move(surface);
584 proxy_->SetOutputSurface(new_output_surface_.get()); 584 proxy_->SetOutputSurface(new_output_surface_.get());
585 } 585 }
586 586
587 scoped_ptr<OutputSurface> LayerTreeHost::ReleaseOutputSurface() { 587 std::unique_ptr<OutputSurface> LayerTreeHost::ReleaseOutputSurface() {
588 DCHECK(!visible_); 588 DCHECK(!visible_);
589 DCHECK(!output_surface_lost_); 589 DCHECK(!output_surface_lost_);
590 590
591 DidLoseOutputSurface(); 591 DidLoseOutputSurface();
592 proxy_->ReleaseOutputSurface(); 592 proxy_->ReleaseOutputSurface();
593 return std::move(current_output_surface_); 593 return std::move(current_output_surface_);
594 } 594 }
595 595
596 void LayerTreeHost::RequestNewOutputSurface() { 596 void LayerTreeHost::RequestNewOutputSurface() {
597 client_->RequestNewOutputSurface(); 597 client_->RequestNewOutputSurface();
(...skipping 10 matching lines...) Expand all
608 DCHECK(output_surface_lost_); 608 DCHECK(output_surface_lost_);
609 DCHECK(new_output_surface_); 609 DCHECK(new_output_surface_);
610 // Note: It is safe to drop all output surface references here as 610 // Note: It is safe to drop all output surface references here as
611 // LayerTreeHostImpl will not keep a pointer to either the old or 611 // LayerTreeHostImpl will not keep a pointer to either the old or
612 // new output surface after failing to initialize the new one. 612 // new output surface after failing to initialize the new one.
613 current_output_surface_ = nullptr; 613 current_output_surface_ = nullptr;
614 new_output_surface_ = nullptr; 614 new_output_surface_ = nullptr;
615 client_->DidFailToInitializeOutputSurface(); 615 client_->DidFailToInitializeOutputSurface();
616 } 616 }
617 617
618 scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( 618 std::unique_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
619 LayerTreeHostImplClient* client) { 619 LayerTreeHostImplClient* client) {
620 DCHECK(!IsRemoteServer()); 620 DCHECK(!IsRemoteServer());
621 DCHECK(task_runner_provider_->IsImplThread()); 621 DCHECK(task_runner_provider_->IsImplThread());
622 scoped_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( 622 std::unique_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create(
623 settings_, client, task_runner_provider_.get(), 623 settings_, client, task_runner_provider_.get(),
624 rendering_stats_instrumentation_.get(), shared_bitmap_manager_, 624 rendering_stats_instrumentation_.get(), shared_bitmap_manager_,
625 gpu_memory_buffer_manager_, task_graph_runner_, id_); 625 gpu_memory_buffer_manager_, task_graph_runner_, id_);
626 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); 626 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_);
627 host_impl->SetContentIsSuitableForGpuRasterization( 627 host_impl->SetContentIsSuitableForGpuRasterization(
628 content_is_suitable_for_gpu_rasterization_); 628 content_is_suitable_for_gpu_rasterization_);
629 shared_bitmap_manager_ = NULL; 629 shared_bitmap_manager_ = NULL;
630 gpu_memory_buffer_manager_ = NULL; 630 gpu_memory_buffer_manager_ = NULL;
631 task_graph_runner_ = NULL; 631 task_graph_runner_ = NULL;
632 input_handler_weak_ptr_ = host_impl->AsWeakPtr(); 632 input_handler_weak_ptr_ = host_impl->AsWeakPtr();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 724
725 void LayerTreeHost::SetNextCommitWaitsForActivation() { 725 void LayerTreeHost::SetNextCommitWaitsForActivation() {
726 proxy_->SetNextCommitWaitsForActivation(); 726 proxy_->SetNextCommitWaitsForActivation();
727 } 727 }
728 728
729 void LayerTreeHost::SetNextCommitForcesRedraw() { 729 void LayerTreeHost::SetNextCommitForcesRedraw() {
730 next_commit_forces_redraw_ = true; 730 next_commit_forces_redraw_ = true;
731 proxy_->SetNeedsUpdateLayers(); 731 proxy_->SetNeedsUpdateLayers();
732 } 732 }
733 733
734 void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEvents> events) { 734 void LayerTreeHost::SetAnimationEvents(
735 std::unique_ptr<AnimationEvents> events) {
735 DCHECK(task_runner_provider_->IsMainThread()); 736 DCHECK(task_runner_provider_->IsMainThread());
736 animation_host_->SetAnimationEvents(std::move(events)); 737 animation_host_->SetAnimationEvents(std::move(events));
737 } 738 }
738 739
739 void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) { 740 void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) {
740 if (root_layer_.get() == root_layer.get()) 741 if (root_layer_.get() == root_layer.get())
741 return; 742 return;
742 743
743 if (root_layer_.get()) 744 if (root_layer_.get())
744 root_layer_->SetLayerTreeHost(NULL); 745 root_layer_->SetLayerTreeHost(NULL);
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 1095
1095 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, 1096 void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints,
1096 TopControlsState current, 1097 TopControlsState current,
1097 bool animate) { 1098 bool animate) {
1098 // Top controls are only used in threaded or remote mode. 1099 // Top controls are only used in threaded or remote mode.
1099 DCHECK(IsThreaded() || IsRemoteServer()); 1100 DCHECK(IsThreaded() || IsRemoteServer());
1100 proxy_->UpdateTopControlsState(constraints, current, animate); 1101 proxy_->UpdateTopControlsState(constraints, current, animate);
1101 } 1102 }
1102 1103
1103 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) { 1104 void LayerTreeHost::AnimateLayers(base::TimeTicks monotonic_time) {
1104 scoped_ptr<AnimationEvents> events = animation_host_->CreateEvents(); 1105 std::unique_ptr<AnimationEvents> events = animation_host_->CreateEvents();
1105 1106
1106 if (animation_host_->AnimateLayers(monotonic_time)) 1107 if (animation_host_->AnimateLayers(monotonic_time))
1107 animation_host_->UpdateAnimationState(true, events.get()); 1108 animation_host_->UpdateAnimationState(true, events.get());
1108 1109
1109 if (!events->events_.empty()) 1110 if (!events->events_.empty())
1110 property_trees_.needs_rebuild = true; 1111 property_trees_.needs_rebuild = true;
1111 } 1112 }
1112 1113
1113 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) { 1114 UIResourceId LayerTreeHost::CreateUIResource(UIResourceClient* client) {
1114 DCHECK(client); 1115 DCHECK(client);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 const size_t index = static_cast<size_t>(event_class); 1200 const size_t index = static_cast<size_t>(event_class);
1200 if (event_listener_properties_[index] == properties) 1201 if (event_listener_properties_[index] == properties)
1201 return; 1202 return;
1202 1203
1203 event_listener_properties_[index] = properties; 1204 event_listener_properties_[index] = properties;
1204 SetNeedsCommit(); 1205 SetNeedsCommit();
1205 } 1206 }
1206 1207
1207 int LayerTreeHost::ScheduleMicroBenchmark( 1208 int LayerTreeHost::ScheduleMicroBenchmark(
1208 const std::string& benchmark_name, 1209 const std::string& benchmark_name,
1209 scoped_ptr<base::Value> value, 1210 std::unique_ptr<base::Value> value,
1210 const MicroBenchmark::DoneCallback& callback) { 1211 const MicroBenchmark::DoneCallback& callback) {
1211 return micro_benchmark_controller_.ScheduleRun(benchmark_name, 1212 return micro_benchmark_controller_.ScheduleRun(benchmark_name,
1212 std::move(value), callback); 1213 std::move(value), callback);
1213 } 1214 }
1214 1215
1215 bool LayerTreeHost::SendMessageToMicroBenchmark(int id, 1216 bool LayerTreeHost::SendMessageToMicroBenchmark(
1216 scoped_ptr<base::Value> value) { 1217 int id,
1218 std::unique_ptr<base::Value> value) {
1217 return micro_benchmark_controller_.SendMessage(id, std::move(value)); 1219 return micro_benchmark_controller_.SendMessage(id, std::move(value));
1218 } 1220 }
1219 1221
1220 void LayerTreeHost::InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) { 1222 void LayerTreeHost::InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) {
1221 swap_promise_monitor_.insert(monitor); 1223 swap_promise_monitor_.insert(monitor);
1222 } 1224 }
1223 1225
1224 void LayerTreeHost::RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) { 1226 void LayerTreeHost::RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) {
1225 swap_promise_monitor_.erase(monitor); 1227 swap_promise_monitor_.erase(monitor);
1226 } 1228 }
1227 1229
1228 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() { 1230 void LayerTreeHost::NotifySwapPromiseMonitorsOfSetNeedsCommit() {
1229 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 1231 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
1230 for (; it != swap_promise_monitor_.end(); it++) 1232 for (; it != swap_promise_monitor_.end(); it++)
1231 (*it)->OnSetNeedsCommitOnMain(); 1233 (*it)->OnSetNeedsCommitOnMain();
1232 } 1234 }
1233 1235
1234 void LayerTreeHost::QueueSwapPromise(scoped_ptr<SwapPromise> swap_promise) { 1236 void LayerTreeHost::QueueSwapPromise(
1237 std::unique_ptr<SwapPromise> swap_promise) {
1235 DCHECK(swap_promise); 1238 DCHECK(swap_promise);
1236 swap_promise_list_.push_back(std::move(swap_promise)); 1239 swap_promise_list_.push_back(std::move(swap_promise));
1237 } 1240 }
1238 1241
1239 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1242 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1240 for (const auto& swap_promise : swap_promise_list_) 1243 for (const auto& swap_promise : swap_promise_list_)
1241 swap_promise->DidNotSwap(reason); 1244 swap_promise->DidNotSwap(reason);
1242 swap_promise_list_.clear(); 1245 swap_promise_list_.clear();
1243 } 1246 }
1244 1247
(...skipping 19 matching lines...) Expand all
1264 const BeginFrameArgs& args) const { 1267 const BeginFrameArgs& args) const {
1265 client_->SendBeginFramesToChildren(args); 1268 client_->SendBeginFramesToChildren(args);
1266 } 1269 }
1267 1270
1268 void LayerTreeHost::SetAuthoritativeVSyncInterval( 1271 void LayerTreeHost::SetAuthoritativeVSyncInterval(
1269 const base::TimeDelta& interval) { 1272 const base::TimeDelta& interval) {
1270 proxy_->SetAuthoritativeVSyncInterval(interval); 1273 proxy_->SetAuthoritativeVSyncInterval(interval);
1271 } 1274 }
1272 1275
1273 void LayerTreeHost::RecordFrameTimingEvents( 1276 void LayerTreeHost::RecordFrameTimingEvents(
1274 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 1277 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
1275 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) { 1278 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) {
1276 client_->RecordFrameTimingEvents(std::move(composite_events), 1279 client_->RecordFrameTimingEvents(std::move(composite_events),
1277 std::move(main_frame_events)); 1280 std::move(main_frame_events));
1278 } 1281 }
1279 1282
1280 Layer* LayerTreeHost::LayerById(int id) const { 1283 Layer* LayerTreeHost::LayerById(int id) const {
1281 LayerIdMap::const_iterator iter = layer_id_map_.find(id); 1284 LayerIdMap::const_iterator iter = layer_id_map_.find(id);
1282 return iter != layer_id_map_.end() ? iter->second : NULL; 1285 return iter != layer_id_map_.end() ? iter->second : NULL;
1283 } 1286 }
1284 1287
1285 void LayerTreeHost::AddLayerShouldPushProperties(Layer* layer) { 1288 void LayerTreeHost::AddLayerShouldPushProperties(Layer* layer) {
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 [seq_num](Layer* layer) { 1638 [seq_num](Layer* layer) {
1636 layer->set_property_tree_sequence_number(seq_num); 1639 layer->set_property_tree_sequence_number(seq_num);
1637 }, 1640 },
1638 CallFunctionLayerType::ALL_LAYERS); 1641 CallFunctionLayerType::ALL_LAYERS);
1639 1642
1640 surface_id_namespace_ = proto.surface_id_namespace(); 1643 surface_id_namespace_ = proto.surface_id_namespace();
1641 next_surface_sequence_ = proto.next_surface_sequence(); 1644 next_surface_sequence_ = proto.next_surface_sequence();
1642 } 1645 }
1643 1646
1644 } // namespace cc 1647 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698