summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2014-12-15 16:06:23 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-16 00:06:37 +0000
commitd193f6bb5aa5bdc05e07f314abacf7d7bc466d3d (patch)
treeeed0521e229908bcbb182f4adea0c93cac6df67f /cc
parent5d9f56995bdb98020897b0ade57e27c424b56fd9 (diff)
downloadchromium_src-d193f6bb5aa5bdc05e07f314abacf7d7bc466d3d.zip
chromium_src-d193f6bb5aa5bdc05e07f314abacf7d7bc466d3d.tar.gz
chromium_src-d193f6bb5aa5bdc05e07f314abacf7d7bc466d3d.tar.bz2
cc: Make the PictureLayerImpl raster source null until commit.
No need to make a raster source that is never used. R=enne, vmpstr BUG=387116 Review URL: https://codereview.chromium.org/809433003 Cr-Commit-Position: refs/heads/master@{#308466}
Diffstat (limited to 'cc')
-rw-r--r--cc/layers/picture_layer.cc2
-rw-r--r--cc/layers/picture_layer_impl.cc6
-rw-r--r--cc/layers/picture_layer_impl.h11
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc12
-rw-r--r--cc/quads/draw_quad_unittest.cc10
-rw-r--r--cc/resources/picture_pile_impl.cc4
-rw-r--r--cc/resources/picture_pile_impl.h1
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc14
8 files changed, 36 insertions, 24 deletions
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index 48f3f73..98e8dcb 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -45,7 +45,7 @@ void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
Layer::PushPropertiesTo(base_layer);
PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
// TODO(danakj): Make is_mask_ a constructor parameter for PictureLayer.
- DCHECK_EQ(layer_impl->is_mask_, is_mask_);
+ DCHECK_EQ(layer_impl->is_mask(), is_mask_);
int source_frame_number = layer_tree_host()->source_frame_number();
gfx::Size impl_bounds = layer_impl->bounds();
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 392450a3..c6fdbb5 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -69,8 +69,6 @@ PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl,
: LayerImpl(tree_impl, id),
twin_layer_(nullptr),
tilings_(CreatePictureLayerTilingSet()),
- // TODO(danakj): Can this be null to start?
- raster_source_(PicturePileImpl::Create()),
ideal_page_scale_(0.f),
ideal_device_scale_(0.f),
ideal_source_scale_(0.f),
@@ -585,7 +583,9 @@ void PictureLayerImpl::UpdateRasterSource(
<< " bounds " << bounds().ToString() << " pile "
<< raster_source->GetSize().ToString();
- bool could_have_tilings = CanHaveTilings();
+ // The |raster_source_| is initially null, so have to check for that for the
+ // first frame.
+ bool could_have_tilings = raster_source_.get() && CanHaveTilings();
raster_source_.swap(raster_source);
// The |new_invalidation| must be cleared before updating tilings since they
diff --git a/cc/layers/picture_layer_impl.h b/cc/layers/picture_layer_impl.h
index f17743d..259feea 100644
--- a/cc/layers/picture_layer_impl.h
+++ b/cc/layers/picture_layer_impl.h
@@ -46,6 +46,8 @@ class CC_EXPORT PictureLayerImpl
}
~PictureLayerImpl() override;
+ bool is_mask() const { return is_mask_; }
+
scoped_ptr<TilingSetEvictionQueue> CreateEvictionQueue(
TreePriority tree_priority);
scoped_ptr<TilingSetRasterQueue> CreateRasterQueue(bool prioritize_low_res);
@@ -78,8 +80,9 @@ class CC_EXPORT PictureLayerImpl
WhichTree GetTree() const override;
bool RequiresHighResToDraw() const override;
- // PushPropertiesTo active tree => pending tree.
- void SyncTiling(const PictureLayerTiling* tiling);
+ void UpdateRasterSource(scoped_refptr<RasterSource> raster_source,
+ Region* new_invalidation,
+ const PictureLayerTilingSet* pending_set);
// Mask-related functions.
void GetContentsResourceId(ResourceProvider::ResourceId* resource_id,
@@ -121,9 +124,6 @@ class CC_EXPORT PictureLayerImpl
void ResetRasterScale();
gfx::Rect GetViewportForTilePriorityInContentSpace() const;
PictureLayerImpl* GetRecycledTwinLayer() const;
- void UpdateRasterSource(scoped_refptr<RasterSource> raster_source,
- Region* new_invalidation,
- const PictureLayerTilingSet* pending_set);
void DoPostCommitInitializationIfNeeded() {
if (needs_post_commit_initialization_)
@@ -185,7 +185,6 @@ class CC_EXPORT PictureLayerImpl
// frame that has a valid viewport for prioritizing tiles.
gfx::Rect visible_rect_for_tile_priority_;
- friend class PictureLayer;
DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl);
};
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 7c7c899..51392a2 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -3617,16 +3617,19 @@ TEST_F(PictureLayerImplTest, UpdateTilesForMasksWithNoVisibleContent) {
scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_.pending_tree(), 1);
+ scoped_refptr<FakePicturePileImpl> pending_pile =
+ FakePicturePileImpl::CreateFilledPile(tile_size, bounds);
scoped_ptr<FakePictureLayerImpl> layer_with_mask =
- FakePictureLayerImpl::Create(host_impl_.pending_tree(), 2);
+ FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 2,
+ pending_pile);
layer_with_mask->SetBounds(bounds);
layer_with_mask->SetContentBounds(bounds);
- scoped_refptr<FakePicturePileImpl> pending_pile =
+ scoped_refptr<FakePicturePileImpl> mask_pile =
FakePicturePileImpl::CreateFilledPile(tile_size, bounds);
scoped_ptr<FakePictureLayerImpl> mask =
FakePictureLayerImpl::CreateMaskWithRasterSource(
- host_impl_.pending_tree(), 3, pending_pile);
+ host_impl_.pending_tree(), 3, mask_pile);
mask->SetBounds(bounds);
mask->SetContentBounds(bounds);
mask->SetDrawsContent(true);
@@ -3636,7 +3639,8 @@ TEST_F(PictureLayerImplTest, UpdateTilesForMasksWithNoVisibleContent) {
static_cast<FakePictureLayerImpl*>(layer_with_mask->mask_layer());
scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask =
- FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4);
+ FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 4,
+ pending_pile);
child_of_layer_with_mask->SetBounds(bounds);
child_of_layer_with_mask->SetContentBounds(bounds);
child_of_layer_with_mask->SetDrawsContent(true);
diff --git a/cc/quads/draw_quad_unittest.cc b/cc/quads/draw_quad_unittest.cc
index 97fea32..b9a4d1a 100644
--- a/cc/quads/draw_quad_unittest.cc
+++ b/cc/quads/draw_quad_unittest.cc
@@ -23,7 +23,7 @@
#include "cc/quads/texture_draw_quad.h"
#include "cc/quads/tile_draw_quad.h"
#include "cc/quads/yuv_video_draw_quad.h"
-#include "cc/resources/picture_pile_impl.h"
+#include "cc/test/fake_picture_pile_impl.h"
#include "cc/test/geometry_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/effects/SkBlurImageFilter.h"
@@ -689,7 +689,9 @@ TEST(DrawQuadTest, CopyPictureDrawQuad) {
ResourceFormat texture_format = RGBA_8888;
gfx::Rect content_rect(30, 40, 20, 30);
float contents_scale = 3.141592f;
- scoped_refptr<RasterSource> raster_source = PicturePileImpl::Create();
+ scoped_refptr<RasterSource> raster_source =
+ FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100),
+ gfx::Size(100, 100));
CREATE_SHARED_STATE();
CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect,
@@ -938,7 +940,9 @@ TEST_F(DrawQuadIteratorTest, DISABLED_PictureDrawQuad) {
ResourceFormat texture_format = RGBA_8888;
gfx::Rect content_rect(30, 40, 20, 30);
float contents_scale = 3.141592f;
- scoped_refptr<PicturePileImpl> raster_source = PicturePileImpl::Create();
+ scoped_refptr<RasterSource> raster_source =
+ FakePicturePileImpl::CreateEmptyPile(gfx::Size(100, 100),
+ gfx::Size(100, 100));
CREATE_SHARED_STATE();
CREATE_QUAD_9_NEW(PictureDrawQuad, opaque_rect, visible_rect, tex_coord_rect,
diff --git a/cc/resources/picture_pile_impl.cc b/cc/resources/picture_pile_impl.cc
index 5cd7bd6..93d84c1 100644
--- a/cc/resources/picture_pile_impl.cc
+++ b/cc/resources/picture_pile_impl.cc
@@ -28,10 +28,6 @@ const bool kDefaultClearCanvasSetting = true;
namespace cc {
-scoped_refptr<PicturePileImpl> PicturePileImpl::Create() {
- return make_scoped_refptr(new PicturePileImpl);
-}
-
scoped_refptr<PicturePileImpl> PicturePileImpl::CreateFromPicturePile(
const PicturePile* other) {
return make_scoped_refptr(new PicturePileImpl(other));
diff --git a/cc/resources/picture_pile_impl.h b/cc/resources/picture_pile_impl.h
index 3e0dd78..73994a5 100644
--- a/cc/resources/picture_pile_impl.h
+++ b/cc/resources/picture_pile_impl.h
@@ -30,7 +30,6 @@ namespace cc {
class CC_EXPORT PicturePileImpl : public RasterSource {
public:
- static scoped_refptr<PicturePileImpl> Create();
static scoped_refptr<PicturePileImpl> CreateFromPicturePile(
const PicturePile* other);
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 1cedd73..cd39eae 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -7843,8 +7843,18 @@ TEST_F(LayerTreeHostImplTest, ScrollAnimated) {
TEST_F(LayerTreeHostImplTest, GetPictureLayerImplPairs) {
host_impl_->CreatePendingTree();
- host_impl_->pending_tree()->SetRootLayer(
- PictureLayerImpl::Create(host_impl_->pending_tree(), 10, false));
+
+ scoped_ptr<PictureLayerImpl> layer =
+ PictureLayerImpl::Create(host_impl_->pending_tree(), 10, false);
+ layer->SetBounds(gfx::Size(10, 10));
+
+ scoped_refptr<RasterSource> pile(FakePicturePileImpl::CreateEmptyPile(
+ gfx::Size(10, 10), gfx::Size(10, 10)));
+ Region empty_invalidation;
+ const PictureLayerTilingSet* null_tiling_set = nullptr;
+ layer->UpdateRasterSource(pile, &empty_invalidation, null_tiling_set);
+
+ host_impl_->pending_tree()->SetRootLayer(layer.Pass());
LayerTreeImpl* pending_tree = host_impl_->pending_tree();
LayerImpl* pending_layer = pending_tree->root_layer();