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_in_process.h" | 5 #include "cc/trees/layer_tree_host_in_process.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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 } | 414 } |
| 415 | 415 |
| 416 void LayerTreeHostInProcess::RequestMainFrameUpdate() { | 416 void LayerTreeHostInProcess::RequestMainFrameUpdate() { |
| 417 client_->UpdateLayerTreeHost(); | 417 client_->UpdateLayerTreeHost(); |
| 418 } | 418 } |
| 419 | 419 |
| 420 // This function commits the LayerTreeHost to an impl tree. When modifying | 420 // This function commits the LayerTreeHost to an impl tree. When modifying |
| 421 // this function, keep in mind that the function *runs* on the impl thread! Any | 421 // this function, keep in mind that the function *runs* on the impl thread! Any |
| 422 // code that is logically a main thread operation, e.g. deletion of a Layer, | 422 // code that is logically a main thread operation, e.g. deletion of a Layer, |
| 423 // should be delayed until the LayerTreeHostInProcess::CommitComplete, which | 423 // should be delayed until the LayerTreeHostInProcess::CommitComplete, which |
| 424 // will run | 424 // will run after the commit, but on the main thread. |
| 425 // after the commit, but on the main thread. | |
| 426 void LayerTreeHostInProcess::FinishCommitOnImplThread( | 425 void LayerTreeHostInProcess::FinishCommitOnImplThread( |
| 427 LayerTreeHostImpl* host_impl) { | 426 LayerTreeHostImpl* host_impl) { |
| 428 DCHECK(!IsRemoteServer()); | 427 DCHECK(!IsRemoteServer()); |
| 429 DCHECK(task_runner_provider_->IsImplThread()); | 428 // The function may also be called by single threaded unit test. |
| 429 DCHECK(task_runner_provider_->IsImplThread() || | |
| 430 !task_runner_provider_->ImplThreadTaskRunner()); | |
|
ajuma
2016/10/07 18:38:30
Instead of calling this directly from your test, c
| |
| 430 | 431 |
| 431 bool is_new_trace; | 432 bool is_new_trace; |
| 432 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); | 433 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); |
| 433 if (is_new_trace && | 434 if (is_new_trace && |
| 434 frame_viewer_instrumentation::IsTracingLayerTreeSnapshots() && | 435 frame_viewer_instrumentation::IsTracingLayerTreeSnapshots() && |
| 435 layer_tree_->root_layer()) { | 436 layer_tree_->root_layer()) { |
| 436 LayerTreeHostCommon::CallFunctionForEveryLayer( | 437 LayerTreeHostCommon::CallFunctionForEveryLayer( |
| 437 layer_tree_.get(), [](Layer* layer) { layer->DidBeginTracing(); }); | 438 layer_tree_.get(), [](Layer* layer) { layer->DidBeginTracing(); }); |
| 438 } | 439 } |
| 439 | 440 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 host_impl->SetDebugState(debug_state_); | 472 host_impl->SetDebugState(debug_state_); |
| 472 | 473 |
| 473 sync_tree->set_ui_resource_request_queue( | 474 sync_tree->set_ui_resource_request_queue( |
| 474 ui_resource_manager_->TakeUIResourcesRequests()); | 475 ui_resource_manager_->TakeUIResourcesRequests()); |
| 475 | 476 |
| 476 { | 477 { |
| 477 TRACE_EVENT0("cc", "LayerTreeHostInProcess::PushProperties"); | 478 TRACE_EVENT0("cc", "LayerTreeHostInProcess::PushProperties"); |
| 478 | 479 |
| 479 TreeSynchronizer::PushLayerProperties(layer_tree_.get(), sync_tree); | 480 TreeSynchronizer::PushLayerProperties(layer_tree_.get(), sync_tree); |
| 480 | 481 |
| 482 // This must happen after synchronizing property trees and after pushing | |
| 483 // properties, which updates the clobber_active_value flag. | |
| 484 sync_tree->UpdatePropertyTreeScrollOffset(layer_tree_->property_trees()); | |
| 485 | |
| 481 // This must happen after synchronizing property trees and after push | 486 // This must happen after synchronizing property trees and after push |
| 482 // properties, which updates property tree indices, but before animation | 487 // properties, which updates property tree indices, but before animation |
| 483 // host pushes properties as animation host push properties can change | 488 // host pushes properties as animation host push properties can change |
| 484 // Animation::InEffect and we want the old InEffect value for updating | 489 // Animation::InEffect and we want the old InEffect value for updating |
| 485 // property tree scrolling and animation. | 490 // property tree scrolling and animation. |
| 486 sync_tree->UpdatePropertyTreeScrollingAndAnimationFromMainThread(); | 491 sync_tree->UpdatePropertyTreeScrollingAndAnimationFromMainThread(); |
| 487 | 492 |
| 488 TRACE_EVENT0("cc", "LayerTreeHostInProcess::AnimationHost::PushProperties"); | 493 TRACE_EVENT0("cc", "LayerTreeHostInProcess::AnimationHost::PushProperties"); |
| 489 DCHECK(host_impl->animation_host()); | 494 DCHECK(host_impl->animation_host()); |
| 490 layer_tree_->animation_host()->PushPropertiesTo( | 495 layer_tree_->animation_host()->PushPropertiesTo( |
| 491 host_impl->animation_host()); | 496 host_impl->animation_host()); |
| 492 } | 497 } |
| 493 | 498 |
| 494 // This must happen after synchronizing property trees and after pushing | |
| 495 // properties, which updates the clobber_active_value flag. | |
| 496 sync_tree->UpdatePropertyTreeScrollOffset(layer_tree_->property_trees()); | |
| 497 | |
| 498 micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl); | 499 micro_benchmark_controller_.ScheduleImplBenchmarks(host_impl); |
| 499 layer_tree_->property_trees()->ResetAllChangeTracking(); | 500 layer_tree_->property_trees()->ResetAllChangeTracking(); |
| 500 } | 501 } |
| 501 | 502 |
| 502 void LayerTreeHostInProcess::WillCommit() { | 503 void LayerTreeHostInProcess::WillCommit() { |
| 503 swap_promise_manager_.WillCommit(); | 504 swap_promise_manager_.WillCommit(); |
| 504 client_->WillCommit(); | 505 client_->WillCommit(); |
| 505 } | 506 } |
| 506 | 507 |
| 507 void LayerTreeHostInProcess::UpdateHudLayer() {} | 508 void LayerTreeHostInProcess::UpdateHudLayer() {} |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1038 | 1039 |
| 1039 debug_state_.FromProtobuf(proto.debug_state()); | 1040 debug_state_.FromProtobuf(proto.debug_state()); |
| 1040 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); | 1041 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); |
| 1041 content_is_suitable_for_gpu_rasterization_ = | 1042 content_is_suitable_for_gpu_rasterization_ = |
| 1042 proto.content_is_suitable_for_gpu_rasterization(); | 1043 proto.content_is_suitable_for_gpu_rasterization(); |
| 1043 id_ = proto.id(); | 1044 id_ = proto.id(); |
| 1044 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); | 1045 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); |
| 1045 } | 1046 } |
| 1046 | 1047 |
| 1047 } // namespace cc | 1048 } // namespace cc |
| OLD | NEW |