| Index: cc/picture_layer_impl.cc
|
| diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc
|
| index 97a79f4f16a56e255c889bc8fa22f2074d151e3e..22d0653ddccdea0df5b8e23965422e98648dcfe0 100644
|
| --- a/cc/picture_layer_impl.cc
|
| +++ b/cc/picture_layer_impl.cc
|
| @@ -27,7 +27,8 @@ namespace cc {
|
| PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* treeImpl, int id)
|
| : LayerImpl(treeImpl, id),
|
| pile_(PicturePileImpl::Create()),
|
| - last_update_time_(0),
|
| + last_source_frame_number_(0),
|
| + last_impl_frame_time_(0),
|
| last_content_scale_(0),
|
| ideal_contents_scale_(0),
|
| is_mask_(false) {
|
| @@ -66,6 +67,10 @@ void PictureLayerImpl::pushPropertiesTo(LayerImpl* base_layer) {
|
| layer_impl->SetIsMask(is_mask_);
|
| layer_impl->TransferTilingSet(tilings_.Pass());
|
| layer_impl->pile_ = pile_;
|
| + // Sync over the last source frame number so the active tree does not respond
|
| + // to the source frame number changing in its tree.
|
| + layer_impl->last_source_frame_number_ = last_source_frame_number_;
|
| + layer_impl->last_impl_frame_time_ = last_impl_frame_time_;
|
| pile_ = PicturePileImpl::Create();
|
| pile_->set_slow_down_raster_scale_factor(
|
| layerTreeImpl()->debug_state().slowDownRasterScaleFactor);
|
| @@ -197,16 +202,33 @@ void PictureLayerImpl::dumpLayerProperties(std::string*, int indent) const {
|
| // TODO(enne): implement me
|
| }
|
|
|
| -void PictureLayerImpl::didUpdateTransforms() {
|
| +void PictureLayerImpl::updateTilePriorities() {
|
| + int current_source_frame_number = layerTreeImpl()->source_frame_number();
|
| + bool first_update_in_new_source_frame =
|
| + current_source_frame_number != last_source_frame_number_;
|
| +
|
| + double current_frame_time =
|
| + (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
|
| + bool first_update_in_new_impl_frame =
|
| + current_frame_time != last_impl_frame_time_;
|
| +
|
| + // In pending tree, this is always called. We update priorities:
|
| + // - Immediately after a commit (first_update_in_new_source_frame).
|
| + // - On animation ticks after the first frame in the tree
|
| + // (first_update_in_new_impl_frame).
|
| + // In active tree, this is only called during draw. We update priorities:
|
| + // - On draw if properties were not already computed by the pending tree
|
| + // and activated for the frame (first_update_in_new_impl_frame).
|
| + if (!first_update_in_new_impl_frame && !first_update_in_new_source_frame)
|
| + return;
|
| +
|
| gfx::Transform current_screen_space_transform =
|
| screenSpaceTransform();
|
| - double current_time =
|
| - (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
|
| double time_delta = 0;
|
| - if (last_update_time_ != 0 && last_bounds_ == bounds() &&
|
| + if (last_impl_frame_time_ != 0 && last_bounds_ == bounds() &&
|
| last_content_bounds_ == contentBounds() &&
|
| last_content_scale_ == contentsScaleX()) {
|
| - time_delta = current_time - last_update_time_;
|
| + time_delta = current_frame_time - last_impl_frame_time_;
|
| }
|
| WhichTree tree = layerTreeImpl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE;
|
| tilings_->UpdateTilePriorities(
|
| @@ -218,8 +240,9 @@ void PictureLayerImpl::didUpdateTransforms() {
|
| current_screen_space_transform,
|
| time_delta);
|
|
|
| + last_source_frame_number_ = current_source_frame_number;
|
| last_screen_space_transform_ = current_screen_space_transform;
|
| - last_update_time_ = current_time;
|
| + last_impl_frame_time_ = current_frame_time;
|
| last_bounds_ = bounds();
|
| last_content_bounds_ = contentBounds();
|
| last_content_scale_ = contentsScaleX();
|
|
|