Index: cc/trees/layer_tree_host_impl.cc |
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
index 9f664fcc0ee40385784ff1cf74c61cc32fcf5371..487984ed296c9d35d08559d97177ea04a7b1147e 100644 |
--- a/cc/trees/layer_tree_host_impl.cc |
+++ b/cc/trees/layer_tree_host_impl.cc |
@@ -110,12 +110,8 @@ class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient { |
// TODO(enne): This should probably happen post-animate. |
if (layer_tree_host_impl_->pending_tree()) { |
- layer_tree_host_impl_->ActivatePendingTreeIfNeeded(); |
- |
- if (layer_tree_host_impl_->pending_tree()) { |
- layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(); |
- layer_tree_host_impl_->ManageTiles(); |
- } |
+ layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(); |
+ layer_tree_host_impl_->ManageTiles(); |
} |
layer_tree_host_impl_->Animate( |
@@ -176,6 +172,8 @@ LayerTreeHostImpl::LayerTreeHostImpl( |
should_bubble_scrolls_(false), |
wheel_scrolling_(false), |
manage_tiles_needed_(false), |
+ block_notify_ready_to_activate_for_testing_(false), |
enne (OOO)
2013/08/26 21:57:52
I kind of liked the previous interposer in that it
brianderson
2013/08/26 22:47:26
I will put the code into LayerTreeHostImplForTesti
|
+ notify_ready_to_activate_was_blocked_(false), |
root_layer_scroll_offset_delegate_(NULL), |
settings_(settings), |
visible_(true), |
@@ -254,7 +252,10 @@ void LayerTreeHostImpl::CommitComplete() { |
pending_tree_->set_needs_update_draw_properties(); |
pending_tree_->UpdateDrawProperties(); |
// Start working on newly created tiles immediately if needed. |
- ManageTiles(); |
+ if (!manage_tiles_needed_) |
+ NotifyReadyToActivate(); |
+ else |
+ ManageTiles(); |
} else { |
active_tree_->set_needs_update_draw_properties(); |
} |
@@ -1026,6 +1027,18 @@ void LayerTreeHostImpl::EvictTexturesForTesting() { |
EnforceManagedMemoryPolicy(ManagedMemoryPolicy(0)); |
} |
+ |
+void LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting(bool block) { |
+ UNSHIPPED_TRACE_EVENT1( |
+ "cc", "LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting", |
+ "block", block); |
+ block_notify_ready_to_activate_for_testing_ = block; |
+ if (!block && notify_ready_to_activate_was_blocked_) { |
+ NotifyReadyToActivate(); |
+ notify_ready_to_activate_was_blocked_ = false; |
+ } |
+} |
+ |
void LayerTreeHostImpl::EnforceManagedMemoryPolicy( |
const ManagedMemoryPolicy& policy) { |
@@ -1085,10 +1098,10 @@ void LayerTreeHostImpl::DidInitializeVisibleTile() { |
} |
void LayerTreeHostImpl::NotifyReadyToActivate() { |
- if (pending_tree_) { |
- need_to_update_visible_tiles_before_draw_ = true; |
- ActivatePendingTree(); |
- } |
+ if (block_notify_ready_to_activate_for_testing_) |
+ notify_ready_to_activate_was_blocked_ = true; |
+ else |
+ client_->NotifyReadyToActivate(); |
} |
bool LayerTreeHostImpl::ShouldClearRootRenderPass() const { |
@@ -1433,7 +1446,6 @@ void LayerTreeHostImpl::CreatePendingTree() { |
else |
pending_tree_ = LayerTreeImpl::create(this); |
client_->OnCanDrawStateChanged(CanDraw()); |
- client_->OnHasPendingTreeStateChanged(pending_tree_); |
TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree", pending_tree_.get()); |
TRACE_EVENT_ASYNC_STEP0("cc", |
"PendingTree", pending_tree_.get(), "waiting"); |
@@ -1449,33 +1461,12 @@ void LayerTreeHostImpl::UpdateVisibleTiles() { |
need_to_update_visible_tiles_before_draw_ = false; |
} |
-void LayerTreeHostImpl::ActivatePendingTreeIfNeeded() { |
- DCHECK(pending_tree_); |
- CHECK(settings_.impl_side_painting); |
- |
- if (!pending_tree_) |
- return; |
- |
- // The tile manager is usually responsible for notifying activation. |
- // If there is no tile manager, then we need to manually activate. |
- if (!tile_manager_ || tile_manager_->AreTilesRequiredForActivationReady()) { |
- ActivatePendingTree(); |
- return; |
- } |
- |
- // Manage tiles in case state affecting tile priority has changed. |
- ManageTiles(); |
- |
- TRACE_EVENT_ASYNC_STEP1( |
- "cc", |
- "PendingTree", pending_tree_.get(), "activate", |
- "state", TracedValue::FromValue(ActivationStateAsValue().release())); |
-} |
- |
void LayerTreeHostImpl::ActivatePendingTree() { |
CHECK(pending_tree_); |
TRACE_EVENT_ASYNC_END0("cc", "PendingTree", pending_tree_.get()); |
+ need_to_update_visible_tiles_before_draw_ = true; |
+ |
active_tree_->SetRootLayerScrollOffsetDelegate(NULL); |
active_tree_->PushPersistedState(pending_tree_.get()); |
if (pending_tree_->needs_full_tree_sync()) { |
@@ -1504,12 +1495,15 @@ void LayerTreeHostImpl::ActivatePendingTree() { |
root_layer_scroll_offset_delegate_); |
active_tree_->DidBecomeActive(); |
+ client_->DidActivatePendingTree(); |
+ if (!tree_activation_callback_.is_null()) |
+ tree_activation_callback_.Run(); |
+ |
// Reduce wasted memory now that unlinked resources are guaranteed not |
// to be used. |
client_->ReduceWastedContentsTextureMemoryOnImplThread(); |
client_->OnCanDrawStateChanged(CanDraw()); |
- client_->OnHasPendingTreeStateChanged(pending_tree_); |
client_->SetNeedsRedrawOnImplThread(); |
client_->RenewTreePriority(); |
@@ -1520,10 +1514,6 @@ void LayerTreeHostImpl::ActivatePendingTree() { |
stats.main_stats.paint_time + stats.main_stats.record_time + |
stats.impl_stats.rasterize_time_for_now_bins_on_pending_tree); |
} |
- |
- client_->DidActivatePendingTree(); |
- if (!tree_activation_callback_.is_null()) |
- tree_activation_callback_.Run(); |
} |
void LayerTreeHostImpl::SetVisible(bool visible) { |