summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-22 07:24:01 +0000
committerreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-22 07:25:46 +0000
commit2b465199719e718e3471a497bf07c7bf4abf6f99 (patch)
tree7df72341d9f089e7786ab7450122316ba35c80d6 /cc
parentab8bcef370b99db6414eee827ba845a44d683380 (diff)
downloadchromium_src-2b465199719e718e3471a497bf07c7bf4abf6f99.zip
chromium_src-2b465199719e718e3471a497bf07c7bf4abf6f99.tar.gz
chromium_src-2b465199719e718e3471a497bf07c7bf4abf6f99.tar.bz2
cc: Remove all traces of SkPicture cloning.
Skia no longer require SkPictures to be cloned for playback on different threads. This removes all compositor code that exists only to handle the cloning requirement. BUG=235280 Review URL: https://codereview.chromium.org/362073002 Cr-Commit-Position: refs/heads/master@{#291350} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/debug/picture_record_benchmark.cc2
-rw-r--r--cc/debug/rasterize_and_record_benchmark.cc2
-rw-r--r--cc/debug/rasterize_and_record_benchmark_impl.cc7
-rw-r--r--cc/output/direct_renderer.h1
-rw-r--r--cc/output/gl_renderer.cc49
-rw-r--r--cc/output/overlay_unittest.cc1
-rw-r--r--cc/output/renderer.h1
-rw-r--r--cc/output/software_renderer.cc48
-rw-r--r--cc/output/software_renderer_unittest.cc1
-rw-r--r--cc/resources/picture.cc56
-rw-r--r--cc/resources/picture.h15
-rw-r--r--cc/resources/picture_layer_tiling.cc5
-rw-r--r--cc/resources/picture_pile.cc4
-rw-r--r--cc/resources/picture_pile_base.cc40
-rw-r--r--cc/resources/picture_pile_base.h10
-rw-r--r--cc/resources/picture_pile_impl.cc66
-rw-r--r--cc/resources/picture_pile_impl.h56
-rw-r--r--cc/resources/picture_pile_unittest.cc2
-rw-r--r--cc/resources/picture_unittest.cc16
-rw-r--r--cc/resources/raster_worker_pool.cc28
-rw-r--r--cc/resources/raster_worker_pool.h4
-rw-r--r--cc/resources/tile_manager.cc31
-rw-r--r--cc/surfaces/display.h1
-rw-r--r--cc/test/fake_picture_pile_impl.cc2
-rw-r--r--cc/test/fake_renderer_client.h1
-rw-r--r--cc/test/pixel_test.cc24
-rw-r--r--cc/test/pixel_test.h1
-rw-r--r--cc/trees/layer_tree_host_impl.cc34
-rw-r--r--cc/trees/layer_tree_host_impl.h5
29 files changed, 74 insertions, 439 deletions
diff --git a/cc/debug/picture_record_benchmark.cc b/cc/debug/picture_record_benchmark.cc
index a1528c3..e6a5a65 100644
--- a/cc/debug/picture_record_benchmark.cc
+++ b/cc/debug/picture_record_benchmark.cc
@@ -111,7 +111,7 @@ void PictureRecordBenchmark::RunOnLayer(PictureLayer* layer) {
base::TimeTicks start = base::TimeTicks::HighResNow();
scoped_refptr<Picture> picture = Picture::Create(
- rect, painter, tile_grid_info, false, 0, Picture::RECORD_NORMALLY);
+ rect, painter, tile_grid_info, false, Picture::RECORD_NORMALLY);
base::TimeTicks end = base::TimeTicks::HighResNow();
base::TimeDelta duration = end - start;
diff --git a/cc/debug/rasterize_and_record_benchmark.cc b/cc/debug/rasterize_and_record_benchmark.cc
index 197fb29..c2a47d0 100644
--- a/cc/debug/rasterize_and_record_benchmark.cc
+++ b/cc/debug/rasterize_and_record_benchmark.cc
@@ -130,7 +130,7 @@ void RasterizeAndRecordBenchmark::RunOnLayer(PictureLayer* layer) {
kTimeCheckInterval);
do {
scoped_refptr<Picture> picture = Picture::Create(
- visible_content_rect, painter, tile_grid_info, false, 0, mode);
+ visible_content_rect, painter, tile_grid_info, false, mode);
timer.NextLap();
} while (!timer.HasTimeLimitExpired());
base::TimeDelta duration =
diff --git a/cc/debug/rasterize_and_record_benchmark_impl.cc b/cc/debug/rasterize_and_record_benchmark_impl.cc
index 0449e01..036fdb8 100644
--- a/cc/debug/rasterize_and_record_benchmark_impl.cc
+++ b/cc/debug/rasterize_and_record_benchmark_impl.cc
@@ -38,9 +38,6 @@ class BenchmarkRasterTask : public Task {
// Overridden from Task:
virtual void RunOnWorkerThread() OVERRIDE {
- PicturePileImpl* picture_pile = picture_pile_->GetCloneForDrawingOnThread(
- RasterWorkerPool::GetPictureCloneIndexForCurrentThread());
-
// Parameters for LapTimer.
const int kTimeLimitMillis = 1;
const int kWarmupRuns = 0;
@@ -59,9 +56,9 @@ class BenchmarkRasterTask : public Task {
SkCanvas canvas(bitmap);
PicturePileImpl::Analysis analysis;
- picture_pile->AnalyzeInRect(
+ picture_pile_->AnalyzeInRect(
content_rect_, contents_scale_, &analysis, NULL);
- picture_pile->RasterToBitmap(
+ picture_pile_->RasterToBitmap(
&canvas, content_rect_, contents_scale_, NULL);
is_solid_color_ = analysis.is_solid_color;
diff --git a/cc/output/direct_renderer.h b/cc/output/direct_renderer.h
index 442d371..dab93f9 100644
--- a/cc/output/direct_renderer.h
+++ b/cc/output/direct_renderer.h
@@ -13,7 +13,6 @@
#include "cc/output/renderer.h"
#include "cc/resources/resource_provider.h"
#include "cc/resources/scoped_resource.h"
-#include "cc/resources/task_graph_runner.h"
namespace cc {
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 7fcf540..d14feb6 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -27,7 +27,6 @@
#include "cc/quads/stream_video_draw_quad.h"
#include "cc/quads/texture_draw_quad.h"
#include "cc/resources/layer_quad.h"
-#include "cc/resources/raster_worker_pool.h"
#include "cc/resources/scoped_resource.h"
#include "cc/resources/texture_mailbox_deleter.h"
#include "gpu/GLES2/gl2extchromium.h"
@@ -80,44 +79,6 @@ class FallbackFence : public ResourceProvider::Fence {
DISALLOW_COPY_AND_ASSIGN(FallbackFence);
};
-class OnDemandRasterTaskImpl : public Task {
- public:
- OnDemandRasterTaskImpl(PicturePileImpl* picture_pile,
- SkBitmap* bitmap,
- gfx::Rect content_rect,
- float contents_scale)
- : picture_pile_(picture_pile),
- bitmap_(bitmap),
- content_rect_(content_rect),
- contents_scale_(contents_scale) {
- DCHECK(picture_pile_);
- DCHECK(bitmap_);
- }
-
- // Overridden from Task:
- virtual void RunOnWorkerThread() OVERRIDE {
- TRACE_EVENT0("cc", "OnDemandRasterTaskImpl::RunOnWorkerThread");
- SkCanvas canvas(*bitmap_);
-
- PicturePileImpl* picture_pile = picture_pile_->GetCloneForDrawingOnThread(
- RasterWorkerPool::GetPictureCloneIndexForCurrentThread());
- DCHECK(picture_pile);
-
- picture_pile->RasterToBitmap(&canvas, content_rect_, contents_scale_, NULL);
- }
-
- protected:
- virtual ~OnDemandRasterTaskImpl() {}
-
- private:
- PicturePileImpl* picture_pile_;
- SkBitmap* bitmap_;
- const gfx::Rect content_rect_;
- const float contents_scale_;
-
- DISALLOW_COPY_AND_ASSIGN(OnDemandRasterTaskImpl);
-};
-
bool NeedsIOSurfaceReadbackWorkaround() {
#if defined(OS_MACOSX)
// This isn't strictly required in DumpRenderTree-mode when Mesa is used,
@@ -1938,13 +1899,9 @@ void GLRenderer::DrawPictureQuad(const DrawingFrame* frame,
quad->texture_format);
}
- // Create and run on-demand raster task for tile.
- scoped_refptr<Task> on_demand_raster_task(
- new OnDemandRasterTaskImpl(quad->picture_pile,
- &on_demand_tile_raster_bitmap_,
- quad->content_rect,
- quad->contents_scale));
- client_->RunOnDemandRasterTask(on_demand_raster_task.get());
+ SkCanvas canvas(on_demand_tile_raster_bitmap_);
+ quad->picture_pile->RasterToBitmap(
+ &canvas, quad->content_rect, quad->contents_scale, NULL);
uint8_t* bitmap_pixels = NULL;
SkBitmap on_demand_tile_raster_bitmap_dest;
diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc
index f042c27..ab2a46a 100644
--- a/cc/output/overlay_unittest.cc
+++ b/cc/output/overlay_unittest.cc
@@ -545,7 +545,6 @@ class FakeRendererClient : public RendererClient {
public:
// RendererClient methods.
virtual void SetFullRootLayerDamage() OVERRIDE {}
- virtual void RunOnDemandRasterTask(Task* on_demand_raster_task) OVERRIDE {}
};
class MockOverlayScheduler {
diff --git a/cc/output/renderer.h b/cc/output/renderer.h
index b6d0cd4..3b68749 100644
--- a/cc/output/renderer.h
+++ b/cc/output/renderer.h
@@ -40,7 +40,6 @@ struct RendererCapabilitiesImpl {
class CC_EXPORT RendererClient {
public:
virtual void SetFullRootLayerDamage() = 0;
- virtual void RunOnDemandRasterTask(Task* on_demand_raster_task) = 0;
};
class CC_EXPORT Renderer {
diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc
index aaa951c..88b9c64 100644
--- a/cc/output/software_renderer.cc
+++ b/cc/output/software_renderer.cc
@@ -20,7 +20,6 @@
#include "cc/quads/solid_color_draw_quad.h"
#include "cc/quads/texture_draw_quad.h"
#include "cc/quads/tile_draw_quad.h"
-#include "cc/resources/raster_worker_pool.h"
#include "skia/ext/opacity_draw_filter.h"
#include "third_party/skia/include/core/SkBitmapDevice.h"
#include "third_party/skia/include/core/SkCanvas.h"
@@ -34,46 +33,8 @@
#include "ui/gfx/transform.h"
namespace cc {
-
namespace {
-class OnDemandRasterTaskImpl : public Task {
- public:
- OnDemandRasterTaskImpl(PicturePileImpl* picture_pile,
- SkCanvas* canvas,
- gfx::Rect content_rect,
- float contents_scale)
- : picture_pile_(picture_pile),
- canvas_(canvas),
- content_rect_(content_rect),
- contents_scale_(contents_scale) {
- DCHECK(picture_pile_);
- DCHECK(canvas_);
- }
-
- // Overridden from Task:
- virtual void RunOnWorkerThread() OVERRIDE {
- TRACE_EVENT0("cc", "OnDemandRasterTaskImpl::RunOnWorkerThread");
-
- PicturePileImpl* picture_pile = picture_pile_->GetCloneForDrawingOnThread(
- RasterWorkerPool::GetPictureCloneIndexForCurrentThread());
- DCHECK(picture_pile);
-
- picture_pile->RasterDirect(canvas_, content_rect_, contents_scale_, NULL);
- }
-
- protected:
- virtual ~OnDemandRasterTaskImpl() {}
-
- private:
- PicturePileImpl* picture_pile_;
- SkCanvas* canvas_;
- const gfx::Rect content_rect_;
- const float contents_scale_;
-
- DISALLOW_COPY_AND_ASSIGN(OnDemandRasterTaskImpl);
-};
-
static inline bool IsScalarNearlyInteger(SkScalar scalar) {
return SkScalarNearlyZero(scalar - SkScalarRoundToScalar(scalar));
}
@@ -389,13 +350,8 @@ void SoftwareRenderer::DrawPictureQuad(const DrawingFrame* frame,
TRACE_EVENT0("cc",
"SoftwareRenderer::DrawPictureQuad");
- // Create and run on-demand raster task for tile.
- scoped_refptr<Task> on_demand_raster_task(
- new OnDemandRasterTaskImpl(quad->picture_pile,
- current_canvas_,
- quad->content_rect,
- quad->contents_scale));
- client_->RunOnDemandRasterTask(on_demand_raster_task.get());
+ quad->picture_pile->RasterDirect(
+ current_canvas_, quad->content_rect, quad->contents_scale, NULL);
current_canvas_->setDrawFilter(NULL);
}
diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc
index cd82679..46d5900 100644
--- a/cc/output/software_renderer_unittest.cc
+++ b/cc/output/software_renderer_unittest.cc
@@ -51,7 +51,6 @@ class SoftwareRendererTest : public testing::Test, public RendererClient {
// RendererClient implementation.
virtual void SetFullRootLayerDamage() OVERRIDE {}
- virtual void RunOnDemandRasterTask(Task* on_demand_raster_task) OVERRIDE {}
scoped_ptr<SkBitmap> DrawAndCopyOutput(RenderPassList* list,
float device_scale_factor,
diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc
index 5bfb776..06e9cc9 100644
--- a/cc/resources/picture.cc
+++ b/cc/resources/picture.cc
@@ -89,14 +89,12 @@ scoped_refptr<Picture> Picture::Create(
ContentLayerClient* client,
const SkTileGridFactory::TileGridInfo& tile_grid_info,
bool gather_pixel_refs,
- int num_raster_threads,
RecordingMode recording_mode) {
scoped_refptr<Picture> picture = make_scoped_refptr(new Picture(layer_rect));
picture->Record(client, tile_grid_info, recording_mode);
if (gather_pixel_refs)
picture->GatherPixelRefs(tile_grid_info);
- picture->CloneForDrawing(num_raster_threads);
return picture;
}
@@ -192,18 +190,6 @@ Picture::~Picture() {
TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::Picture", this);
}
-Picture* Picture::GetCloneForDrawingOnThread(unsigned thread_index) {
- // We don't need clones to draw from multiple threads with SkRecord.
- if (playback_) {
- return this;
- }
-
- // SkPicture is not thread-safe to rasterize with, this returns a clone
- // to rasterize with on a specific thread.
- CHECK_GE(clones_.size(), thread_index);
- return thread_index == clones_.size() ? this : clones_[thread_index].get();
-}
-
bool Picture::IsSuitableForGpuRasterization() const {
DCHECK(picture_);
@@ -222,35 +208,6 @@ bool Picture::HasText() const {
return picture_->hasText();
}
-void Picture::CloneForDrawing(int num_threads) {
- TRACE_EVENT1("cc", "Picture::CloneForDrawing", "num_threads", num_threads);
-
- // We don't need clones to draw from multiple threads with SkRecord.
- if (playback_) {
- return;
- }
-
- DCHECK(picture_);
- DCHECK(clones_.empty());
-
- // We can re-use this picture for one raster worker thread.
- raster_thread_checker_.DetachFromThread();
-
- if (num_threads > 1) {
- for (int i = 0; i < num_threads - 1; i++) {
- scoped_refptr<Picture> clone =
- new Picture(skia::AdoptRef(picture_->clone()),
- layer_rect_,
- opaque_rect_,
- pixel_refs_);
- clones_.push_back(clone);
-
- clone->EmitTraceSnapshotAlias(this);
- clone->raster_thread_checker_.DetachFromThread();
- }
- }
-}
-
void Picture::Record(ContentLayerClient* painter,
const SkTileGridFactory::TileGridInfo& tile_grid_info,
RecordingMode recording_mode) {
@@ -386,13 +343,10 @@ void Picture::GatherPixelRefs(
max_pixel_cell_ = gfx::Point(max_x, max_y);
}
-int Picture::Raster(
- SkCanvas* canvas,
- SkDrawPictureCallback* callback,
- const Region& negated_content_region,
- float contents_scale) {
- if (!playback_)
- DCHECK(raster_thread_checker_.CalledOnValidThread());
+int Picture::Raster(SkCanvas* canvas,
+ SkDrawPictureCallback* callback,
+ const Region& negated_content_region,
+ float contents_scale) const {
TRACE_EVENT_BEGIN1(
"cc",
"Picture::Raster",
@@ -423,8 +377,6 @@ int Picture::Raster(
}
void Picture::Replay(SkCanvas* canvas) {
- if (!playback_)
- DCHECK(raster_thread_checker_.CalledOnValidThread());
TRACE_EVENT_BEGIN0("cc", "Picture::Replay");
DCHECK(picture_);
diff --git a/cc/resources/picture.h b/cc/resources/picture.h
index 824288c..e44f944 100644
--- a/cc/resources/picture.h
+++ b/cc/resources/picture.h
@@ -16,7 +16,6 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "base/threading/thread_checker.h"
#include "cc/base/cc_export.h"
#include "cc/base/region.h"
#include "skia/ext/refptr.h"
@@ -59,7 +58,6 @@ class CC_EXPORT Picture
ContentLayerClient* client,
const SkTileGridFactory::TileGridInfo& tile_grid_info,
bool gather_pixels_refs,
- int num_raster_threads,
RecordingMode recording_mode);
static scoped_refptr<Picture> CreateFromValue(const base::Value* value);
static scoped_refptr<Picture> CreateFromSkpValue(const base::Value* value);
@@ -67,9 +65,6 @@ class CC_EXPORT Picture
gfx::Rect LayerRect() const { return layer_rect_; }
gfx::Rect OpaqueRect() const { return opaque_rect_; }
- // Get thread-safe clone for rasterizing with on a specific thread.
- Picture* GetCloneForDrawingOnThread(unsigned thread_index);
-
// Has Record() been called yet?
bool HasRecording() const { return picture_.get() != NULL; }
@@ -84,7 +79,7 @@ class CC_EXPORT Picture
int Raster(SkCanvas* canvas,
SkDrawPictureCallback* callback,
const Region& negated_content_region,
- float contents_scale);
+ float contents_scale) const;
// Draw the picture directly into the given canvas, without applying any
// clip/scale/layer transformations.
@@ -147,9 +142,6 @@ class CC_EXPORT Picture
const gfx::Rect& opaque_rect);
~Picture();
- // Make thread-safe clones for rasterizing with.
- void CloneForDrawing(int num_threads);
-
// Record a paint operation. To be able to safely use this SkPicture for
// playback on a different thread this can only be called once.
void Record(ContentLayerClient* client,
@@ -164,9 +156,6 @@ class CC_EXPORT Picture
skia::RefPtr<SkPicture> picture_;
scoped_ptr<const EXPERIMENTAL::SkPlayback> playback_;
- typedef std::vector<scoped_refptr<Picture> > PictureVector;
- PictureVector clones_;
-
PixelRefMap pixel_refs_;
gfx::Point min_pixel_cell_;
gfx::Point max_pixel_cell_;
@@ -177,8 +166,6 @@ class CC_EXPORT Picture
scoped_refptr<base::debug::ConvertableToTraceFormat>
AsTraceableRecordData() const;
- base::ThreadChecker raster_thread_checker_;
-
friend class base::RefCountedThreadSafe<Picture>;
friend class PixelRefIterator;
DISALLOW_COPY_AND_ASSIGN(Picture);
diff --git a/cc/resources/picture_layer_tiling.cc b/cc/resources/picture_layer_tiling.cc
index a385fc6..3d132e1 100644
--- a/cc/resources/picture_layer_tiling.cc
+++ b/cc/resources/picture_layer_tiling.cc
@@ -666,9 +666,8 @@ void PictureLayerTiling::DidBecomeActive() {
// Tile holds a ref onto a picture pile. If the tile never gets invalidated
// and recreated, then that picture pile ref could exist indefinitely. To
// prevent this, ask the client to update the pile to its own ref. This
- // will cause PicturePileImpls and their clones to get deleted once the
- // corresponding PictureLayerImpl and any in flight raster jobs go out of
- // scope.
+ // will cause PicturePileImpls to get deleted once the corresponding
+ // PictureLayerImpl and any in flight raster jobs go out of scope.
it->second->set_picture_pile(active_pile);
}
}
diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc
index b67f9ee..ae67cd4 100644
--- a/cc/resources/picture_pile.cc
+++ b/cc/resources/picture_pile.cc
@@ -345,13 +345,12 @@ bool PicturePile::UpdateAndExpandInvalidation(
int repeat_count = std::max(1, slow_down_raster_scale_factor_for_debug_);
scoped_refptr<Picture> picture;
- int num_raster_threads = RasterWorkerPool::GetNumRasterThreads();
// Note: Currently, gathering of pixel refs when using a single
// raster thread doesn't provide any benefit. This might change
// in the future but we avoid it for now to reduce the cost of
// Picture::Create.
- bool gather_pixel_refs = num_raster_threads > 1;
+ bool gather_pixel_refs = RasterWorkerPool::GetNumRasterThreads() > 1;
{
base::TimeDelta best_duration = base::TimeDelta::Max();
@@ -361,7 +360,6 @@ bool PicturePile::UpdateAndExpandInvalidation(
painter,
tile_grid_info_,
gather_pixel_refs,
- num_raster_threads,
recording_mode);
// Note the '&&' with previous is-suitable state.
// This means that once a picture-pile becomes unsuitable for gpu
diff --git a/cc/resources/picture_pile_base.cc b/cc/resources/picture_pile_base.cc
index 7f5e1a2..4f84bd9 100644
--- a/cc/resources/picture_pile_base.cc
+++ b/cc/resources/picture_pile_base.cc
@@ -72,28 +72,6 @@ PicturePileBase::PicturePileBase(const PicturePileBase* other)
has_text_(other->has_text_) {
}
-PicturePileBase::PicturePileBase(const PicturePileBase* other,
- unsigned thread_index)
- : tiling_(other->tiling_),
- recorded_viewport_(other->recorded_viewport_),
- min_contents_scale_(other->min_contents_scale_),
- tile_grid_info_(other->tile_grid_info_),
- background_color_(other->background_color_),
- slow_down_raster_scale_factor_for_debug_(
- other->slow_down_raster_scale_factor_for_debug_),
- contents_opaque_(other->contents_opaque_),
- contents_fill_bounds_completely_(other->contents_fill_bounds_completely_),
- show_debug_picture_borders_(other->show_debug_picture_borders_),
- clear_canvas_with_debug_color_(other->clear_canvas_with_debug_color_),
- has_any_recordings_(other->has_any_recordings_),
- has_text_(other->has_text_) {
- for (PictureMap::const_iterator it = other->picture_map_.begin();
- it != other->picture_map_.end();
- ++it) {
- picture_map_[it->first] = it->second.CloneForThread(thread_index);
- }
-}
-
PicturePileBase::~PicturePileBase() {
}
@@ -191,12 +169,12 @@ bool PicturePileBase::CanRasterSlowTileCheck(
return true;
}
-gfx::Rect PicturePileBase::PaddedRect(const PictureMapKey& key) {
+gfx::Rect PicturePileBase::PaddedRect(const PictureMapKey& key) const {
gfx::Rect tile = tiling_.TileBounds(key.first, key.second);
return PadRect(tile);
}
-gfx::Rect PicturePileBase::PadRect(const gfx::Rect& rect) {
+gfx::Rect PicturePileBase::PadRect(const gfx::Rect& rect) const {
gfx::Rect padded_rect = rect;
padded_rect.Inset(
-buffer_pixels(), -buffer_pixels(), -buffer_pixels(), -buffer_pixels());
@@ -205,7 +183,7 @@ gfx::Rect PicturePileBase::PadRect(const gfx::Rect& rect) {
void PicturePileBase::AsValueInto(base::debug::TracedValue* pictures) const {
gfx::Rect tiling_rect(tiling_.tiling_size());
- std::set<void*> appended_pictures;
+ std::set<const void*> appended_pictures;
bool include_borders = true;
for (TilingData::Iterator tile_iter(&tiling_, tiling_rect, include_borders);
tile_iter;
@@ -214,7 +192,7 @@ void PicturePileBase::AsValueInto(base::debug::TracedValue* pictures) const {
if (map_iter == picture_map_.end())
continue;
- Picture* picture = map_iter->second.GetPicture();
+ const Picture* picture = map_iter->second.GetPicture();
if (picture && (appended_pictures.count(picture) == 0)) {
appended_pictures.insert(picture);
TracedValue::AppendIDRef(picture, pictures);
@@ -262,18 +240,10 @@ void PicturePileBase::PictureInfo::SetPicture(scoped_refptr<Picture> picture) {
picture_ = picture;
}
-Picture* PicturePileBase::PictureInfo::GetPicture() const {
+const Picture* PicturePileBase::PictureInfo::GetPicture() const {
return picture_.get();
}
-PicturePileBase::PictureInfo PicturePileBase::PictureInfo::CloneForThread(
- int thread_index) const {
- PictureInfo info = *this;
- if (picture_.get())
- info.picture_ = picture_->GetCloneForDrawingOnThread(thread_index);
- return info;
-}
-
float PicturePileBase::PictureInfo::GetInvalidationFrequency() const {
return invalidation_history_.count() /
static_cast<float>(INVALIDATION_FRAMES_TRACKED);
diff --git a/cc/resources/picture_pile_base.h b/cc/resources/picture_pile_base.h
index 317109e..3aabcfb 100644
--- a/cc/resources/picture_pile_base.h
+++ b/cc/resources/picture_pile_base.h
@@ -30,7 +30,6 @@ class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> {
public:
PicturePileBase();
explicit PicturePileBase(const PicturePileBase* other);
- PicturePileBase(const PicturePileBase* other, unsigned thread_index);
gfx::Size tiling_size() const { return tiling_.tiling_size(); }
void SetMinContentsScale(float min_contents_scale);
@@ -72,9 +71,8 @@ class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> {
bool Invalidate(int frame_number);
bool NeedsRecording(int frame_number, int distance_to_visible);
- PictureInfo CloneForThread(int thread_index) const;
void SetPicture(scoped_refptr<Picture> picture);
- Picture* GetPicture() const;
+ const Picture* GetPicture() const;
float GetInvalidationFrequencyForTesting() const {
return GetInvalidationFrequency();
@@ -85,7 +83,7 @@ class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> {
float GetInvalidationFrequency() const;
int last_frame_number_;
- scoped_refptr<Picture> picture_;
+ scoped_refptr<const Picture> picture_;
std::bitset<INVALIDATION_FRAMES_TRACKED> invalidation_history_;
};
@@ -97,8 +95,8 @@ class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> {
int buffer_pixels() const { return tiling_.border_texels(); }
void Clear();
- gfx::Rect PaddedRect(const PictureMapKey& key);
- gfx::Rect PadRect(const gfx::Rect& rect);
+ gfx::Rect PaddedRect(const PictureMapKey& key) const;
+ gfx::Rect PadRect(const gfx::Rect& rect) const;
// An internal CanRaster check that goes to the picture_map rather than
// using the recorded_viewport hint.
diff --git a/cc/resources/picture_pile_impl.cc b/cc/resources/picture_pile_impl.cc
index db824e3..f4fbdf2 100644
--- a/cc/resources/picture_pile_impl.cc
+++ b/cc/resources/picture_pile_impl.cc
@@ -9,7 +9,6 @@
#include "cc/base/region.h"
#include "cc/debug/debug_colors.h"
#include "cc/resources/picture_pile_impl.h"
-#include "cc/resources/raster_worker_pool.h"
#include "skia/ext/analysis_canvas.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
@@ -20,18 +19,6 @@
namespace cc {
-PicturePileImpl::ClonesForDrawing::ClonesForDrawing(
- const PicturePileImpl* pile, int num_threads) {
- for (int i = 0; i < num_threads; i++) {
- scoped_refptr<PicturePileImpl> clone =
- PicturePileImpl::CreateCloneForDrawing(pile, i);
- clones_.push_back(clone);
- }
-}
-
-PicturePileImpl::ClonesForDrawing::~ClonesForDrawing() {
-}
-
scoped_refptr<PicturePileImpl> PicturePileImpl::Create() {
return make_scoped_refptr(new PicturePileImpl);
}
@@ -41,36 +28,16 @@ scoped_refptr<PicturePileImpl> PicturePileImpl::CreateFromOther(
return make_scoped_refptr(new PicturePileImpl(other));
}
-scoped_refptr<PicturePileImpl> PicturePileImpl::CreateCloneForDrawing(
- const PicturePileImpl* other, unsigned thread_index) {
- return make_scoped_refptr(new PicturePileImpl(other, thread_index));
-}
-
-PicturePileImpl::PicturePileImpl()
- : clones_for_drawing_(ClonesForDrawing(this, 0)) {
+PicturePileImpl::PicturePileImpl() {
}
PicturePileImpl::PicturePileImpl(const PicturePileBase* other)
- : PicturePileBase(other),
- clones_for_drawing_(ClonesForDrawing(
- this, RasterWorkerPool::GetNumRasterThreads())) {
-}
-
-PicturePileImpl::PicturePileImpl(
- const PicturePileImpl* other, unsigned thread_index)
- : PicturePileBase(other, thread_index),
- clones_for_drawing_(ClonesForDrawing(this, 0)) {
+ : PicturePileBase(other) {
}
PicturePileImpl::~PicturePileImpl() {
}
-PicturePileImpl* PicturePileImpl::GetCloneForDrawingOnThread(
- unsigned thread_index) const {
- CHECK_GT(clones_for_drawing_.clones_.size(), thread_index);
- return clones_for_drawing_.clones_[thread_index].get();
-}
-
void PicturePileImpl::RasterDirect(
SkCanvas* canvas,
const gfx::Rect& canvas_rect,
@@ -88,7 +55,7 @@ void PicturePileImpl::RasterForAnalysis(
skia::AnalysisCanvas* canvas,
const gfx::Rect& canvas_rect,
float contents_scale,
- RenderingStatsInstrumentation* stats_instrumentation) {
+ RenderingStatsInstrumentation* stats_instrumentation) const {
RasterCommon(
canvas, canvas, canvas_rect, contents_scale, stats_instrumentation, true);
}
@@ -97,7 +64,7 @@ void PicturePileImpl::RasterToBitmap(
SkCanvas* canvas,
const gfx::Rect& canvas_rect,
float contents_scale,
- RenderingStatsInstrumentation* rendering_stats_instrumentation) {
+ RenderingStatsInstrumentation* rendering_stats_instrumentation) const {
canvas->discard();
if (clear_canvas_with_debug_color_) {
// Any non-painted areas in the content bounds will be left in this color.
@@ -166,7 +133,7 @@ void PicturePileImpl::RasterToBitmap(
void PicturePileImpl::CoalesceRasters(const gfx::Rect& canvas_rect,
const gfx::Rect& content_rect,
float contents_scale,
- PictureRegionMap* results) {
+ PictureRegionMap* results) const {
DCHECK(results);
// Rasterize the collection of relevant picture piles.
gfx::Rect layer_rect = gfx::ScaleToEnclosingRect(
@@ -197,11 +164,11 @@ void PicturePileImpl::CoalesceRasters(const gfx::Rect& canvas_rect,
for (TilingData::Iterator tile_iter(&tiling_, layer_rect, include_borders);
tile_iter;
++tile_iter) {
- PictureMap::iterator map_iter = picture_map_.find(tile_iter.index());
+ PictureMap::const_iterator map_iter = picture_map_.find(tile_iter.index());
if (map_iter == picture_map_.end())
continue;
- PictureInfo& info = map_iter->second;
- Picture* picture = info.GetPicture();
+ const PictureInfo& info = map_iter->second;
+ const Picture* picture = info.GetPicture();
if (!picture)
continue;
@@ -264,7 +231,7 @@ void PicturePileImpl::RasterCommon(
const gfx::Rect& canvas_rect,
float contents_scale,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
- bool is_analysis) {
+ bool is_analysis) const {
DCHECK(contents_scale >= min_contents_scale_);
canvas->translate(-canvas_rect.x(), -canvas_rect.y());
@@ -288,7 +255,7 @@ void PicturePileImpl::RasterCommon(
for (PictureRegionMap::iterator it = picture_region_map.begin();
it != picture_region_map.end();
++it) {
- Picture* picture = it->first;
+ const Picture* picture = it->first;
Region negated_clip_region = it->second;
#ifndef NDEBUG
@@ -356,10 +323,9 @@ skia::RefPtr<SkPicture> PicturePileImpl::GetFlattenedPicture() {
return picture;
}
-void PicturePileImpl::AnalyzeInRect(
- const gfx::Rect& content_rect,
- float contents_scale,
- PicturePileImpl::Analysis* analysis) {
+void PicturePileImpl::AnalyzeInRect(const gfx::Rect& content_rect,
+ float contents_scale,
+ PicturePileImpl::Analysis* analysis) const {
AnalyzeInRect(content_rect, contents_scale, analysis, NULL);
}
@@ -367,7 +333,7 @@ void PicturePileImpl::AnalyzeInRect(
const gfx::Rect& content_rect,
float contents_scale,
PicturePileImpl::Analysis* analysis,
- RenderingStatsInstrumentation* stats_instrumentation) {
+ RenderingStatsInstrumentation* stats_instrumentation) const {
DCHECK(analysis);
TRACE_EVENT0("cc", "PicturePileImpl::AnalyzeInRect");
@@ -444,11 +410,11 @@ void PicturePileImpl::PixelRefIterator::AdvanceToTilePictureWithPixelRefs() {
}
void PicturePileImpl::DidBeginTracing() {
- std::set<void*> processed_pictures;
+ std::set<const void*> processed_pictures;
for (PictureMap::iterator it = picture_map_.begin();
it != picture_map_.end();
++it) {
- Picture* picture = it->second.GetPicture();
+ const Picture* picture = it->second.GetPicture();
if (picture && (processed_pictures.count(picture) == 0)) {
picture->EmitTraceSnapshot();
processed_pictures.insert(picture);
diff --git a/cc/resources/picture_pile_impl.h b/cc/resources/picture_pile_impl.h
index ba19381..75ee536 100644
--- a/cc/resources/picture_pile_impl.h
+++ b/cc/resources/picture_pile_impl.h
@@ -26,17 +26,12 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase {
static scoped_refptr<PicturePileImpl> CreateFromOther(
const PicturePileBase* other);
- // Get paint-safe version of this picture for a specific thread.
- PicturePileImpl* GetCloneForDrawingOnThread(unsigned thread_index) const;
-
- // Raster a subrect of this PicturePileImpl into the given canvas.
- // It's only safe to call paint on a cloned version. It is assumed
- // that contents_scale has already been applied to this canvas.
+ // Raster a subrect of this PicturePileImpl into the given canvas. It is
+ // assumed that contents_scale has already been applied to this canvas.
// Writes the total number of pixels rasterized and the time spent
- // rasterizing to the stats if the respective pointer is not
- // NULL. When slow-down-raster-scale-factor is set to a value
- // greater than 1, the reported rasterize time is the minimum
- // measured value over all runs.
+ // rasterizing to the stats if the respective pointer is not NULL. When
+ // slow-down-raster-scale-factor is set to a value greater than 1, the
+ // reported rasterize time is the minimum measured value over all runs.
void RasterDirect(
SkCanvas* canvas,
const gfx::Rect& canvas_rect,
@@ -51,7 +46,7 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase {
SkCanvas* canvas,
const gfx::Rect& canvas_rect,
float contents_scale,
- RenderingStatsInstrumentation* stats_instrumentation);
+ RenderingStatsInstrumentation* stats_instrumentation) const;
// Called when analyzing a tile. We can use AnalysisCanvas as
// SkDrawPictureCallback, which allows us to early out from analysis.
@@ -59,7 +54,7 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase {
skia::AnalysisCanvas* canvas,
const gfx::Rect& canvas_rect,
float contents_scale,
- RenderingStatsInstrumentation* stats_instrumentation);
+ RenderingStatsInstrumentation* stats_instrumentation) const;
skia::RefPtr<SkPicture> GetFlattenedPicture();
@@ -73,12 +68,13 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase {
void AnalyzeInRect(const gfx::Rect& content_rect,
float contents_scale,
- Analysis* analysis);
+ Analysis* analysis) const;
- void AnalyzeInRect(const gfx::Rect& content_rect,
- float contents_scale,
- Analysis* analysis,
- RenderingStatsInstrumentation* stats_instrumentation);
+ void AnalyzeInRect(
+ const gfx::Rect& content_rect,
+ float contents_scale,
+ Analysis* analysis,
+ RenderingStatsInstrumentation* stats_instrumentation) const;
class CC_EXPORT PixelRefIterator {
public:
@@ -113,26 +109,12 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase {
virtual ~PicturePileImpl();
private:
- class ClonesForDrawing {
- public:
- ClonesForDrawing(const PicturePileImpl* pile, int num_threads);
- ~ClonesForDrawing();
+ typedef std::map<const Picture*, Region> PictureRegionMap;
- typedef std::vector<scoped_refptr<PicturePileImpl> > PicturePileVector;
- PicturePileVector clones_;
- };
-
- static scoped_refptr<PicturePileImpl> CreateCloneForDrawing(
- const PicturePileImpl* other, unsigned thread_index);
-
- PicturePileImpl(const PicturePileImpl* other, unsigned thread_index);
-
- private:
- typedef std::map<Picture*, Region> PictureRegionMap;
void CoalesceRasters(const gfx::Rect& canvas_rect,
const gfx::Rect& content_rect,
float contents_scale,
- PictureRegionMap* result);
+ PictureRegionMap* result) const;
void RasterCommon(
SkCanvas* canvas,
@@ -140,13 +122,7 @@ class CC_EXPORT PicturePileImpl : public PicturePileBase {
const gfx::Rect& canvas_rect,
float contents_scale,
RenderingStatsInstrumentation* rendering_stats_instrumentation,
- bool is_analysis);
-
- // Once instantiated, |clones_for_drawing_| can't be modified. This
- // guarantees thread-safe access during the life time of a PicturePileImpl
- // instance. This member variable must be last so that other member
- // variables have already been initialized and can be clonable.
- const ClonesForDrawing clones_for_drawing_;
+ bool is_analysis) const;
DISALLOW_COPY_AND_ASSIGN(PicturePileImpl);
};
diff --git a/cc/resources/picture_pile_unittest.cc b/cc/resources/picture_pile_unittest.cc
index 31e0a2a..ddf45de 100644
--- a/cc/resources/picture_pile_unittest.cc
+++ b/cc/resources/picture_pile_unittest.cc
@@ -128,7 +128,7 @@ TEST_F(PicturePileTest, LargeInvalidateInflated) {
int expected_inflation = pile_->buffer_pixels();
- Picture* base_picture = picture_info.GetPicture();
+ const Picture* base_picture = picture_info.GetPicture();
gfx::Rect base_picture_rect(pile_->tiling_size());
base_picture_rect.Inset(-expected_inflation, -expected_inflation);
EXPECT_EQ(base_picture_rect.ToString(),
diff --git a/cc/resources/picture_unittest.cc b/cc/resources/picture_unittest.cc
index 1367c5f..2c7dd4c 100644
--- a/cc/resources/picture_unittest.cc
+++ b/cc/resources/picture_unittest.cc
@@ -57,7 +57,6 @@ TEST(PictureTest, AsBase64String) {
&content_layer_client,
tile_grid_info,
false,
- 0,
kRecordingModes[i]);
scoped_ptr<base::Value> serialized_one_rect(one_rect_picture->AsValue());
@@ -76,8 +75,7 @@ TEST(PictureTest, AsBase64String) {
one_rect_picture_check->LayerRect());
EXPECT_EQ(one_rect_picture->OpaqueRect(),
one_rect_picture_check->OpaqueRect());
- EXPECT_TRUE(memcmp(one_rect_buffer, one_rect_buffer_check, 4 * 100 * 100) ==
- 0);
+ EXPECT_EQ(0, memcmp(one_rect_buffer, one_rect_buffer_check, 4 * 100 * 100));
}
// Two rect picture.
@@ -89,7 +87,6 @@ TEST(PictureTest, AsBase64String) {
&content_layer_client,
tile_grid_info,
false,
- 0,
Picture::RECORD_NORMALLY);
scoped_ptr<base::Value> serialized_two_rect(two_rect_picture->AsValue());
@@ -109,8 +106,7 @@ TEST(PictureTest, AsBase64String) {
two_rect_picture_check->LayerRect());
EXPECT_EQ(two_rect_picture->OpaqueRect(),
two_rect_picture_check->OpaqueRect());
- EXPECT_TRUE(memcmp(two_rect_buffer, two_rect_buffer_check, 4 * 100 * 100) ==
- 0);
+ EXPECT_EQ(0, memcmp(two_rect_buffer, two_rect_buffer_check, 4 * 100 * 100));
}
}
@@ -152,7 +148,6 @@ TEST(PictureTest, PixelRefIterator) {
&content_layer_client,
tile_grid_info,
true,
- 0,
Picture::RECORD_NORMALLY);
// Default iterator does not have any pixel refs
@@ -253,7 +248,6 @@ TEST(PictureTest, PixelRefIteratorNonZeroLayer) {
&content_layer_client,
tile_grid_info,
true,
- 0,
Picture::RECORD_NORMALLY);
// Default iterator does not have any pixel refs
@@ -377,7 +371,6 @@ TEST(PictureTest, PixelRefIteratorOnePixelQuery) {
&content_layer_client,
tile_grid_info,
true,
- 0,
Picture::RECORD_NORMALLY);
for (int y = 0; y < 4; ++y) {
@@ -427,7 +420,6 @@ TEST(PictureTest, CreateFromSkpValue) {
&content_layer_client,
tile_grid_info,
false,
- 0,
Picture::RECORD_NORMALLY);
scoped_ptr<base::Value> serialized_one_rect(
one_rect_picture->AsValue());
@@ -467,7 +459,6 @@ TEST(PictureTest, RecordingModes) {
&content_layer_client,
tile_grid_info,
false,
- 0,
Picture::RECORD_NORMALLY);
EXPECT_TRUE(content_layer_client.last_canvas() != NULL);
EXPECT_EQ(ContentLayerClient::GRAPHICS_CONTEXT_ENABLED,
@@ -478,7 +469,6 @@ TEST(PictureTest, RecordingModes) {
&content_layer_client,
tile_grid_info,
false,
- 0,
Picture::RECORD_WITH_SK_NULL_CANVAS);
EXPECT_TRUE(content_layer_client.last_canvas() != NULL);
EXPECT_EQ(ContentLayerClient::GRAPHICS_CONTEXT_ENABLED,
@@ -489,7 +479,6 @@ TEST(PictureTest, RecordingModes) {
&content_layer_client,
tile_grid_info,
false,
- 0,
Picture::RECORD_WITH_PAINTING_DISABLED);
EXPECT_TRUE(content_layer_client.last_canvas() != NULL);
EXPECT_EQ(ContentLayerClient::GRAPHICS_CONTEXT_DISABLED,
@@ -500,7 +489,6 @@ TEST(PictureTest, RecordingModes) {
&content_layer_client,
tile_grid_info,
false,
- 0,
Picture::RECORD_WITH_SKRECORD);
EXPECT_TRUE(content_layer_client.last_canvas() != NULL);
EXPECT_TRUE(picture);
diff --git a/cc/resources/raster_worker_pool.cc b/cc/resources/raster_worker_pool.cc
index d01bdc8..255d5af 100644
--- a/cc/resources/raster_worker_pool.cc
+++ b/cc/resources/raster_worker_pool.cc
@@ -6,12 +6,10 @@
#include <algorithm>
-#include "base/atomic_sequence_num.h"
#include "base/debug/trace_event_synthetic_delay.h"
#include "base/lazy_instance.h"
#include "base/strings/stringprintf.h"
#include "base/threading/simple_thread.h"
-#include "base/threading/thread_local.h"
#include "cc/base/scoped_ptr_deque.h"
namespace cc {
@@ -50,34 +48,13 @@ class RasterTaskGraphRunner : public TaskGraphRunner,
virtual ~RasterTaskGraphRunner() { NOTREACHED(); }
- size_t GetPictureCloneIndexForCurrentThread() {
- // Use index 0 if called on non-raster thread.
- ThreadLocalState* thread_local_state = current_tls_.Get();
- return thread_local_state ? current_tls_.Get()->picture_clone_index : 0;
- }
-
private:
- struct ThreadLocalState {
- explicit ThreadLocalState(size_t picture_clone_index)
- : picture_clone_index(picture_clone_index) {}
-
- size_t picture_clone_index;
- };
-
// Overridden from base::DelegateSimpleThread::Delegate:
virtual void Run() OVERRIDE {
- // Use picture clone index 0..num_threads.
- int picture_clone_index = picture_clone_index_sequence_.GetNext();
- DCHECK_LE(0, picture_clone_index);
- DCHECK_GT(RasterWorkerPool::GetNumRasterThreads(), picture_clone_index);
- current_tls_.Set(new ThreadLocalState(picture_clone_index));
-
TaskGraphRunner::Run();
}
ScopedPtrDeque<base::DelegateSimpleThread> workers_;
- base::AtomicSequenceNumber picture_clone_index_sequence_;
- base::ThreadLocalPointer<ThreadLocalState> current_tls_;
};
base::LazyInstance<RasterTaskGraphRunner>::Leaky g_task_graph_runner =
@@ -198,11 +175,6 @@ TaskGraphRunner* RasterWorkerPool::GetTaskGraphRunner() {
}
// static
-size_t RasterWorkerPool::GetPictureCloneIndexForCurrentThread() {
- return g_task_graph_runner.Pointer()->GetPictureCloneIndexForCurrentThread();
-}
-
-// static
scoped_refptr<RasterizerTask> RasterWorkerPool::CreateRasterFinishedTask(
base::SequencedTaskRunner* task_runner,
const base::Closure& on_raster_finished_callback) {
diff --git a/cc/resources/raster_worker_pool.h b/cc/resources/raster_worker_pool.h
index 2c543a0..5a9fd25 100644
--- a/cc/resources/raster_worker_pool.h
+++ b/cc/resources/raster_worker_pool.h
@@ -35,10 +35,6 @@ class CC_EXPORT RasterWorkerPool {
// Returns a pointer to the global TaskGraphRunner instance.
static TaskGraphRunner* GetTaskGraphRunner();
- // Returns a unique clone index for the current thread. Guaranteed to be a
- // value between 0 and GetNumRasterThreads() - 1.
- static size_t GetPictureCloneIndexForCurrentThread();
-
// Utility function that can be used to create a "raster finished" task that
// posts |callback| to |task_runner| when run.
static scoped_refptr<RasterizerTask> CreateRasterFinishedTask(
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index b264b47..3e35dbe 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -17,7 +17,7 @@
#include "cc/debug/frame_viewer_instrumentation.h"
#include "cc/debug/traced_value.h"
#include "cc/layers/picture_layer_impl.h"
-#include "cc/resources/raster_worker_pool.h"
+#include "cc/resources/rasterizer.h"
#include "cc/resources/tile.h"
#include "skia/ext/paint_simplifier.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -66,10 +66,16 @@ class RasterTaskImpl : public RasterTask {
TRACE_EVENT0("cc", "RasterizerTaskImpl::RunOnWorkerThread");
DCHECK(picture_pile_);
- if (canvas_) {
- AnalyzeAndRaster(picture_pile_->GetCloneForDrawingOnThread(
- RasterWorkerPool::GetPictureCloneIndexForCurrentThread()));
+ if (!canvas_)
+ return;
+
+ if (analyze_picture_) {
+ Analyze(picture_pile_.get());
+ if (analysis_.is_solid_color)
+ return;
}
+
+ Raster(picture_pile_.get());
}
// Overridden from RasterizerTask:
@@ -90,20 +96,7 @@ class RasterTaskImpl : public RasterTask {
virtual ~RasterTaskImpl() { DCHECK(!canvas_); }
private:
- void AnalyzeAndRaster(PicturePileImpl* picture_pile) {
- DCHECK(picture_pile);
- DCHECK(canvas_);
-
- if (analyze_picture_) {
- Analyze(picture_pile);
- if (analysis_.is_solid_color)
- return;
- }
-
- Raster(picture_pile);
- }
-
- void Analyze(PicturePileImpl* picture_pile) {
+ void Analyze(const PicturePileImpl* picture_pile) {
frame_viewer_instrumentation::ScopedAnalyzeTask analyze_task(
tile_id_, tile_resolution_, source_frame_number_, layer_id_);
@@ -120,7 +113,7 @@ class RasterTaskImpl : public RasterTask {
analysis_.is_solid_color &= kUseColorEstimator;
}
- void Raster(PicturePileImpl* picture_pile) {
+ void Raster(const PicturePileImpl* picture_pile) {
frame_viewer_instrumentation::ScopedRasterTask raster_task(
tile_id_,
tile_resolution_,
diff --git a/cc/surfaces/display.h b/cc/surfaces/display.h
index 8af18b57..a5501cb 100644
--- a/cc/surfaces/display.h
+++ b/cc/surfaces/display.h
@@ -71,7 +71,6 @@ class CC_SURFACES_EXPORT Display : public OutputSurfaceClient,
// RendererClient implementation.
virtual void SetFullRootLayerDamage() OVERRIDE {}
- virtual void RunOnDemandRasterTask(Task* on_demand_raster_task) OVERRIDE {}
// SurfaceDamageObserver implementation.
virtual void OnSurfaceDamaged(SurfaceId surface) OVERRIDE;
diff --git a/cc/test/fake_picture_pile_impl.cc b/cc/test/fake_picture_pile_impl.cc
index 630bb75..3598ca7 100644
--- a/cc/test/fake_picture_pile_impl.cc
+++ b/cc/test/fake_picture_pile_impl.cc
@@ -84,7 +84,7 @@ void FakePicturePileImpl::AddRecordingAt(int x, int y) {
bounds.Inset(-buffer_pixels(), -buffer_pixels());
scoped_refptr<Picture> picture(Picture::Create(
- bounds, &client_, tile_grid_info_, true, 0, Picture::RECORD_NORMALLY));
+ bounds, &client_, tile_grid_info_, true, Picture::RECORD_NORMALLY));
picture_map_[std::pair<int, int>(x, y)].SetPicture(picture);
EXPECT_TRUE(HasRecordingAt(x, y));
diff --git a/cc/test/fake_renderer_client.h b/cc/test/fake_renderer_client.h
index 41ff5bc..9854b01 100644
--- a/cc/test/fake_renderer_client.h
+++ b/cc/test/fake_renderer_client.h
@@ -15,7 +15,6 @@ class FakeRendererClient : public RendererClient {
// RendererClient methods.
virtual void SetFullRootLayerDamage() OVERRIDE;
- virtual void RunOnDemandRasterTask(Task* on_demand_raster_task) OVERRIDE {}
// Methods added for test.
int set_full_root_layer_damage_count() const {
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index a240147..d7d3c15 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -149,30 +149,6 @@ void PixelTest::EnableExternalStencilTest() {
->set_has_external_stencil_test(true);
}
-void PixelTest::RunOnDemandRasterTask(Task* on_demand_raster_task) {
- TaskGraphRunner task_graph_runner;
- NamespaceToken on_demand_task_namespace =
- task_graph_runner.GetNamespaceToken();
-
- // Construct a task graph that contains this single raster task.
- TaskGraph graph;
- graph.nodes.push_back(
- TaskGraph::Node(on_demand_raster_task,
- RasterWorkerPool::kOnDemandRasterTaskPriority,
- 0u));
-
- // Schedule task and wait for task graph runner to finish running it.
- task_graph_runner.ScheduleTasks(on_demand_task_namespace, &graph);
- task_graph_runner.RunUntilIdle();
-
- // Collect task now that it has finished running.
- Task::Vector completed_tasks;
- task_graph_runner.CollectCompletedTasks(on_demand_task_namespace,
- &completed_tasks);
- DCHECK_EQ(1u, completed_tasks.size());
- DCHECK_EQ(completed_tasks[0], on_demand_raster_task);
-}
-
void PixelTest::SetUpSoftwareRenderer() {
scoped_ptr<SoftwareOutputDevice> device(new PixelTestSoftwareOutputDevice());
output_surface_.reset(new PixelTestOutputSurface(device.Pass()));
diff --git a/cc/test/pixel_test.h b/cc/test/pixel_test.h
index 46c9bf7..bb4c13d 100644
--- a/cc/test/pixel_test.h
+++ b/cc/test/pixel_test.h
@@ -62,7 +62,6 @@ class PixelTest : public testing::Test, RendererClient {
// RendererClient implementation.
virtual void SetFullRootLayerDamage() OVERRIDE {}
- virtual void RunOnDemandRasterTask(Task* on_demand_raster_task) OVERRIDE;
private:
void ReadbackResult(base::Closure quit_run_loop,
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index bb33de2..9a4971e 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -222,7 +222,6 @@ LayerTreeHostImpl::LayerTreeHostImpl(
: client_(client),
proxy_(proxy),
use_gpu_rasterization_(false),
- on_demand_task_graph_runner_(NULL),
input_handler_client_(NULL),
did_lock_scrolling_layer_(false),
should_bubble_scrolls_(false),
@@ -1961,7 +1960,6 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
GpuRasterWorkerPool::Create(proxy_->ImplThreadTaskRunner(),
context_provider,
resource_provider_.get());
- on_demand_task_graph_runner_ = &synchronous_task_graph_runner_;
} else if (UseOneCopyTextureUpload() && context_provider) {
// We need to create a staging resource pool when using copy rasterizer.
staging_resource_pool_ =
@@ -1979,7 +1977,6 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
context_provider,
resource_provider_.get(),
staging_resource_pool_.get());
- on_demand_task_graph_runner_ = RasterWorkerPool::GetTaskGraphRunner();
} else if (!UseZeroCopyTextureUpload() && context_provider) {
resource_pool_ = ResourcePool::Create(
resource_provider_.get(),
@@ -1992,7 +1989,6 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
context_provider,
resource_provider_.get(),
transfer_buffer_memory_limit_);
- on_demand_task_graph_runner_ = RasterWorkerPool::GetTaskGraphRunner();
} else {
resource_pool_ =
ResourcePool::Create(resource_provider_.get(),
@@ -2003,7 +1999,6 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
ImageRasterWorkerPool::Create(proxy_->ImplThreadTaskRunner(),
RasterWorkerPool::GetTaskGraphRunner(),
resource_provider_.get());
- on_demand_task_graph_runner_ = RasterWorkerPool::GetTaskGraphRunner();
}
tile_manager_ =
@@ -2015,7 +2010,6 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
need_to_update_visible_tiles_before_draw_ = false;
- on_demand_task_namespace_ = on_demand_task_graph_runner_->GetNamespaceToken();
}
void LayerTreeHostImpl::DestroyTileManager() {
@@ -2938,34 +2932,6 @@ void LayerTreeHostImpl::SetFullRootLayerDamage() {
SetViewportDamage(gfx::Rect(DrawViewportSize()));
}
-void LayerTreeHostImpl::RunOnDemandRasterTask(Task* on_demand_raster_task) {
- DCHECK(on_demand_task_graph_runner_);
-
- // Construct a task graph that contains this single raster task.
- TaskGraph graph;
- graph.nodes.push_back(
- TaskGraph::Node(on_demand_raster_task,
- RasterWorkerPool::kOnDemandRasterTaskPriority,
- 0u));
-
- // Schedule task and wait for task graph runner to finish running it.
- on_demand_task_graph_runner_->ScheduleTasks(on_demand_task_namespace_,
- &graph);
-
- if (on_demand_task_graph_runner_ == &synchronous_task_graph_runner_)
- on_demand_task_graph_runner_->RunUntilIdle();
-
- on_demand_task_graph_runner_->WaitForTasksToFinishRunning(
- on_demand_task_namespace_);
-
- // Collect task now that it has finished running.
- Task::Vector completed_tasks;
- on_demand_task_graph_runner_->CollectCompletedTasks(on_demand_task_namespace_,
- &completed_tasks);
- DCHECK_EQ(1u, completed_tasks.size());
- DCHECK_EQ(completed_tasks[0], on_demand_raster_task);
-}
-
void LayerTreeHostImpl::ScrollViewportBy(gfx::Vector2dF scroll_delta) {
DCHECK(InnerViewportScrollLayer());
LayerImpl* scroll_layer = OuterViewportScrollLayer()
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index f0cf723..f1145c1 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -229,7 +229,6 @@ class CC_EXPORT LayerTreeHostImpl
// RendererClient implementation.
virtual void SetFullRootLayerDamage() OVERRIDE;
- virtual void RunOnDemandRasterTask(Task* on_demand_raster_task) OVERRIDE;
// TileManagerClient implementation.
virtual const std::vector<PictureLayerImpl*>& GetPictureLayers()
@@ -596,10 +595,6 @@ class CC_EXPORT LayerTreeHostImpl
scoped_ptr<ResourcePool> staging_resource_pool_;
scoped_ptr<Renderer> renderer_;
- TaskGraphRunner synchronous_task_graph_runner_;
- TaskGraphRunner* on_demand_task_graph_runner_;
- NamespaceToken on_demand_task_namespace_;
-
GlobalStateThatImpactsTilePriority global_tile_state_;
// Tree currently being drawn.