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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 2873313004: Harmonize LayerTreeHost/LayerTreeHostImpl synchronization steps (Closed)
Patch Set: Ace of rebase Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index dfebaa0199d0cb97746a881a3a8d9a8be8a17b9c..e6115efc3088bd24298a838275ce3df5af1adc19 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -290,6 +290,7 @@ void LayerTreeHost::FinishCommitOnImplThread(
}
LayerTreeImpl* sync_tree = host_impl->sync_tree();
+ sync_tree->lifecycle().AdvanceTo(LayerTreeLifecycle::kBeginningSync);
if (next_commit_forces_redraw_) {
sync_tree->ForceRedrawNextActivation();
@@ -311,29 +312,31 @@ void LayerTreeHost::FinishCommitOnImplThread(
if (did_navigate)
host_impl->ClearImageCacheOnNavigation();
- PushPropertiesTo(sync_tree);
+ {
+ TRACE_EVENT0("cc", "LayerTreeHostInProcess::PushProperties");
- sync_tree->PassSwapPromises(swap_promise_manager_.TakeSwapPromises());
+ PushPropertyTreesTo(sync_tree);
+ sync_tree->lifecycle().AdvanceTo(LayerTreeLifecycle::kSyncedPropertyTrees);
- host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_);
- host_impl->SetContentIsSuitableForGpuRasterization(
- content_is_suitable_for_gpu_rasterization_);
- RecordGpuRasterizationHistogram(host_impl);
+ TreeSynchronizer::PushLayerProperties(this, sync_tree);
+ sync_tree->lifecycle().AdvanceTo(
+ LayerTreeLifecycle::kSyncedLayerProperties);
- host_impl->SetViewportSize(device_viewport_size_);
- sync_tree->SetDeviceScaleFactor(device_scale_factor_);
- host_impl->SetDebugState(debug_state_);
+ PushLayerTreePropertiesTo(sync_tree);
+ PushLayerTreeHostPropertiesTo(host_impl);
- sync_tree->set_ui_resource_request_queue(
- ui_resource_manager_->TakeUIResourcesRequests());
+ sync_tree->PassSwapPromises(swap_promise_manager_.TakeSwapPromises());
- {
- TRACE_EVENT0("cc", "LayerTreeHostInProcess::PushProperties");
+ // TODO(pdr): Move this into PushPropertyTreesTo or introduce a lifecycle
+ // state for it.
+ sync_tree->SetDeviceScaleFactor(device_scale_factor_);
- TreeSynchronizer::PushLayerProperties(this, sync_tree);
+ sync_tree->set_ui_resource_request_queue(
+ ui_resource_manager_->TakeUIResourcesRequests());
// This must happen after synchronizing property trees and after pushing
// properties, which updates the clobber_active_value flag.
+ // TODO(pdr): Enforce this comment with DCHECKS and a lifecycle state.
sync_tree->property_trees()->scroll_tree.PushScrollUpdatesFromMainThread(
property_trees(), sync_tree);
@@ -342,6 +345,7 @@ void LayerTreeHost::FinishCommitOnImplThread(
// host pushes properties as animation host push properties can change
// Animation::InEffect and we want the old InEffect value for updating
// property tree scrolling and animation.
+ // TODO(pdr): Enforce this comment with DCHECKS and a lifecycle state.
bool is_impl_side_update = false;
sync_tree->UpdatePropertyTreeScrollingAndAnimationFromMainThread(
is_impl_side_update);
@@ -349,6 +353,8 @@ void LayerTreeHost::FinishCommitOnImplThread(
TRACE_EVENT0("cc", "LayerTreeHostInProcess::AnimationHost::PushProperties");
DCHECK(host_impl->mutator_host());
mutator_host_->PushPropertiesTo(host_impl->mutator_host());
+
+ sync_tree->lifecycle().AdvanceTo(LayerTreeLifecycle::kNotSyncing);
}
// Transfer image decode requests to the impl thread.
@@ -360,6 +366,23 @@ void LayerTreeHost::FinishCommitOnImplThread(
property_trees_.ResetAllChangeTracking();
}
+void LayerTreeHost::PushPropertyTreesTo(LayerTreeImpl* tree_impl) {
+ bool property_trees_changed_on_active_tree =
+ tree_impl->IsActiveTree() && tree_impl->property_trees()->changed;
+ // Property trees may store damage status. We preserve the sync tree damage
+ // status by pushing the damage status from sync tree property trees to main
+ // thread property trees or by moving it onto the layers.
+ if (root_layer_ && property_trees_changed_on_active_tree) {
+ if (property_trees_.sequence_number ==
+ tree_impl->property_trees()->sequence_number)
+ tree_impl->property_trees()->PushChangeTrackingTo(&property_trees_);
+ else
+ tree_impl->MoveChangeTrackingToLayers();
+ }
+
+ tree_impl->SetPropertyTrees(&property_trees_);
+}
+
void LayerTreeHost::WillCommit() {
swap_promise_manager_.WillCommit();
client_->WillCommit();
@@ -1122,7 +1145,7 @@ void LayerTreeHost::SetPropertyTreesNeedRebuild() {
SetNeedsUpdateLayers();
}
-void LayerTreeHost::PushPropertiesTo(LayerTreeImpl* tree_impl) {
+void LayerTreeHost::PushLayerTreePropertiesTo(LayerTreeImpl* tree_impl) {
tree_impl->set_needs_full_tree_sync(needs_full_tree_sync_);
needs_full_tree_sync_ = false;
@@ -1160,21 +1183,6 @@ void LayerTreeHost::PushPropertiesTo(LayerTreeImpl* tree_impl) {
tree_impl->RegisterSelection(selection_);
- bool property_trees_changed_on_active_tree =
- tree_impl->IsActiveTree() && tree_impl->property_trees()->changed;
- // Property trees may store damage status. We preserve the sync tree damage
- // status by pushing the damage status from sync tree property trees to main
- // thread property trees or by moving it onto the layers.
- if (root_layer_ && property_trees_changed_on_active_tree) {
- if (property_trees_.sequence_number ==
- tree_impl->property_trees()->sequence_number)
- tree_impl->property_trees()->PushChangeTrackingTo(&property_trees_);
- else
- tree_impl->MoveChangeTrackingToLayers();
- }
- // Setting property trees must happen before pushing the page scale.
- tree_impl->SetPropertyTrees(&property_trees_);
-
tree_impl->PushPageScaleFromMainThread(
page_scale_factor_, min_page_scale_factor_, max_page_scale_factor_);
@@ -1205,6 +1213,17 @@ void LayerTreeHost::PushPropertiesTo(LayerTreeImpl* tree_impl) {
tree_impl->set_has_ever_been_drawn(false);
}
+void LayerTreeHost::PushLayerTreeHostPropertiesTo(
+ LayerTreeHostImpl* host_impl) {
+ host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_);
+ host_impl->SetContentIsSuitableForGpuRasterization(
+ content_is_suitable_for_gpu_rasterization_);
+ RecordGpuRasterizationHistogram(host_impl);
+
+ host_impl->SetViewportSize(device_viewport_size_);
+ host_impl->SetDebugState(debug_state_);
+}
+
Layer* LayerTreeHost::LayerByElementId(ElementId element_id) const {
auto iter = element_layers_map_.find(element_id);
return iter != element_layers_map_.end() ? iter->second : nullptr;
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698