| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 519 |
| 520 void LayerTreeHost::CommitComplete() { | 520 void LayerTreeHost::CommitComplete() { |
| 521 source_frame_number_++; | 521 source_frame_number_++; |
| 522 client_->DidCommit(); | 522 client_->DidCommit(); |
| 523 if (did_complete_scale_animation_) { | 523 if (did_complete_scale_animation_) { |
| 524 client_->DidCompletePageScaleAnimation(); | 524 client_->DidCompletePageScaleAnimation(); |
| 525 did_complete_scale_animation_ = false; | 525 did_complete_scale_animation_ = false; |
| 526 } | 526 } |
| 527 } | 527 } |
| 528 | 528 |
| 529 void LayerTreeHost::SetOutputSurface(std::unique_ptr<OutputSurface> surface) { | 529 void LayerTreeHost::SetCompositorFrameSink( |
| 530 TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface"); | 530 std::unique_ptr<CompositorFrameSink> surface) { |
| 531 TRACE_EVENT0("cc", "LayerTreeHost::SetCompositorFrameSink"); |
| 531 DCHECK(surface); | 532 DCHECK(surface); |
| 532 | 533 |
| 533 DCHECK(!new_output_surface_); | 534 DCHECK(!new_compositor_frame_sink_); |
| 534 new_output_surface_ = std::move(surface); | 535 new_compositor_frame_sink_ = std::move(surface); |
| 535 proxy_->SetOutputSurface(new_output_surface_.get()); | 536 proxy_->SetCompositorFrameSink(new_compositor_frame_sink_.get()); |
| 536 } | 537 } |
| 537 | 538 |
| 538 std::unique_ptr<OutputSurface> LayerTreeHost::ReleaseOutputSurface() { | 539 std::unique_ptr<CompositorFrameSink> |
| 540 LayerTreeHost::ReleaseCompositorFrameSink() { |
| 539 DCHECK(!visible_); | 541 DCHECK(!visible_); |
| 540 | 542 |
| 541 DidLoseOutputSurface(); | 543 DidLoseCompositorFrameSink(); |
| 542 proxy_->ReleaseOutputSurface(); | 544 proxy_->ReleaseCompositorFrameSink(); |
| 543 return std::move(current_output_surface_); | 545 return std::move(current_compositor_frame_sink_); |
| 544 } | 546 } |
| 545 | 547 |
| 546 void LayerTreeHost::RequestNewOutputSurface() { | 548 void LayerTreeHost::RequestNewCompositorFrameSink() { |
| 547 client_->RequestNewOutputSurface(); | 549 client_->RequestNewCompositorFrameSink(); |
| 548 } | 550 } |
| 549 | 551 |
| 550 void LayerTreeHost::DidInitializeOutputSurface() { | 552 void LayerTreeHost::DidInitializeCompositorFrameSink() { |
| 551 DCHECK(new_output_surface_); | 553 DCHECK(new_compositor_frame_sink_); |
| 552 current_output_surface_ = std::move(new_output_surface_); | 554 current_compositor_frame_sink_ = std::move(new_compositor_frame_sink_); |
| 553 client_->DidInitializeOutputSurface(); | 555 client_->DidInitializeCompositorFrameSink(); |
| 554 } | 556 } |
| 555 | 557 |
| 556 void LayerTreeHost::DidFailToInitializeOutputSurface() { | 558 void LayerTreeHost::DidFailToInitializeCompositorFrameSink() { |
| 557 DCHECK(new_output_surface_); | 559 DCHECK(new_compositor_frame_sink_); |
| 558 // Note: It is safe to drop all output surface references here as | 560 // Note: It is safe to drop all output surface references here as |
| 559 // LayerTreeHostImpl will not keep a pointer to either the old or | 561 // LayerTreeHostImpl will not keep a pointer to either the old or |
| 560 // new output surface after failing to initialize the new one. | 562 // new CompositorFrameSink after failing to initialize the new one. |
| 561 current_output_surface_ = nullptr; | 563 current_compositor_frame_sink_ = nullptr; |
| 562 new_output_surface_ = nullptr; | 564 new_compositor_frame_sink_ = nullptr; |
| 563 client_->DidFailToInitializeOutputSurface(); | 565 client_->DidFailToInitializeCompositorFrameSink(); |
| 564 } | 566 } |
| 565 | 567 |
| 566 std::unique_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( | 568 std::unique_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( |
| 567 LayerTreeHostImplClient* client) { | 569 LayerTreeHostImplClient* client) { |
| 568 DCHECK(!IsRemoteServer()); | 570 DCHECK(!IsRemoteServer()); |
| 569 DCHECK(task_runner_provider_->IsImplThread()); | 571 DCHECK(task_runner_provider_->IsImplThread()); |
| 570 | 572 |
| 571 const bool supports_impl_scrolling = task_runner_provider_->HasImplThread(); | 573 const bool supports_impl_scrolling = task_runner_provider_->HasImplThread(); |
| 572 std::unique_ptr<AnimationHost> animation_host_impl = | 574 std::unique_ptr<AnimationHost> animation_host_impl = |
| 573 layer_tree_->animation_host()->CreateImplInstance( | 575 layer_tree_->animation_host()->CreateImplInstance( |
| 574 supports_impl_scrolling); | 576 supports_impl_scrolling); |
| 575 | 577 |
| 576 std::unique_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( | 578 std::unique_ptr<LayerTreeHostImpl> host_impl = LayerTreeHostImpl::Create( |
| 577 settings_, client, task_runner_provider_.get(), | 579 settings_, client, task_runner_provider_.get(), |
| 578 rendering_stats_instrumentation_.get(), shared_bitmap_manager_, | 580 rendering_stats_instrumentation_.get(), shared_bitmap_manager_, |
| 579 gpu_memory_buffer_manager_, task_graph_runner_, | 581 gpu_memory_buffer_manager_, task_graph_runner_, |
| 580 std::move(animation_host_impl), id_); | 582 std::move(animation_host_impl), id_); |
| 581 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); | 583 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); |
| 582 host_impl->SetContentIsSuitableForGpuRasterization( | 584 host_impl->SetContentIsSuitableForGpuRasterization( |
| 583 content_is_suitable_for_gpu_rasterization_); | 585 content_is_suitable_for_gpu_rasterization_); |
| 584 shared_bitmap_manager_ = NULL; | 586 shared_bitmap_manager_ = NULL; |
| 585 gpu_memory_buffer_manager_ = NULL; | 587 gpu_memory_buffer_manager_ = NULL; |
| 586 task_graph_runner_ = NULL; | 588 task_graph_runner_ = NULL; |
| 587 input_handler_weak_ptr_ = host_impl->AsWeakPtr(); | 589 input_handler_weak_ptr_ = host_impl->AsWeakPtr(); |
| 588 return host_impl; | 590 return host_impl; |
| 589 } | 591 } |
| 590 | 592 |
| 591 void LayerTreeHost::DidLoseOutputSurface() { | 593 void LayerTreeHost::DidLoseCompositorFrameSink() { |
| 592 TRACE_EVENT0("cc", "LayerTreeHost::DidLoseOutputSurface"); | 594 TRACE_EVENT0("cc", "LayerTreeHost::DidLoseCompositorFrameSink"); |
| 593 DCHECK(task_runner_provider_->IsMainThread()); | 595 DCHECK(task_runner_provider_->IsMainThread()); |
| 594 SetNeedsCommit(); | 596 SetNeedsCommit(); |
| 595 } | 597 } |
| 596 | 598 |
| 597 void LayerTreeHost::SetDeferCommits(bool defer_commits) { | 599 void LayerTreeHost::SetDeferCommits(bool defer_commits) { |
| 598 proxy_->SetDeferCommits(defer_commits); | 600 proxy_->SetDeferCommits(defer_commits); |
| 599 } | 601 } |
| 600 | 602 |
| 601 DISABLE_CFI_PERF | 603 DISABLE_CFI_PERF |
| 602 void LayerTreeHost::SetNeedsAnimate() { | 604 void LayerTreeHost::SetNeedsAnimate() { |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 | 1049 |
| 1048 debug_state_.FromProtobuf(proto.debug_state()); | 1050 debug_state_.FromProtobuf(proto.debug_state()); |
| 1049 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); | 1051 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); |
| 1050 content_is_suitable_for_gpu_rasterization_ = | 1052 content_is_suitable_for_gpu_rasterization_ = |
| 1051 proto.content_is_suitable_for_gpu_rasterization(); | 1053 proto.content_is_suitable_for_gpu_rasterization(); |
| 1052 id_ = proto.id(); | 1054 id_ = proto.id(); |
| 1053 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); | 1055 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); |
| 1054 } | 1056 } |
| 1055 | 1057 |
| 1056 } // namespace cc | 1058 } // namespace cc |
| OLD | NEW |