summaryrefslogtreecommitdiff
path: root/chromium/cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-07-07 11:39:03 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-07-07 10:30:25 +0000
commitb80be2a302fe1e662a4a2b269d7ee8b7875581df (patch)
tree3a6e79ab9bc38ff554f77127b250edde8e476119 /chromium/cc
parent813fbf95af77a531c57a8c497345ad2c61d475b3 (diff)
downloadqtwebengine-chromium-b80be2a302fe1e662a4a2b269d7ee8b7875581df.tar.gz
BASELINE: Update to chromium 44.0.2403.80
Change-Id: Ib190ddcbbb5f312742c16d159bdfe9dbf7360c8a Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'chromium/cc')
-rw-r--r--chromium/cc/base/switches.cc3
-rw-r--r--chromium/cc/base/switches.h1
-rw-r--r--chromium/cc/cc_unittests.isolate3
-rw-r--r--chromium/cc/debug/rasterize_and_record_benchmark_impl.cc3
-rw-r--r--chromium/cc/layers/layer.cc12
-rw-r--r--chromium/cc/layers/layer.h4
-rw-r--r--chromium/cc/layers/picture_layer_impl.cc2
-rw-r--r--chromium/cc/layers/picture_layer_impl_perftest.cc2
-rw-r--r--chromium/cc/layers/picture_layer_impl_unittest.cc4
-rw-r--r--chromium/cc/layers/video_frame_provider_client_impl.cc28
-rw-r--r--chromium/cc/tiles/picture_layer_tiling.cc18
-rw-r--r--chromium/cc/tiles/picture_layer_tiling.h6
-rw-r--r--chromium/cc/tiles/picture_layer_tiling_perftest.cc2
-rw-r--r--chromium/cc/tiles/picture_layer_tiling_set.cc15
-rw-r--r--chromium/cc/tiles/picture_layer_tiling_set.h6
-rw-r--r--chromium/cc/tiles/picture_layer_tiling_set_unittest.cc2
-rw-r--r--chromium/cc/tiles/picture_layer_tiling_unittest.cc15
-rw-r--r--chromium/cc/tiles/tile_manager_unittest.cc12
-rw-r--r--chromium/cc/trees/layer_tree_host_impl.cc9
-rw-r--r--chromium/cc/trees/layer_tree_host_impl_unittest.cc81
-rw-r--r--chromium/cc/trees/layer_tree_host_unittest_context.cc2
-rw-r--r--chromium/cc/trees/layer_tree_settings.cc3
-rw-r--r--chromium/cc/trees/layer_tree_settings.h2
23 files changed, 171 insertions, 64 deletions
diff --git a/chromium/cc/base/switches.cc b/chromium/cc/base/switches.cc
index c30ab2fe7f0..ae424824611 100644
--- a/chromium/cc/base/switches.cc
+++ b/chromium/cc/base/switches.cc
@@ -35,6 +35,9 @@ const char kTopControlsShowThreshold[] = "top-controls-show-threshold";
// complete, such as --slow-down-raster-scale-factor=25.
const char kSlowDownRasterScaleFactor[] = "slow-down-raster-scale-factor";
+// Max tiles allowed for each tilings interest area.
+const char kMaxTilesForInterestArea[] = "max-tiles-for-interest-area";
+
// The amount of unused resource memory compositor is allowed to keep around.
const char kMaxUnusedResourceMemoryUsagePercentage[] =
"max-unused-resource-memory-usage-percentage";
diff --git a/chromium/cc/base/switches.h b/chromium/cc/base/switches.h
index 915d8e28de4..46fe922ea7e 100644
--- a/chromium/cc/base/switches.h
+++ b/chromium/cc/base/switches.h
@@ -25,6 +25,7 @@ CC_EXPORT extern const char kTopControlsHideThreshold[];
CC_EXPORT extern const char kTopControlsShowThreshold[];
CC_EXPORT extern const char kSlowDownRasterScaleFactor[];
CC_EXPORT extern const char kCompositeToMailbox[];
+CC_EXPORT extern const char kMaxTilesForInterestArea[];
CC_EXPORT extern const char kMaxUnusedResourceMemoryUsagePercentage[];
CC_EXPORT extern const char kEnablePinchVirtualViewport[];
CC_EXPORT extern const char kDisablePinchVirtualViewport[];
diff --git a/chromium/cc/cc_unittests.isolate b/chromium/cc/cc_unittests.isolate
index 7c359d04462..6a16fcd5e9c 100644
--- a/chromium/cc/cc_unittests.isolate
+++ b/chromium/cc/cc_unittests.isolate
@@ -46,7 +46,6 @@
['OS=="linux"', {
'variables': {
'files': [
- '<(PRODUCT_DIR)/libffmpegsumo.so',
'<(PRODUCT_DIR)/libosmesa.so',
],
},
@@ -54,7 +53,6 @@
['OS=="mac"', {
'variables': {
'files': [
- '<(PRODUCT_DIR)/ffmpegsumo.so',
'<(PRODUCT_DIR)/osmesa.so',
],
},
@@ -62,7 +60,6 @@
['OS=="win"', {
'variables': {
'files': [
- '<(PRODUCT_DIR)/ffmpegsumo.dll',
'<(PRODUCT_DIR)/osmesa.dll',
],
},
diff --git a/chromium/cc/debug/rasterize_and_record_benchmark_impl.cc b/chromium/cc/debug/rasterize_and_record_benchmark_impl.cc
index 22ae8daeffb..1f9a36b871f 100644
--- a/chromium/cc/debug/rasterize_and_record_benchmark_impl.cc
+++ b/chromium/cc/debug/rasterize_and_record_benchmark_impl.cc
@@ -170,8 +170,7 @@ void RasterizeAndRecordBenchmarkImpl::RunOnLayer(PictureLayerImpl* layer) {
// really matter.
const LayerTreeSettings& settings = layer->layer_tree_impl()->settings();
scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create(
- layer->GetTree(), &client,
- settings.tiling_interest_area_viewport_multiplier,
+ layer->GetTree(), &client, settings.max_tiles_for_interest_area,
settings.skewport_target_time_in_seconds,
settings.skewport_extrapolation_limit_in_content_pixels);
diff --git a/chromium/cc/layers/layer.cc b/chromium/cc/layers/layer.cc
index 5c2d6a8643d..9a10f5d55be 100644
--- a/chromium/cc/layers/layer.cc
+++ b/chromium/cc/layers/layer.cc
@@ -124,6 +124,11 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) {
if (layer_tree_host_)
layer_tree_host_->property_trees()->needs_rebuild = true;
+ if (host)
+ host->property_trees()->needs_rebuild = true;
+
+ InvalidatePropertyTreesIndices();
+
layer_tree_host_ = host;
// When changing hosts, the layer needs to commit its properties to the impl
@@ -1039,6 +1044,13 @@ int Layer::opacity_tree_index() const {
return opacity_tree_index_;
}
+void Layer::InvalidatePropertyTreesIndices() {
+ int invalid_property_tree_index = -1;
+ SetTransformTreeIndex(invalid_property_tree_index);
+ SetClipTreeIndex(invalid_property_tree_index);
+ SetOpacityTreeIndex(invalid_property_tree_index);
+}
+
void Layer::SetShouldFlattenTransform(bool should_flatten) {
DCHECK(IsPropertyChangeAllowed());
if (should_flatten_transform_ == should_flatten)
diff --git a/chromium/cc/layers/layer.h b/chromium/cc/layers/layer.h
index 9c7138e9fdc..2e4f172292f 100644
--- a/chromium/cc/layers/layer.h
+++ b/chromium/cc/layers/layer.h
@@ -674,6 +674,10 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// children.
void RemoveFromClipTree();
+ // When we detach or attach layer to new LayerTreeHost, all property trees'
+ // indices becomes invalid.
+ void InvalidatePropertyTreesIndices();
+
void UpdateNumCopyRequestsForSubtree(bool add);
void UpdateNumInputHandlersForSubtree(bool add);
diff --git a/chromium/cc/layers/picture_layer_impl.cc b/chromium/cc/layers/picture_layer_impl.cc
index 11014402c8f..f9f6d978714 100644
--- a/chromium/cc/layers/picture_layer_impl.cc
+++ b/chromium/cc/layers/picture_layer_impl.cc
@@ -1147,7 +1147,7 @@ scoped_ptr<PictureLayerTilingSet>
PictureLayerImpl::CreatePictureLayerTilingSet() {
const LayerTreeSettings& settings = layer_tree_impl()->settings();
return PictureLayerTilingSet::Create(
- GetTree(), this, settings.tiling_interest_area_viewport_multiplier,
+ GetTree(), this, settings.max_tiles_for_interest_area,
layer_tree_impl()->use_gpu_rasterization()
? settings.gpu_rasterization_skewport_target_time_in_seconds
: settings.skewport_target_time_in_seconds,
diff --git a/chromium/cc/layers/picture_layer_impl_perftest.cc b/chromium/cc/layers/picture_layer_impl_perftest.cc
index 7c3bbbb552e..adb05976f72 100644
--- a/chromium/cc/layers/picture_layer_impl_perftest.cc
+++ b/chromium/cc/layers/picture_layer_impl_perftest.cc
@@ -41,7 +41,7 @@ class PictureLayerImplPerfTest : public testing::Test {
public:
PictureLayerImplPerfTest()
: proxy_(base::ThreadTaskRunnerHandle::Get()),
- host_impl_(ImplSidePaintingSettings(10000),
+ host_impl_(ImplSidePaintingSettings(),
&proxy_,
&shared_bitmap_manager_,
&task_graph_runner_),
diff --git a/chromium/cc/layers/picture_layer_impl_unittest.cc b/chromium/cc/layers/picture_layer_impl_unittest.cc
index 2bf369684a2..cc89133b781 100644
--- a/chromium/cc/layers/picture_layer_impl_unittest.cc
+++ b/chromium/cc/layers/picture_layer_impl_unittest.cc
@@ -2558,8 +2558,8 @@ TEST_F(PictureLayerImplTest, RequiredTilesWithGpuRasterization) {
active_layer_->HighResTiling()->UpdateAllRequiredStateForTesting();
- // High res tiling should have 36 tiles (3X12 tile grid).
- EXPECT_EQ(36u, active_layer_->HighResTiling()->AllTilesForTesting().size());
+ // High res tiling should have 64 tiles (4x16 tile grid).
+ EXPECT_EQ(64u, active_layer_->HighResTiling()->AllTilesForTesting().size());
// Visible viewport should be covered by 4 tiles. No other
// tiles should be required for activation.
diff --git a/chromium/cc/layers/video_frame_provider_client_impl.cc b/chromium/cc/layers/video_frame_provider_client_impl.cc
index cdddd124e14..f2c5eb2627a 100644
--- a/chromium/cc/layers/video_frame_provider_client_impl.cc
+++ b/chromium/cc/layers/video_frame_provider_client_impl.cc
@@ -112,10 +112,12 @@ const gfx::Transform& VideoFrameProviderClientImpl::StreamTextureMatrix()
}
void VideoFrameProviderClientImpl::StopUsingProvider() {
- // Block the provider from shutting down until this client is done
- // using the frame.
- base::AutoLock locker(provider_lock_);
- provider_ = nullptr;
+ {
+ // Block the provider from shutting down until this client is done
+ // using the frame.
+ base::AutoLock locker(provider_lock_);
+ provider_ = nullptr;
+ }
if (rendering_)
StopRendering();
}
@@ -166,16 +168,20 @@ void VideoFrameProviderClientImpl::OnBeginFrame(const BeginFrameArgs& args) {
DCHECK(!stopped_);
TRACE_EVENT0("cc", "VideoFrameProviderClientImpl::OnBeginFrame");
- base::AutoLock locker(provider_lock_);
+ {
+ base::AutoLock locker(provider_lock_);
- // We use frame_time + interval here because that is the estimated time at
- // which a frame returned during this phase will end up being displayed.
- if (!provider_ ||
- !provider_->UpdateCurrentFrame(args.frame_time + args.interval,
- args.frame_time + 2 * args.interval)) {
- return;
+ // We use frame_time + interval here because that is the estimated time at
+ // which a frame returned during this phase will end up being displayed.
+ if (!provider_ ||
+ !provider_->UpdateCurrentFrame(args.frame_time + args.interval,
+ args.frame_time + 2 * args.interval)) {
+ return;
+ }
}
+ // Warning: Do not hold |provider_lock_| while calling this function, it may
+ // lead to a reentrant call to HasCurrentFrame() above.
DidReceiveFrame();
}
diff --git a/chromium/cc/tiles/picture_layer_tiling.cc b/chromium/cc/tiles/picture_layer_tiling.cc
index 58b048bcd28..c585e559e8b 100644
--- a/chromium/cc/tiles/picture_layer_tiling.cc
+++ b/chromium/cc/tiles/picture_layer_tiling.cc
@@ -35,12 +35,12 @@ scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create(
float contents_scale,
scoped_refptr<RasterSource> raster_source,
PictureLayerTilingClient* client,
- float tiling_interest_area_viewport_multiplier,
+ size_t max_tiles_for_interest_area,
float skewport_target_time_in_seconds,
int skewport_extrapolation_limit_in_content_pixels) {
return make_scoped_ptr(new PictureLayerTiling(
- tree, contents_scale, raster_source, client,
- tiling_interest_area_viewport_multiplier, skewport_target_time_in_seconds,
+ tree, contents_scale, raster_source, client, max_tiles_for_interest_area,
+ skewport_target_time_in_seconds,
skewport_extrapolation_limit_in_content_pixels));
}
@@ -49,11 +49,10 @@ PictureLayerTiling::PictureLayerTiling(
float contents_scale,
scoped_refptr<RasterSource> raster_source,
PictureLayerTilingClient* client,
- float tiling_interest_area_viewport_multiplier,
+ size_t max_tiles_for_interest_area,
float skewport_target_time_in_seconds,
int skewport_extrapolation_limit_in_content_pixels)
- : tiling_interest_area_viewport_multiplier_(
- tiling_interest_area_viewport_multiplier),
+ : max_tiles_for_interest_area_(max_tiles_for_interest_area),
skewport_target_time_in_seconds_(skewport_target_time_in_seconds),
skewport_extrapolation_limit_in_content_pixels_(
skewport_extrapolation_limit_in_content_pixels),
@@ -573,6 +572,7 @@ bool PictureLayerTiling::ComputeTilePriorityRects(
DCHECK_NE(current_frame_time_in_seconds, 0.0);
return false;
}
+
gfx::Rect visible_rect_in_content_space =
gfx::ScaleToEnclosingRect(viewport_in_layer_space, contents_scale_);
@@ -589,9 +589,9 @@ bool PictureLayerTiling::ComputeTilePriorityRects(
DCHECK(skewport.Contains(visible_rect_in_content_space));
// Calculate the eventually/live tiles rect.
- int64 eventually_rect_area = tiling_interest_area_viewport_multiplier_ *
- visible_rect_in_content_space.width() *
- visible_rect_in_content_space.height();
+ gfx::Size tile_size = tiling_data_.max_texture_size();
+ int64 eventually_rect_area =
+ max_tiles_for_interest_area_ * tile_size.width() * tile_size.height();
gfx::Rect eventually_rect =
ExpandRectEquallyToAreaBoundedBy(visible_rect_in_content_space,
diff --git a/chromium/cc/tiles/picture_layer_tiling.h b/chromium/cc/tiles/picture_layer_tiling.h
index 8af4c4c9b30..33a81879f20 100644
--- a/chromium/cc/tiles/picture_layer_tiling.h
+++ b/chromium/cc/tiles/picture_layer_tiling.h
@@ -69,7 +69,7 @@ class CC_EXPORT PictureLayerTiling {
float contents_scale,
scoped_refptr<RasterSource> raster_source,
PictureLayerTilingClient* client,
- float tiling_interest_area_viewport_multiplier,
+ size_t max_tiles_for_interest_area,
float skewport_target_time_in_seconds,
int skewport_extrapolation_limit_in_content_pixels);
@@ -237,7 +237,7 @@ class CC_EXPORT PictureLayerTiling {
float contents_scale,
scoped_refptr<RasterSource> raster_source,
PictureLayerTilingClient* client,
- float tiling_interest_area_viewport_multiplier,
+ size_t max_tiles_for_interest_area,
float skewport_target_time_in_seconds,
int skewport_extrapolation_limit_in_content_pixels);
void SetLiveTilesRect(const gfx::Rect& live_tiles_rect);
@@ -324,7 +324,7 @@ class CC_EXPORT PictureLayerTiling {
}
void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles);
- const float tiling_interest_area_viewport_multiplier_;
+ const size_t max_tiles_for_interest_area_;
const float skewport_target_time_in_seconds_;
const int skewport_extrapolation_limit_in_content_pixels_;
diff --git a/chromium/cc/tiles/picture_layer_tiling_perftest.cc b/chromium/cc/tiles/picture_layer_tiling_perftest.cc
index 3567ecb71f6..0aae512030e 100644
--- a/chromium/cc/tiles/picture_layer_tiling_perftest.cc
+++ b/chromium/cc/tiles/picture_layer_tiling_perftest.cc
@@ -52,7 +52,7 @@ class PictureLayerTilingPerfTest : public testing::Test {
gfx::Size(256 * 50, 256 * 50));
picture_layer_tiling_ = PictureLayerTiling::Create(
PENDING_TREE, 1.f, pile, &picture_layer_tiling_client_,
- defaults.tiling_interest_area_viewport_multiplier,
+ defaults.max_tiles_for_interest_area,
defaults.skewport_target_time_in_seconds,
defaults.skewport_extrapolation_limit_in_content_pixels);
picture_layer_tiling_->CreateAllTilesForTesting();
diff --git a/chromium/cc/tiles/picture_layer_tiling_set.cc b/chromium/cc/tiles/picture_layer_tiling_set.cc
index 1831539a793..b794b137ff0 100644
--- a/chromium/cc/tiles/picture_layer_tiling_set.cc
+++ b/chromium/cc/tiles/picture_layer_tiling_set.cc
@@ -33,11 +33,11 @@ inline float LargerRatio(float float1, float float2) {
scoped_ptr<PictureLayerTilingSet> PictureLayerTilingSet::Create(
WhichTree tree,
PictureLayerTilingClient* client,
- float tiling_interest_area_viewport_multiplier,
+ size_t max_tiles_for_interest_area,
float skewport_target_time_in_seconds,
int skewport_extrapolation_limit_in_content_pixels) {
return make_scoped_ptr(new PictureLayerTilingSet(
- tree, client, tiling_interest_area_viewport_multiplier,
+ tree, client, max_tiles_for_interest_area,
skewport_target_time_in_seconds,
skewport_extrapolation_limit_in_content_pixels));
}
@@ -45,11 +45,10 @@ scoped_ptr<PictureLayerTilingSet> PictureLayerTilingSet::Create(
PictureLayerTilingSet::PictureLayerTilingSet(
WhichTree tree,
PictureLayerTilingClient* client,
- float tiling_interest_area_viewport_multiplier,
+ size_t max_tiles_for_interest_area,
float skewport_target_time_in_seconds,
int skewport_extrapolation_limit_in_content_pixels)
- : tiling_interest_area_viewport_multiplier_(
- tiling_interest_area_viewport_multiplier),
+ : max_tiles_for_interest_area_(max_tiles_for_interest_area),
skewport_target_time_in_seconds_(skewport_target_time_in_seconds),
skewport_extrapolation_limit_in_content_pixels_(
skewport_extrapolation_limit_in_content_pixels),
@@ -79,8 +78,7 @@ void PictureLayerTilingSet::CopyTilingsAndPropertiesFromPendingTwin(
if (!this_tiling) {
scoped_ptr<PictureLayerTiling> new_tiling = PictureLayerTiling::Create(
tree_, contents_scale, raster_source, client_,
- tiling_interest_area_viewport_multiplier_,
- skewport_target_time_in_seconds_,
+ max_tiles_for_interest_area_, skewport_target_time_in_seconds_,
skewport_extrapolation_limit_in_content_pixels_);
tilings_.push_back(new_tiling.Pass());
this_tiling = tilings_.back();
@@ -265,8 +263,7 @@ PictureLayerTiling* PictureLayerTilingSet::AddTiling(
tilings_.push_back(PictureLayerTiling::Create(
tree_, contents_scale, raster_source, client_,
- tiling_interest_area_viewport_multiplier_,
- skewport_target_time_in_seconds_,
+ max_tiles_for_interest_area_, skewport_target_time_in_seconds_,
skewport_extrapolation_limit_in_content_pixels_));
PictureLayerTiling* appended = tilings_.back();
diff --git a/chromium/cc/tiles/picture_layer_tiling_set.h b/chromium/cc/tiles/picture_layer_tiling_set.h
index d1367f8a614..2347d53798d 100644
--- a/chromium/cc/tiles/picture_layer_tiling_set.h
+++ b/chromium/cc/tiles/picture_layer_tiling_set.h
@@ -40,7 +40,7 @@ class CC_EXPORT PictureLayerTilingSet {
static scoped_ptr<PictureLayerTilingSet> Create(
WhichTree tree,
PictureLayerTilingClient* client,
- float tiling_interest_area_viewport_multiplier,
+ size_t max_tiles_for_interest_area,
float skewport_target_time_in_seconds,
int skewport_extrapolation_limit_in_content);
@@ -176,7 +176,7 @@ class CC_EXPORT PictureLayerTilingSet {
explicit PictureLayerTilingSet(
WhichTree tree,
PictureLayerTilingClient* client,
- float tiling_interest_area_viewport_multiplier,
+ size_t max_tiles_for_interest_area,
float skewport_target_time_in_seconds,
int skewport_extrapolation_limit_in_content_pixels);
@@ -191,7 +191,7 @@ class CC_EXPORT PictureLayerTilingSet {
ScopedPtrVector<PictureLayerTiling> tilings_;
- const float tiling_interest_area_viewport_multiplier_;
+ const size_t max_tiles_for_interest_area_;
const float skewport_target_time_in_seconds_;
const int skewport_extrapolation_limit_in_content_pixels_;
WhichTree tree_;
diff --git a/chromium/cc/tiles/picture_layer_tiling_set_unittest.cc b/chromium/cc/tiles/picture_layer_tiling_set_unittest.cc
index 2d0a1b2d08a..c04870e3d16 100644
--- a/chromium/cc/tiles/picture_layer_tiling_set_unittest.cc
+++ b/chromium/cc/tiles/picture_layer_tiling_set_unittest.cc
@@ -23,7 +23,7 @@ scoped_ptr<PictureLayerTilingSet> CreateTilingSet(
PictureLayerTilingClient* client) {
LayerTreeSettings defaults;
return PictureLayerTilingSet::Create(
- ACTIVE_TREE, client, defaults.tiling_interest_area_viewport_multiplier,
+ ACTIVE_TREE, client, defaults.max_tiles_for_interest_area,
defaults.skewport_target_time_in_seconds,
defaults.skewport_extrapolation_limit_in_content_pixels);
}
diff --git a/chromium/cc/tiles/picture_layer_tiling_unittest.cc b/chromium/cc/tiles/picture_layer_tiling_unittest.cc
index 31caf461d2a..e19f9303014 100644
--- a/chromium/cc/tiles/picture_layer_tiling_unittest.cc
+++ b/chromium/cc/tiles/picture_layer_tiling_unittest.cc
@@ -48,7 +48,7 @@ class TestablePictureLayerTiling : public PictureLayerTiling {
const LayerTreeSettings& settings) {
return make_scoped_ptr(new TestablePictureLayerTiling(
tree, contents_scale, raster_source, client,
- settings.tiling_interest_area_viewport_multiplier,
+ settings.max_tiles_for_interest_area,
settings.skewport_target_time_in_seconds,
settings.skewport_extrapolation_limit_in_content_pixels));
}
@@ -63,14 +63,14 @@ class TestablePictureLayerTiling : public PictureLayerTiling {
float contents_scale,
scoped_refptr<RasterSource> raster_source,
PictureLayerTilingClient* client,
- float tiling_interest_area_viewport_multiplier,
+ size_t max_tiles_for_interest_area,
float skewport_target_time,
int skewport_extrapolation_limit)
: PictureLayerTiling(tree,
contents_scale,
raster_source,
client,
- tiling_interest_area_viewport_multiplier,
+ max_tiles_for_interest_area,
skewport_target_time,
skewport_extrapolation_limit) {}
};
@@ -549,6 +549,7 @@ TEST(PictureLayerTilingTest, SkewportLimits) {
client.SetTileSize(gfx::Size(100, 100));
LayerTreeSettings settings;
+ settings.max_tiles_for_interest_area = 10000;
settings.skewport_extrapolation_limit_in_content_pixels = 75;
scoped_refptr<FakePicturePileImpl> pile =
@@ -791,7 +792,7 @@ TEST(PictureLayerTilingTest, ViewportDistanceWithScale) {
client.SetTileSize(gfx::Size(10, 10));
LayerTreeSettings settings;
- settings.tiling_interest_area_viewport_multiplier = 10000;
+ settings.max_tiles_for_interest_area = 10000;
// Tiling at 0.25 scale: this should create 47x47 tiles of size 10x10.
// The reason is that each tile has a one pixel border, so tile at (1, 2)
@@ -1291,7 +1292,7 @@ TEST_F(PictureLayerTilingIteratorTest,
gfx::Size layer_bounds(10000, 10000);
client_.SetTileSize(gfx::Size(100, 100));
LayerTreeSettings settings;
- settings.tiling_interest_area_viewport_multiplier = 1;
+ settings.max_tiles_for_interest_area = 1;
scoped_refptr<FakePicturePileImpl> pile =
FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(layer_bounds);
@@ -1748,7 +1749,7 @@ TEST(ComputeTilePriorityRectsTest, BasicMotion) {
client.SetTileSize(gfx::Size(100, 100));
LayerTreeSettings settings;
- settings.tiling_interest_area_viewport_multiplier = 10000;
+ settings.max_tiles_for_interest_area = 10000;
scoped_refptr<FakePicturePileImpl> pile =
FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(
@@ -1878,6 +1879,7 @@ TEST(PictureLayerTilingTest, RecycledTilesCleared) {
active_client.SetTileSize(gfx::Size(100, 100));
LayerTreeSettings settings;
+ settings.max_tiles_for_interest_area = 10;
scoped_refptr<FakePicturePileImpl> pile =
FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(
@@ -1945,6 +1947,7 @@ TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) {
recycle_client.set_twin_tiling(active_tiling.get());
LayerTreeSettings settings;
+ settings.max_tiles_for_interest_area = 10;
pile = FakePicturePileImpl::CreateFilledPileWithDefaultTileSize(
gfx::Size(100, 100));
diff --git a/chromium/cc/tiles/tile_manager_unittest.cc b/chromium/cc/tiles/tile_manager_unittest.cc
index 5c7e3c12b75..bddf29f53b6 100644
--- a/chromium/cc/tiles/tile_manager_unittest.cc
+++ b/chromium/cc/tiles/tile_manager_unittest.cc
@@ -30,10 +30,7 @@ namespace {
class LowResTilingsSettings : public ImplSidePaintingSettings {
public:
- LowResTilingsSettings() {
- tiling_interest_area_viewport_multiplier = 10000;
- create_low_res_tiling = true;
- }
+ LowResTilingsSettings() { create_low_res_tiling = true; }
};
class TileManagerTilePriorityQueueTest : public testing::Test {
@@ -1180,10 +1177,10 @@ TEST_F(TileManagerTilePriorityQueueTest,
client.SetTileSize(gfx::Size(30, 30));
LayerTreeSettings settings;
- settings.tiling_interest_area_viewport_multiplier = 10000;
+ settings.max_tiles_for_interest_area = 10000;
scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create(
- ACTIVE_TREE, &client, settings.tiling_interest_area_viewport_multiplier,
+ ACTIVE_TREE, &client, settings.max_tiles_for_interest_area,
settings.skewport_target_time_in_seconds,
settings.skewport_extrapolation_limit_in_content_pixels);
@@ -1290,9 +1287,10 @@ TEST_F(TileManagerTilePriorityQueueTest,
client.SetTileSize(gfx::Size(30, 30));
LayerTreeSettings settings;
+ settings.max_tiles_for_interest_area = 10000;
scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create(
- ACTIVE_TREE, &client, settings.tiling_interest_area_viewport_multiplier,
+ ACTIVE_TREE, &client, settings.max_tiles_for_interest_area,
settings.skewport_target_time_in_seconds,
settings.skewport_extrapolation_limit_in_content_pixels);
diff --git a/chromium/cc/trees/layer_tree_host_impl.cc b/chromium/cc/trees/layer_tree_host_impl.cc
index ae6fcb8ae82..9e1474586cb 100644
--- a/chromium/cc/trees/layer_tree_host_impl.cc
+++ b/chromium/cc/trees/layer_tree_host_impl.cc
@@ -2625,6 +2625,13 @@ gfx::Vector2dF LayerTreeHostImpl::ScrollLayer(LayerImpl* layer_impl,
delta);
}
+static LayerImpl* nextLayerInScrollOrder(LayerImpl* layer) {
+ if (layer->scroll_parent())
+ return layer->scroll_parent();
+
+ return layer->parent();
+}
+
InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
const gfx::Point& viewport_point,
const gfx::Vector2dF& scroll_delta) {
@@ -2640,7 +2647,7 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
for (LayerImpl* layer_impl = CurrentlyScrollingLayer();
layer_impl;
- layer_impl = layer_impl->parent()) {
+ layer_impl = nextLayerInScrollOrder(layer_impl)) {
// Skip the outer viewport scroll layer so that we try to scroll the
// viewport only once. i.e. The inner viewport layer represents the
// viewport.
diff --git a/chromium/cc/trees/layer_tree_host_impl_unittest.cc b/chromium/cc/trees/layer_tree_host_impl_unittest.cc
index ffc0b31e746..8ff2f62a1e3 100644
--- a/chromium/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/chromium/cc/trees/layer_tree_host_impl_unittest.cc
@@ -101,7 +101,7 @@ class LayerTreeHostImplTest : public testing::Test,
reduce_memory_result_(true),
current_limit_bytes_(0),
current_priority_cutoff_value_(0) {
- media::InitializeMediaLibraryForTesting();
+ media::InitializeMediaLibrary();
}
LayerTreeSettings DefaultSettings() {
@@ -1149,6 +1149,85 @@ TEST_F(LayerTreeHostImplTest, ScrollWithSwapPromises) {
EXPECT_EQ(latency_info.trace_id, scroll_info->swap_promises[0]->TraceId());
}
+// Test that scrolls targeting a layer with a non-null scroll_parent() bubble
+// up to the scroll_parent, rather than the stacking parent.
+TEST_F(LayerTreeHostImplTest, ScrollBubblesToScrollParent) {
+ LayerImpl* viewport_scroll =
+ SetupScrollAndContentsLayers(gfx::Size(100, 100));
+ host_impl_->SetViewportSize(gfx::Size(50, 50));
+
+ // Set up two scrolling children of the root, one of which is a scroll parent
+ // to the other. Scrolls bubbling from the child should bubble to the parent,
+ // not the viewport.
+ LayerImpl *parent;
+ LayerImpl *child;
+ LayerImpl *child_clip;
+
+ scoped_ptr<LayerImpl> scroll_parent_clip =
+ LayerImpl::Create(host_impl_->active_tree(), 6);
+ scoped_ptr<LayerImpl> scroll_parent = CreateScrollableLayer(
+ 7, gfx::Size(10, 10), scroll_parent_clip.get());
+ parent = scroll_parent.get();
+ scroll_parent_clip->AddChild(scroll_parent.Pass());
+
+ viewport_scroll->AddChild(scroll_parent_clip.Pass());
+
+ scoped_ptr<LayerImpl> scroll_child_clip =
+ LayerImpl::Create(host_impl_->active_tree(), 8);
+ scoped_ptr<LayerImpl> scroll_child = CreateScrollableLayer(
+ 9, gfx::Size(10, 10), scroll_child_clip.get());
+ child = scroll_child.get();
+ scroll_child->SetPosition(gfx::Point(20, 20));
+ scroll_child_clip->AddChild(scroll_child.Pass());
+
+ child_clip = scroll_child_clip.get();
+ viewport_scroll->AddChild(scroll_child_clip.Pass());
+
+ child_clip->SetScrollParent(parent);
+
+ DrawFrame();
+
+ {
+ host_impl_->ScrollBegin(gfx::Point(21, 21), InputHandler::GESTURE);
+ host_impl_->ScrollBy(gfx::Point(21, 21), gfx::Vector2d(5, 5));
+ host_impl_->ScrollBy(gfx::Point(21, 21), gfx::Vector2d(2, 1));
+ host_impl_->ScrollEnd();
+
+ // The child should be fully scrolled by the first ScrollBy.
+ EXPECT_VECTOR_EQ(gfx::Vector2dF(5, 5), child->CurrentScrollOffset());
+
+ // The scroll_parent should receive the bubbled up second ScrollBy.
+ EXPECT_VECTOR_EQ(gfx::Vector2dF(2, 1), parent->CurrentScrollOffset());
+
+ // The viewport shouldn't have been scrolled at all.
+ EXPECT_VECTOR_EQ(
+ gfx::Vector2dF(0, 0),
+ host_impl_->InnerViewportScrollLayer()->CurrentScrollOffset());
+ EXPECT_VECTOR_EQ(
+ gfx::Vector2dF(0, 0),
+ host_impl_->OuterViewportScrollLayer()->CurrentScrollOffset());
+ }
+
+ {
+ host_impl_->ScrollBegin(gfx::Point(21, 21), InputHandler::GESTURE);
+ host_impl_->ScrollBy(gfx::Point(21, 21), gfx::Vector2d(3, 4));
+ host_impl_->ScrollBy(gfx::Point(21, 21), gfx::Vector2d(2, 1));
+ host_impl_->ScrollEnd();
+
+ // The first ScrollBy should scroll the parent to its extent.
+ EXPECT_VECTOR_EQ(gfx::Vector2dF(5, 5), parent->CurrentScrollOffset());
+
+ // The viewport should now be next in bubbling order.
+ EXPECT_VECTOR_EQ(
+ gfx::Vector2dF(2, 1),
+ host_impl_->InnerViewportScrollLayer()->CurrentScrollOffset());
+ EXPECT_VECTOR_EQ(
+ gfx::Vector2dF(0, 0),
+ host_impl_->OuterViewportScrollLayer()->CurrentScrollOffset());
+ }
+}
+
+
TEST_F(LayerTreeHostImplTest, PinchGesture) {
SetupScrollAndContentsLayers(gfx::Size(100, 100));
host_impl_->SetViewportSize(gfx::Size(50, 50));
diff --git a/chromium/cc/trees/layer_tree_host_unittest_context.cc b/chromium/cc/trees/layer_tree_host_unittest_context.cc
index a2f06113f03..82e47b89b0e 100644
--- a/chromium/cc/trees/layer_tree_host_unittest_context.cc
+++ b/chromium/cc/trees/layer_tree_host_unittest_context.cc
@@ -66,7 +66,7 @@ class LayerTreeHostContextTest : public LayerTreeTest {
context_should_support_io_surface_(false),
fallback_context_works_(false),
async_output_surface_creation_(false) {
- media::InitializeMediaLibraryForTesting();
+ media::InitializeMediaLibrary();
}
void LoseContext() {
diff --git a/chromium/cc/trees/layer_tree_settings.cc b/chromium/cc/trees/layer_tree_settings.cc
index d2c3bda2b9c..f7f6f3047da 100644
--- a/chromium/cc/trees/layer_tree_settings.cc
+++ b/chromium/cc/trees/layer_tree_settings.cc
@@ -52,7 +52,8 @@ LayerTreeSettings::LayerTreeSettings()
default_tile_grid_size(gfx::Size(256, 256)),
minimum_occlusion_tracking_size(gfx::Size(160, 160)),
use_pinch_virtual_viewport(false),
- tiling_interest_area_viewport_multiplier(9.0f),
+ // At 256x256 tiles, 128 tiles cover an area of 2048x4096 pixels.
+ max_tiles_for_interest_area(128),
skewport_target_time_in_seconds(1.0f),
skewport_extrapolation_limit_in_content_pixels(2000),
max_unused_resource_memory_percentage(100),
diff --git a/chromium/cc/trees/layer_tree_settings.h b/chromium/cc/trees/layer_tree_settings.h
index 0e1819b0d95..56cfa3a9809 100644
--- a/chromium/cc/trees/layer_tree_settings.h
+++ b/chromium/cc/trees/layer_tree_settings.h
@@ -65,7 +65,7 @@ class CC_EXPORT LayerTreeSettings {
gfx::Size default_tile_grid_size;
gfx::Size minimum_occlusion_tracking_size;
bool use_pinch_virtual_viewport;
- float tiling_interest_area_viewport_multiplier;
+ size_t max_tiles_for_interest_area;
float skewport_target_time_in_seconds;
int skewport_extrapolation_limit_in_content_pixels;
size_t max_unused_resource_memory_percentage;