Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 | 508 |
| 509 void LayerTreeHost::CommitComplete() { | 509 void LayerTreeHost::CommitComplete() { |
| 510 source_frame_number_++; | 510 source_frame_number_++; |
| 511 client_->DidCommit(); | 511 client_->DidCommit(); |
| 512 if (did_complete_scale_animation_) { | 512 if (did_complete_scale_animation_) { |
| 513 client_->DidCompletePageScaleAnimation(); | 513 client_->DidCompletePageScaleAnimation(); |
| 514 did_complete_scale_animation_ = false; | 514 did_complete_scale_animation_ = false; |
| 515 } | 515 } |
| 516 } | 516 } |
| 517 | 517 |
| 518 void LayerTreeHost::SetOutputSurface(std::unique_ptr<OutputSurface> surface) { | 518 void LayerTreeHost::SetCompositorFrameSink( |
| 519 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); | 519 std::unique_ptr<CompositorFrameSink> surface) { |
| 520 TRACE_EVENT0("cc", "LayerTreeHost::SetCompositorFrameSink"); | |
| 520 DCHECK(surface); | 521 DCHECK(surface); |
| 521 | 522 |
| 522 DCHECK(!new_output_surface_); | 523 DCHECK(!new_compositor_frame_sink_); |
| 523 new_output_surface_ = std::move(surface); | 524 new_compositor_frame_sink_ = std::move(surface); |
| 524 proxy_->SetOutputSurface(new_output_surface_.get()); | 525 proxy_->SetCompositorFrameSink(new_compositor_frame_sink_.get()); |
| 525 } | 526 } |
| 526 | 527 |
| 527 std::unique_ptr<OutputSurface> LayerTreeHost::ReleaseOutputSurface() { | 528 std::unique_ptr<CompositorFrameSink> |
| 529 LayerTreeHost::ReleaseCompositorFrameSink() { | |
| 528 DCHECK(!visible_); | 530 DCHECK(!visible_); |
| 529 | 531 |
| 530 DidLoseOutputSurface(); | 532 DidLoseCompositorFrameSink(); |
| 531 proxy_->ReleaseOutputSurface(); | 533 proxy_->ReleaseCompositorFrameSink(); |
| 532 return std::move(current_output_surface_); | 534 return std::move(current_compositor_frame_sink_); |
| 533 } | 535 } |
| 534 | 536 |
| 535 void LayerTreeHost::RequestNewOutputSurface() { | 537 void LayerTreeHost::RequestNewCompositorFrameSink() { |
| 536 client_->RequestNewOutputSurface(); | 538 client_->RequestNewCompositorFrameSink(); |
| 537 } | 539 } |
| 538 | 540 |
| 539 void LayerTreeHost::DidInitializeOutputSurface() { | 541 void LayerTreeHost::DidInitializeCompositorFrameSink() { |
| 540 DCHECK(new_output_surface_); | 542 DCHECK(new_compositor_frame_sink_); |
| 541 current_output_surface_ = std::move(new_output_surface_); | 543 current_compositor_frame_sink_ = std::move(new_compositor_frame_sink_); |
| 542 client_->DidInitializeOutputSurface(); | 544 client_->DidInitializeCompositorFrameSink(); |
| 543 } | 545 } |
| 544 | 546 |
| 545 void LayerTreeHost::DidFailToInitializeOutputSurface() { | 547 void LayerTreeHost::DidFailToInitializeCompositorFrameSink() { |
| 546 DCHECK(new_output_surface_); | 548 DCHECK(new_compositor_frame_sink_); |
| 547 // Note: It is safe to drop all output surface references here as | 549 // Note: It is safe to drop all output surface references here as |
|
enne (OOO)
2016/09/14 00:35:44
output surface in comments
| |
| 548 // LayerTreeHostImpl will not keep a pointer to either the old or | 550 // LayerTreeHostImpl will not keep a pointer to either the old or |
| 549 // new output surface after failing to initialize the new one. | 551 // new output surface after failing to initialize the new one. |
| 550 current_output_surface_ = nullptr; | 552 current_compositor_frame_sink_ = nullptr; |
| 551 new_output_surface_ = nullptr; | 553 new_compositor_frame_sink_ = nullptr; |
| 552 client_->DidFailToInitializeOutputSurface(); | 554 client_->DidFailToInitializeCompositorFrameSink(); |
| 553 } | 555 } |
| 554 | 556 |
| 555 std::unique_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( | 557 std::unique_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( |
| 556 LayerTreeHostImplClient* client) { | 558 LayerTreeHostImplClient* client) { |
| 557 DCHECK(!IsRemoteServer()); | 559 DCHECK(!IsRemoteServer()); |
| 558 DCHECK(task_runner_provider_->IsImplThread()); | 560 DCHECK(task_runner_provider_->IsImplThread()); |
| 559 | 561 |
| 560 const bool supports_impl_scrolling = task_runner_provider_->HasImplThread(); | 562 const bool supports_impl_scrolling = task_runner_provider_->HasImplThread(); |
| 561 std::unique_ptr<AnimationHost> animation_host_impl = | 563 std::unique_ptr<AnimationHost> animation_host_impl = |
| 562 layer_tree_->animation_host()->CreateImplInstance( | 564 layer_tree_->animation_host()->CreateImplInstance( |
| 563 supports_impl_scrolling); | 565 supports_impl_scrolling); |
| 564 | 566 |
| 565 std::unique_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( | 567 std::unique_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( |
| 566 settings_, client, task_runner_provider_.get(), | 568 settings_, client, task_runner_provider_.get(), |
| 567 rendering_stats_instrumentation_.get(), shared_bitmap_manager_, | 569 rendering_stats_instrumentation_.get(), shared_bitmap_manager_, |
| 568 gpu_memory_buffer_manager_, task_graph_runner_, | 570 gpu_memory_buffer_manager_, task_graph_runner_, |
| 569 std::move(animation_host_impl), id_); | 571 std::move(animation_host_impl), id_); |
| 570 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); | 572 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); |
| 571 host_impl->SetContentIsSuitableForGpuRasterization( | 573 host_impl->SetContentIsSuitableForGpuRasterization( |
| 572 content_is_suitable_for_gpu_rasterization_); | 574 content_is_suitable_for_gpu_rasterization_); |
| 573 shared_bitmap_manager_ = NULL; | 575 shared_bitmap_manager_ = NULL; |
| 574 gpu_memory_buffer_manager_ = NULL; | 576 gpu_memory_buffer_manager_ = NULL; |
| 575 task_graph_runner_ = NULL; | 577 task_graph_runner_ = NULL; |
| 576 input_handler_weak_ptr_ = host_impl->AsWeakPtr(); | 578 input_handler_weak_ptr_ = host_impl->AsWeakPtr(); |
| 577 return host_impl; | 579 return host_impl; |
| 578 } | 580 } |
| 579 | 581 |
| 580 void LayerTreeHost::DidLoseOutputSurface() { | 582 void LayerTreeHost::DidLoseCompositorFrameSink() { |
| 581 TRACE_EVENT0("cc", "LayerTreeHost::DidLoseOutputSurface"); | 583 TRACE_EVENT0("cc", "LayerTreeHost::DidLoseCompositorFrameSink"); |
| 582 DCHECK(task_runner_provider_->IsMainThread()); | 584 DCHECK(task_runner_provider_->IsMainThread()); |
| 583 SetNeedsCommit(); | 585 SetNeedsCommit(); |
| 584 } | 586 } |
| 585 | 587 |
| 586 void LayerTreeHost::SetDeferCommits(bool defer_commits) { | 588 void LayerTreeHost::SetDeferCommits(bool defer_commits) { |
| 587 proxy_->SetDeferCommits(defer_commits); | 589 proxy_->SetDeferCommits(defer_commits); |
| 588 } | 590 } |
| 589 | 591 |
| 590 DISABLE_CFI_PERF | 592 DISABLE_CFI_PERF |
| 591 void LayerTreeHost::SetNeedsAnimate() { | 593 void LayerTreeHost::SetNeedsAnimate() { |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1088 content_is_suitable_for_gpu_rasterization_ = | 1090 content_is_suitable_for_gpu_rasterization_ = |
| 1089 proto.content_is_suitable_for_gpu_rasterization(); | 1091 proto.content_is_suitable_for_gpu_rasterization(); |
| 1090 id_ = proto.id(); | 1092 id_ = proto.id(); |
| 1091 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); | 1093 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); |
| 1092 | 1094 |
| 1093 surface_client_id_ = proto.surface_client_id(); | 1095 surface_client_id_ = proto.surface_client_id(); |
| 1094 next_surface_sequence_ = proto.next_surface_sequence(); | 1096 next_surface_sequence_ = proto.next_surface_sequence(); |
| 1095 } | 1097 } |
| 1096 | 1098 |
| 1097 } // namespace cc | 1099 } // namespace cc |
| OLD | NEW |