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

Unified Diff: cc/tiles/tile_manager.cc

Issue 1531013004: cc: Do solid color analysis before scheduling tiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments updated. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/tile_manager.cc
diff --git a/cc/tiles/tile_manager.cc b/cc/tiles/tile_manager.cc
index 9804da00fb6b93eeb4875904a5890d7bce320bde..9238a7a207c0145f6cd6f837a3b10671f4bcb3e0 100644
--- a/cc/tiles/tile_manager.cc
+++ b/cc/tiles/tile_manager.cc
@@ -51,10 +51,7 @@ class RasterTaskImpl : public RasterTask {
uint64_t previous_content_id,
uint64_t resource_content_id,
int source_frame_number,
- bool analyze_picture,
- const base::Callback<
- void(const DisplayListRasterSource::SolidColorAnalysis&,
- bool)>& reply,
+ const base::Callback<void(bool)>& reply,
ImageDecodeTask::Vector* dependencies)
: RasterTask(dependencies),
resource_(resource),
@@ -70,7 +67,6 @@ class RasterTaskImpl : public RasterTask {
previous_content_id_(previous_content_id),
resource_content_id_(resource_content_id),
source_frame_number_(source_frame_number),
- analyze_picture_(analyze_picture),
reply_(reply) {}
// Overridden from Task:
@@ -81,12 +77,6 @@ class RasterTaskImpl : public RasterTask {
DCHECK(raster_source_.get());
DCHECK(raster_buffer_);
- if (analyze_picture_) {
- Analyze(raster_source_.get());
- if (analysis_.is_solid_color)
- return;
- }
-
Raster(raster_source_.get());
}
@@ -98,25 +88,13 @@ class RasterTaskImpl : public RasterTask {
}
void CompleteOnOriginThread(TileTaskClient* client) override {
client->ReleaseBufferForRaster(std::move(raster_buffer_));
- reply_.Run(analysis_, !HasFinishedRunning());
+ reply_.Run(!HasFinishedRunning());
}
protected:
~RasterTaskImpl() override { DCHECK(!raster_buffer_); }
private:
- void Analyze(const DisplayListRasterSource* raster_source) {
- frame_viewer_instrumentation::ScopedAnalyzeTask analyze_task(
- tile_, tile_resolution_, source_frame_number_, layer_id_);
-
- DCHECK(raster_source);
-
- raster_source->PerformSolidColorAnalysis(content_rect_, contents_scale_,
- &analysis_);
- // Clear the flag if we're not using the estimator.
- analysis_.is_solid_color &= kUseColorEstimator;
- }
-
void Raster(const DisplayListRasterSource* raster_source) {
frame_viewer_instrumentation::ScopedRasterTask raster_task(
tile_, tile_resolution_, source_frame_number_, layer_id_);
@@ -132,7 +110,6 @@ class RasterTaskImpl : public RasterTask {
}
const Resource* resource_;
- DisplayListRasterSource::SolidColorAnalysis analysis_;
scoped_refptr<DisplayListRasterSource> raster_source_;
gfx::Rect content_rect_;
gfx::Rect invalid_content_rect_;
@@ -145,9 +122,7 @@ class RasterTaskImpl : public RasterTask {
uint64_t previous_content_id_;
uint64_t resource_content_id_;
int source_frame_number_;
- bool analyze_picture_;
- const base::Callback<void(const DisplayListRasterSource::SolidColorAnalysis&,
- bool)> reply_;
+ const base::Callback<void(bool)> reply_;
scoped_ptr<RasterBuffer> raster_buffer_;
DISALLOW_COPY_AND_ASSIGN(RasterTaskImpl);
@@ -586,6 +561,19 @@ void TileManager::AssignGpuMemoryToTiles(
break;
}
+ if (tile->use_picture_analysis()) {
vmpstr 2015/12/30 20:42:38 && kUseColorEstimator
sohanjg 2016/01/06 11:50:27 Done.
+ // We analyze for solid color here, to decide to continue
+ // or drop the tile for scheduling and raster.
+ SkColor color = SK_ColorTRANSPARENT;
+ bool is_solid_color =
+ prioritized_tile.raster_source()->PerformSolidColorAnalysis(
+ tile->content_rect(), tile->contents_scale(), &color);
+ if (is_solid_color) {
+ tile->draw_info().set_solid_color(color);
+ continue;
+ }
+ }
+
// We won't be able to schedule this tile, so break out early.
if (tiles_that_need_to_be_rasterized->size() >=
scheduled_raster_task_limit) {
@@ -819,7 +807,6 @@ scoped_refptr<RasterTask> TileManager::CreateRasterTask(
prioritized_tile.priority().resolution, tile->layer_id(),
prepare_tiles_count_, static_cast<const void*>(tile), tile->id(),
tile->invalidated_id(), resource_content_id, tile->source_frame_number(),
- tile->use_picture_analysis(),
base::Bind(&TileManager::OnRasterTaskCompleted, base::Unretained(this),
tile->id(), resource),
&decode_tasks));
@@ -828,7 +815,6 @@ scoped_refptr<RasterTask> TileManager::CreateRasterTask(
void TileManager::OnRasterTaskCompleted(
Tile::Id tile_id,
Resource* resource,
- const DisplayListRasterSource::SolidColorAnalysis& analysis,
bool was_canceled) {
DCHECK(tiles_.find(tile_id) != tiles_.end());
@@ -847,32 +833,19 @@ void TileManager::OnRasterTaskCompleted(
return;
}
- UpdateTileDrawInfo(tile, resource, analysis);
+ UpdateTileDrawInfo(tile, resource);
}
-void TileManager::UpdateTileDrawInfo(
- Tile* tile,
- Resource* resource,
- const DisplayListRasterSource::SolidColorAnalysis& analysis) {
+void TileManager::UpdateTileDrawInfo(Tile* tile, Resource* resource) {
TileDrawInfo& draw_info = tile->draw_info();
++flush_stats_.completed_count;
- if (analysis.is_solid_color) {
- draw_info.set_solid_color(analysis.solid_color);
- if (resource) {
- // TODO(ericrk): If more partial raster work is done in the future, it may
- // be worth returning the resource to the pool with its previous ID (not
- // currently tracked). crrev.com/1370333002/#ps40001 has a possible method
- // of achieving this.
- resource_pool_->ReleaseResource(resource, 0 /* content_id */);
- }
- } else {
- DCHECK(resource);
- draw_info.set_use_resource();
- draw_info.resource_ = resource;
- draw_info.contents_swizzled_ = DetermineResourceRequiresSwizzle(tile);
- }
+ DCHECK(resource);
+ draw_info.set_use_resource();
+ draw_info.resource_ = resource;
+ draw_info.contents_swizzled_ = DetermineResourceRequiresSwizzle(tile);
+
DCHECK(draw_info.IsReadyToDraw());
draw_info.set_was_ever_ready_to_draw();
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698