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

Unified Diff: cc/resources/picture_layer_tiling.cc

Issue 12259027: cc: Simplify the logic for deciding to update tile priorities. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add early-out and unit test Created 7 years, 8 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/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_layer_tiling.cc
diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc
index 72161525725cc98f44e4f3dc31199185051721ac..862d4d8b46750864ef453049b26d21ad7fb193d5 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -33,8 +33,6 @@ scoped_ptr<PictureLayerTiling> PictureLayerTiling::Clone(
layer_bounds,
client));
out->resolution_ = resolution_;
enne (OOO) 2013/05/02 19:59:46 Looking at this code closer, but could this lead t
danakj 2013/05/02 20:02:04 Hmm! It's kinda weird anyway right? You should man
- out->last_source_frame_number_ = last_source_frame_number_;
- out->last_impl_frame_time_ = last_impl_frame_time_;
return out.Pass();
}
@@ -46,8 +44,7 @@ PictureLayerTiling::PictureLayerTiling(float contents_scale,
resolution_(NON_IDEAL_RESOLUTION),
client_(client),
tiling_data_(gfx::Size(), gfx::Size(), true),
- last_source_frame_number_(0),
- last_impl_frame_time_(0.0) {
+ last_impl_frame_time_in_seconds_(0.0) {
gfx::Size content_bounds =
gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale));
gfx::Size tile_size = client_->CalculateTileSize(content_bounds);
@@ -295,12 +292,13 @@ void PictureLayerTiling::UpdateTilePriorities(
float current_layer_contents_scale,
const gfx::Transform& last_screen_transform,
const gfx::Transform& current_screen_transform,
- int current_source_frame_number,
- double current_frame_time,
+ double current_frame_time_in_seconds,
bool store_screen_space_quads_on_tiles,
size_t max_tiles_for_interest_area) {
if (ContentRect().IsEmpty())
return;
+ if (!NeedsUpdateForFrameAtTime(current_frame_time_in_seconds))
+ return;
gfx::Rect viewport_in_content_space =
gfx::ToEnclosingRect(gfx::ScaleRect(viewport_in_layer_space,
@@ -325,26 +323,12 @@ void PictureLayerTiling::UpdateTilePriorities(
SetLiveTilesRect(interest_rect);
- bool first_update_in_new_source_frame =
- current_source_frame_number != last_source_frame_number_;
-
- 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;
-
- double time_delta = 0.0;
- if (last_impl_frame_time_ != 0.0 &&
- last_layer_bounds == current_layer_bounds)
- time_delta = current_frame_time - last_impl_frame_time_;
+ double time_delta = 0;
+ if (last_impl_frame_time_in_seconds_ != 0.0 &&
+ last_layer_bounds == current_layer_bounds) {
+ time_delta =
+ current_frame_time_in_seconds - last_impl_frame_time_in_seconds_;
+ }
gfx::Rect view_rect(device_viewport);
float current_scale = current_layer_contents_scale / contents_scale_;
@@ -437,8 +421,7 @@ void PictureLayerTiling::UpdateTilePriorities(
}
}
- last_source_frame_number_ = current_source_frame_number;
- last_impl_frame_time_ = current_frame_time;
+ last_impl_frame_time_in_seconds_ = current_frame_time_in_seconds;
}
void PictureLayerTiling::SetLiveTilesRect(
« no previous file with comments | « cc/resources/picture_layer_tiling.h ('k') | cc/resources/picture_layer_tiling_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698