summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-13 03:50:53 +0000
committerenne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-13 03:50:53 +0000
commite6ac3a7dc961433c700ce53da199085738254e3f (patch)
tree2c610e1e84df308cf9da5092ed8b681158a39606
parent09e6752c18cb6961efb5bf55d83576640cd70c8b (diff)
downloadchromium_src-e6ac3a7dc961433c700ce53da199085738254e3f.zip
chromium_src-e6ac3a7dc961433c700ce53da199085738254e3f.tar.gz
chromium_src-e6ac3a7dc961433c700ce53da199085738254e3f.tar.bz2
cc: Fix missing values on PicturePileImpl clones
Background color and tile grid info are never set on clones. Additionally, slow down raster scale factor is only set during activation, but clones have already been made. Since this value really comes from the LayerTreeHost's debug state, set it from the main thread side and push it over. This will prevent future attempts to set a value that won't get used. R=reveman@chromium.org BUG=188476 Review URL: https://chromiumcodereview.appspot.com/12449015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187761 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/picture_layer.cc2
-rw-r--r--cc/picture_layer_impl.cc2
-rw-r--r--cc/picture_pile.h4
-rw-r--r--cc/picture_pile_base.cc9
-rw-r--r--cc/picture_pile_base.h1
-rw-r--r--cc/picture_pile_impl.cc18
-rw-r--r--cc/picture_pile_impl.h6
7 files changed, 25 insertions, 17 deletions
diff --git a/cc/picture_layer.cc b/cc/picture_layer.cc
index 1ec1e18..7dc0342 100644
--- a/cc/picture_layer.cc
+++ b/cc/picture_layer.cc
@@ -52,6 +52,8 @@ void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
pile_->SetMinContentsScale(host->settings().minimumContentsScale);
pile_->SetTileGridSize(host->settings().defaultTileSize);
pile_->set_num_raster_threads(host->settings().numRasterThreads);
+ pile_->set_slow_down_raster_scale_factor(
+ host->debugState().slowDownRasterScaleFactor);
}
}
diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc
index 2f4f040..ab3c600 100644
--- a/cc/picture_layer_impl.cc
+++ b/cc/picture_layer_impl.cc
@@ -74,8 +74,6 @@ void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) {
layer_impl->TransferTilingSet(tilings_.Pass());
layer_impl->pile_ = pile_;
pile_ = PicturePileImpl::Create();
- pile_->set_slow_down_raster_scale_factor(
- layer_tree_impl()->debug_state().slowDownRasterScaleFactor);
layer_impl->raster_page_scale_ = raster_page_scale_;
layer_impl->raster_device_scale_ = raster_device_scale_;
diff --git a/cc/picture_pile.h b/cc/picture_pile.h
index 5e305cf..caf8ed5 100644
--- a/cc/picture_pile.h
+++ b/cc/picture_pile.h
@@ -33,6 +33,10 @@ class CC_EXPORT PicturePile : public PicturePileBase {
num_raster_threads_ = num_raster_threads;
}
+ void set_slow_down_raster_scale_factor(int factor) {
+ slow_down_raster_scale_factor_for_debug_ = factor;
+ }
+
private:
virtual ~PicturePile();
friend class PicturePileImpl;
diff --git a/cc/picture_pile_base.cc b/cc/picture_pile_base.cc
index 08ea4ee..645524d 100644
--- a/cc/picture_pile_base.cc
+++ b/cc/picture_pile_base.cc
@@ -18,8 +18,9 @@ const int kTileGridBorderPixels = 1;
namespace cc {
PicturePileBase::PicturePileBase()
- : min_contents_scale_(0)
- , background_color_(SkColorSetARGBInline(0, 0, 0, 0)) {
+ : min_contents_scale_(0),
+ background_color_(SkColorSetARGBInline(0, 0, 0, 0)),
+ slow_down_raster_scale_factor_for_debug_(0) {
tiling_.SetMaxTextureSize(gfx::Size(kBasePictureSize, kBasePictureSize));
tile_grid_info_.fTileInterval.setEmpty();
tile_grid_info_.fMargin.setEmpty();
@@ -102,12 +103,16 @@ void PicturePileBase::Clear() {
}
void PicturePileBase::PushPropertiesTo(PicturePileBase* other) {
+ // NOTE: If you push more values here, add them to
+ // PicturePileImpl::CloneForDrawing too.
other->picture_list_map_ = picture_list_map_;
other->tiling_ = tiling_;
other->recorded_region_ = recorded_region_;
other->min_contents_scale_ = min_contents_scale_;
other->tile_grid_info_ = tile_grid_info_;
other->background_color_ = background_color_;
+ other->slow_down_raster_scale_factor_for_debug_ =
+ slow_down_raster_scale_factor_for_debug_;
}
void PicturePileBase::UpdateRecordedRegion() {
diff --git a/cc/picture_pile_base.h b/cc/picture_pile_base.h
index a6aac25..feae72b 100644
--- a/cc/picture_pile_base.h
+++ b/cc/picture_pile_base.h
@@ -57,6 +57,7 @@ class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> {
float min_contents_scale_;
SkTileGridPicture::TileGridInfo tile_grid_info_;
SkColor background_color_;
+ int slow_down_raster_scale_factor_for_debug_;
private:
void SetBufferPixels(int buffer_pixels);
diff --git a/cc/picture_pile_impl.cc b/cc/picture_pile_impl.cc
index 8f367a8..3359dc5 100644
--- a/cc/picture_pile_impl.cc
+++ b/cc/picture_pile_impl.cc
@@ -20,9 +20,7 @@ scoped_refptr<PicturePileImpl> PicturePileImpl::Create() {
return make_scoped_refptr(new PicturePileImpl());
}
-PicturePileImpl::PicturePileImpl()
- : slow_down_raster_scale_factor_for_debug_(0) {
-}
+PicturePileImpl::PicturePileImpl() {}
PicturePileImpl::~PicturePileImpl() {
}
@@ -37,7 +35,16 @@ void PicturePileImpl::CloneForDrawing(int num_threads) {
clones_.clear();
for (int i = 0; i < num_threads; i++) {
scoped_refptr<PicturePileImpl> clone = Create();
+
+ // PicturePileBase::pushPropertiesTo, minus picture_list_map_ (handled
+ // below) and recorded_region_ (an optimization; it's unneeded to raster).
clone->tiling_ = tiling_;
+ clone->min_contents_scale_ = min_contents_scale_;
+ clone->tile_grid_info_ = tile_grid_info_;
+ clone->background_color_ = background_color_;
+ clone->slow_down_raster_scale_factor_for_debug_ =
+ slow_down_raster_scale_factor_for_debug_;
+
for (PictureListMap::const_iterator map_iter = picture_list_map_.begin();
map_iter != picture_list_map_.end(); ++map_iter) {
const PictureList& this_pic_list = map_iter->second;
@@ -47,10 +54,6 @@ void PicturePileImpl::CloneForDrawing(int num_threads) {
clone_pic_list.push_back((*pic_iter)->GetCloneForDrawingOnThread(i));
}
}
- clone->min_contents_scale_ = min_contents_scale_;
- clone->set_slow_down_raster_scale_factor(
- slow_down_raster_scale_factor_for_debug_);
-
clones_.push_back(clone);
}
}
@@ -189,6 +192,7 @@ void PicturePileImpl::GatherPixelRefs(
}
void PicturePileImpl::PushPropertiesTo(PicturePileImpl* other) {
+ // NOTE: If you push more values here, add them to CloneForDrawing too.
PicturePileBase::PushPropertiesTo(other);
other->clones_ = clones_;
}
diff --git a/cc/picture_pile_impl.h b/cc/picture_pile_impl.h
index 8b023b4..5632f87 100644
--- a/cc/picture_pile_impl.h
+++ b/cc/picture_pile_impl.h
@@ -44,10 +44,6 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase {
skia::RefPtr<SkPicture> GetFlattenedPicture();
- void set_slow_down_raster_scale_factor(int factor) {
- slow_down_raster_scale_factor_for_debug_ = factor;
- }
-
struct Analysis {
Analysis();
@@ -70,8 +66,6 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase {
typedef std::vector<scoped_refptr<PicturePileImpl> > PicturePileVector;
PicturePileVector clones_;
- int slow_down_raster_scale_factor_for_debug_;
-
DISALLOW_COPY_AND_ASSIGN(PicturePileImpl);
};