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

Unified Diff: cc/picture_layer_impl.cc

Issue 12045086: cc: Throttle tile priority updates to once a frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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/picture_layer_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture_layer_impl.cc
diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc
index 80bf1fa3ae2e9fef727ef7356e69bace6e4678f5..258c43bbebd206fe02c3d92ad52053e5e8986951 100644
--- a/cc/picture_layer_impl.cc
+++ b/cc/picture_layer_impl.cc
@@ -9,6 +9,7 @@
#include "cc/checkerboard_draw_quad.h"
#include "cc/debug_border_draw_quad.h"
#include "cc/debug_colors.h"
+#include "cc/frame_rate_counter.h"
#include "cc/layer_tree_impl.h"
#include "cc/math_util.h"
#include "cc/quad_sink.h"
@@ -27,6 +28,8 @@ namespace cc {
PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* treeImpl, int id)
: LayerImpl(treeImpl, id),
pile_(PicturePileImpl::Create()),
+ last_source_frame_number_(0),
+ last_impl_frame_number_(0),
last_update_time_(0),
last_content_scale_(0),
ideal_contents_scale_(0),
@@ -66,6 +69,7 @@ void PictureLayerImpl::pushPropertiesTo(LayerImpl* base_layer) {
layer_impl->SetIsMask(is_mask_);
layer_impl->TransferTilingSet(tilings_.Pass());
layer_impl->pile_ = pile_;
+ layer_impl->last_impl_frame_number_ = 0;
pile_ = PicturePileImpl::Create();
pile_->set_slow_down_raster_scale_factor(
layerTreeImpl()->debug_state().slowDownRasterScaleFactor);
@@ -193,7 +197,25 @@ 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_;
qinmin 2013/01/25 05:07:53 i think it is possible for current_source_frame_nu
danakj 2013/01/25 05:09:01 ya you're right, i already switched it to != in th
+
+ int current_impl_frame_number =
+ layerTreeImpl()->frame_rate_counter()->currentFrameNumber();
+ bool first_frame_in_new_impl_tree =
+ last_impl_frame_number_ == 0 ||
+ current_impl_frame_number == last_impl_frame_number_;
+
+ // 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.
+ // In active tree, this is only called during draw. We update priorities:
+ // - On draws after the first frame in the tree.
+ if (first_frame_in_new_impl_tree && !first_update_in_new_source_frame)
+ return;
+
gfx::Transform current_screen_space_transform =
screenSpaceTransform();
double current_time =
@@ -214,6 +236,8 @@ void PictureLayerImpl::didUpdateTransforms() {
current_screen_space_transform,
time_delta);
+ last_source_frame_number_ = current_source_frame_number;
+ last_impl_frame_number_ = current_impl_frame_number;
last_screen_space_transform_ = current_screen_space_transform;
last_update_time_ = current_time;
last_bounds_ = bounds();
« no previous file with comments | « cc/picture_layer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698