Cherry-pick: cc: Always perform analysis to detect solid color tiles.

Clean cherry-pick of chromium

BUG: 16133204

Original description:

One previous approach was to try and balance memory usage vs amount
of time we spend analyzing tiles. This patch switches it so that we
always analyze tiles in order to try and save as much memory as

This is due to the fact that there are some cases out there that
break the heuristic and use too much memory, when otherwise they
would be detected as solid.

As well, it enables analysis for gpu rasterization since it also
needs to start benefitting from these memory savings.

Change-Id: I909295b1ef94ea45b122d1758185f3f768a747b1
diff --git a/cc/layers/ b/cc/layers/
index fad8137..46739da 100644
--- a/cc/layers/
+++ b/cc/layers/
@@ -40,8 +40,6 @@
 // TileManager::BinFromTilePriority).
 const float kGpuSkewportTargetTimeInFrames = 0.0f;
-// Minimum width/height of a layer that would require analysis for tiles.
-const int kMinDimensionsForAnalysis = 256;
 }  // namespace
 namespace cc {
@@ -557,25 +555,12 @@
   if (!pile_->CanRaster(tiling->contents_scale(), content_rect))
     return scoped_refptr<Tile>();
-  int flags = 0;
-  // We analyze picture before rasterization to detect solid-color tiles.
-  // If the tile is detected as such there is no need to raster or upload.
-  // It is drawn directly as a solid-color quad saving memory, raster and upload
-  // cost. The analysis step is however expensive and may not be justified when
-  // doing gpu rasterization which runs on the compositor thread and where there
-  // is no upload.
-  // TODO(alokp): Revisit the decision to avoid analysis for gpu rasterization
-  // becuase it too can potentially benefit from memory savings.
-  if (!layer_tree_impl()->use_gpu_rasterization()) {
-    // Additionally, we do not want to do the analysis if the layer is too
-    // narrow, since more likely than not the tile would not be solid. Note that
-    // this last optimization is a heuristic that ensures that we don't spend
-    // too much time analyzing tiles on a multitude of small layers, as it is
-    // likely that these layers have some non-solid content.
-    int min_dimension = std::min(bounds().width(), bounds().height());
-    if (min_dimension >= kMinDimensionsForAnalysis)
-      flags |= Tile::USE_PICTURE_ANALYSIS;
-  }
+  // TODO(vmpstr): Revisit this. For now, enabling analysis means that we get as
+  // much savings on memory as we can. However, for some cases like ganesh or
+  // small layers, the amount of time we spend analyzing might not justify
+  // memory savings that we can get.
+  // Bugs:,
+  int flags = Tile::USE_PICTURE_ANALYSIS;
   return layer_tree_impl()->tile_manager()->CreateTile(