Cherry-pick with modification: cc: Fix CHECK failure in PictureLayerImpl::UpdateTilePriorities

Cherry-pick of Chromium

Removed the test due to conflict.

BUG: 11265055

Original description:

The should_update_tile_priorities_ in UpdateTilePriorities my fail and
here's the sequence of events:

* Context loss while layer is invisible, which clears
* CalculateContentsScale is skipped because layer is invisible
* Layer becomes visible in next commit, and active layer SyncTiling
during the commit will fail the check.

Any condition that causes CalculateContentsScale on the layer works as

Change-Id: Ia92de26d27a37c3a6af487d92e6869a495cfbd3e
diff --git a/cc/layers/ b/cc/layers/
index 22f5d7c..124871c 100644
--- a/cc/layers/
+++ b/cc/layers/
@@ -602,7 +602,8 @@
   // get updated prior to drawing or activation.  If this tree does not
   // need update draw properties, then its transforms are up to date and
   // we can create tiles for this tiling immediately.
-  if (!layer_tree_impl()->needs_update_draw_properties())
+  if (!layer_tree_impl()->needs_update_draw_properties() &&
+      should_update_tile_priorities_)