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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2873313004: Harmonize LayerTreeHost/LayerTreeHostImpl synchronization steps (Closed)
Patch Set: More harmonious 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 unified diff | Download patch
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_impl.h" 5 #include "cc/trees/layer_tree_host_impl.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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 task_graph_runner_(task_graph_runner), 236 task_graph_runner_(task_graph_runner),
237 id_(id), 237 id_(id),
238 requires_high_res_to_draw_(false), 238 requires_high_res_to_draw_(false),
239 is_likely_to_require_a_draw_(false), 239 is_likely_to_require_a_draw_(false),
240 has_valid_compositor_frame_sink_(false), 240 has_valid_compositor_frame_sink_(false),
241 mutator_(nullptr), 241 mutator_(nullptr),
242 scroll_animating_latched_node_id_(ScrollTree::kInvalidNodeId), 242 scroll_animating_latched_node_id_(ScrollTree::kInvalidNodeId),
243 has_scrolled_by_wheel_(false), 243 has_scrolled_by_wheel_(false),
244 has_scrolled_by_touch_(false), 244 has_scrolled_by_touch_(false),
245 touchpad_and_wheel_scroll_latching_enabled_(false), 245 touchpad_and_wheel_scroll_latching_enabled_(false),
246 #if DCHECK_IS_ON()
247 sync_state_(NOT_SYNCING),
248 #endif
246 impl_thread_phase_(ImplThreadPhase::IDLE) { 249 impl_thread_phase_(ImplThreadPhase::IDLE) {
247 DCHECK(mutator_host_); 250 DCHECK(mutator_host_);
248 mutator_host_->SetMutatorHostClient(this); 251 mutator_host_->SetMutatorHostClient(this);
249 252
250 DCHECK(task_runner_provider_->IsImplThread()); 253 DCHECK(task_runner_provider_->IsImplThread());
251 DidVisibilityChange(this, visible_); 254 DidVisibilityChange(this, visible_);
252 255
253 SetDebugState(settings.initial_debug_state); 256 SetDebugState(settings.initial_debug_state);
254 257
255 // LTHI always has an active tree. 258 // LTHI always has an active tree.
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 2042
2040 client_->OnCanDrawStateChanged(CanDraw()); 2043 client_->OnCanDrawStateChanged(CanDraw());
2041 TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree:waiting", pending_tree_.get()); 2044 TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree:waiting", pending_tree_.get());
2042 2045
2043 DCHECK(!pending_tree_duration_timer_); 2046 DCHECK(!pending_tree_duration_timer_);
2044 pending_tree_duration_timer_.reset(new PendingTreeDurationHistogramTimer()); 2047 pending_tree_duration_timer_.reset(new PendingTreeDurationHistogramTimer());
2045 } 2048 }
2046 2049
2047 void LayerTreeHostImpl::ActivateSyncTree() { 2050 void LayerTreeHostImpl::ActivateSyncTree() {
2048 if (pending_tree_) { 2051 if (pending_tree_) {
2052 DCHECK(AdvanceSyncState(BEGINNING_SYNC));
2053
2049 TRACE_EVENT_ASYNC_END0("cc", "PendingTree:waiting", pending_tree_.get()); 2054 TRACE_EVENT_ASYNC_END0("cc", "PendingTree:waiting", pending_tree_.get());
2050 2055
2051 DCHECK(pending_tree_duration_timer_); 2056 DCHECK(pending_tree_duration_timer_);
2052 // Reset will call the destructor and log the timer histogram. 2057 // Reset will call the destructor and log the timer histogram.
2053 pending_tree_duration_timer_.reset(); 2058 pending_tree_duration_timer_.reset();
2054 2059
2055 // Process any requests in the UI resource queue. The request queue is 2060 // Process any requests in the UI resource queue. The request queue is
2056 // given in LayerTreeHost::FinishCommitOnImplThread. This must take place 2061 // given in LayerTreeHost::FinishCommitOnImplThread. This must take place
2057 // before the swap. 2062 // before the swap.
2058 pending_tree_->ProcessUIResourceRequestQueue(); 2063 pending_tree_->ProcessUIResourceRequestQueue();
2059 2064
2060 if (pending_tree_->needs_full_tree_sync()) { 2065 if (pending_tree_->needs_full_tree_sync()) {
2061 TreeSynchronizer::SynchronizeTrees(pending_tree_.get(), 2066 TreeSynchronizer::SynchronizeTrees(pending_tree_.get(),
2062 active_tree_.get()); 2067 active_tree_.get());
2063 } 2068 }
2064 2069
2065 // Property trees may store damage status. We preserve the active tree 2070 // Property trees may store damage status. We preserve the active tree
2066 // damage status by pushing the damage status from active tree property 2071 // damage status by pushing the damage status from active tree property
2067 // trees to pending tree property trees or by moving it onto the layers. 2072 // trees to pending tree property trees or by moving it onto the layers.
2068 if (active_tree_->property_trees()->changed) { 2073 if (active_tree_->property_trees()->changed) {
2069 if (pending_tree_->property_trees()->sequence_number == 2074 if (pending_tree_->property_trees()->sequence_number ==
2070 active_tree_->property_trees()->sequence_number) 2075 active_tree_->property_trees()->sequence_number)
2071 active_tree_->property_trees()->PushChangeTrackingTo( 2076 active_tree_->property_trees()->PushChangeTrackingTo(
2072 pending_tree_->property_trees()); 2077 pending_tree_->property_trees());
2073 else 2078 else
2074 active_tree_->MoveChangeTrackingToLayers(); 2079 active_tree_->MoveChangeTrackingToLayers();
2075 } 2080 }
2076 TreeSynchronizer::PushLayerProperties(pending_tree(), active_tree()); 2081
2077 active_tree_->property_trees()->PushOpacityIfNeeded( 2082 active_tree_->property_trees()->PushOpacityIfNeeded(
2078 pending_tree_->property_trees()); 2083 pending_tree_->property_trees());
2084 pending_tree_->PushPropertyTreesTo(active_tree_.get());
2085 DCHECK(AdvanceSyncState(SYNCED_PROPERTY_TREES));
2086
2087 TreeSynchronizer::PushLayerProperties(pending_tree(), active_tree());
2088 DCHECK(AdvanceSyncState(SYNCED_LAYER_PROPERTIES));
2079 2089
2080 pending_tree_->PushPropertiesTo(active_tree_.get()); 2090 pending_tree_->PushPropertiesTo(active_tree_.get());
2091 DCHECK(AdvanceSyncState(SYNCED_LAYER_TREE_HOST_PROPERTIES));
2092
2081 if (!pending_tree_->LayerListIsEmpty()) 2093 if (!pending_tree_->LayerListIsEmpty())
2082 pending_tree_->property_trees()->ResetAllChangeTracking(); 2094 pending_tree_->property_trees()->ResetAllChangeTracking();
2083 2095
2096 DCHECK(AdvanceSyncState(NOT_SYNCING));
2097
2084 // Now that we've synced everything from the pending tree to the active 2098 // Now that we've synced everything from the pending tree to the active
2085 // tree, rename the pending tree the recycle tree so we can reuse it on the 2099 // tree, rename the pending tree the recycle tree so we can reuse it on the
2086 // next sync. 2100 // next sync.
2087 DCHECK(!recycle_tree_); 2101 DCHECK(!recycle_tree_);
2088 pending_tree_.swap(recycle_tree_); 2102 pending_tree_.swap(recycle_tree_);
2089 2103
2090 // If we commit to the active tree directly, this is already done during 2104 // If we commit to the active tree directly, this is already done during
2091 // commit. 2105 // commit.
2092 ActivateAnimations(); 2106 ActivateAnimations();
2093 2107
(...skipping 2209 matching lines...) Expand 10 before | Expand all | Expand 10 after
4303 4317
4304 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { 4318 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) {
4305 if (!element_id) 4319 if (!element_id)
4306 return; 4320 return;
4307 if (ScrollbarAnimationController* animation_controller = 4321 if (ScrollbarAnimationController* animation_controller =
4308 ScrollbarAnimationControllerForElementId(element_id)) 4322 ScrollbarAnimationControllerForElementId(element_id))
4309 animation_controller->DidScrollUpdate(); 4323 animation_controller->DidScrollUpdate();
4310 } 4324 }
4311 4325
4312 } // namespace cc 4326 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698