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

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: use non-solid color for ActivateAndDrawWhenOOM test. Created 4 years, 11 months 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
Index: cc/tiles/tile_manager.cc
diff --git a/cc/tiles/tile_manager.cc b/cc/tiles/tile_manager.cc
index 400fff20646bf77374fab31801f7181d207551f6..21df67df1dde7ca912887712eb517a240ffa9be5 100644
--- a/cc/tiles/tile_manager.cc
+++ b/cc/tiles/tile_manager.cc
@@ -55,10 +55,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),
@@ -74,7 +71,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:
@@ -85,12 +81,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());
}
@@ -102,25 +92,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_);
@@ -136,7 +114,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_;
@@ -149,9 +126,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);
@@ -593,6 +568,19 @@ void TileManager::AssignGpuMemoryToTiles(
break;
}
+ if (tile->use_picture_analysis() && kUseColorEstimator) {
+ // 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(
ericrk 2016/01/07 18:18:10 There's a comment in the bug that we might be spen
sohanjg 2016/01/08 11:47:56 Acknowledged.
+ tile->content_rect(), tile->contents_scale(), &color);
+ if (is_solid_color) {
+ tile->draw_info().set_solid_color(color);
vmpstr 2016/01/07 22:36:02 nit: call tile->draw_info().set_was_ever_ready_to_
sohanjg 2016/01/08 11:47:56 Done.
+ 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) {
@@ -826,7 +814,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));
@@ -835,7 +822,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());
@@ -854,32 +840,19 @@ void TileManager::OnRasterTaskCompleted(
return;
}
- UpdateTileDrawInfo(tile, resource, analysis);
+ UpdateTileDrawInfo(tile, resource);
vmpstr 2016/01/07 22:36:02 nit: since a lot of the logic of UpdateTileDrawInf
sohanjg 2016/01/08 11:47:56 Done.
}
-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();

Powered by Google App Engine
This is Rietveld 408576698