Skip to content

Commit

Permalink
android: Don't cast to SurfaceLayer
Browse files Browse the repository at this point in the history
It's not safe to assume a layer that draws in the content layer
hierarchy must be the SurfaceLayer. It could also be the touch handles.
Code doesn't need anything from SurfaceLayer anyway, so just don't cast
at all.

Change-Id: I4ea8aa9868cf24017e23820a8f303f56be1ba26e
Reviewed-on: https://chromium-review.googlesource.com/1074148
Reviewed-by: David Trainor <dtrainor@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562075}
  • Loading branch information
Bo Liu authored and Commit Bot committed May 26, 2018
1 parent c47789a commit f7acd09
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions chrome/browser/android/compositor/layer/content_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "base/lazy_instance.h"
#include "cc/layers/layer.h"
#include "cc/layers/layer_collections.h"
#include "cc/layers/surface_layer.h"
#include "cc/paint/filter_operations.h"
#include "chrome/browser/android/compositor/layer/thumbnail_layer.h"
#include "chrome/browser/android/compositor/tab_content_manager.h"
Expand Down Expand Up @@ -113,10 +112,9 @@ gfx::Size ContentLayer::ComputeSize(int id) const {
gfx::Size size;

scoped_refptr<cc::Layer> live_layer = tab_content_manager_->GetLiveLayer(id);
cc::SurfaceLayer* surface_layer =
static_cast<cc::SurfaceLayer*>(GetDrawsContentLeaf(live_layer));
if (surface_layer)
size.SetToMax(surface_layer->bounds());
cc::Layer* leaf_that_draws = GetDrawsContentLeaf(live_layer);
if (leaf_that_draws)
size.SetToMax(leaf_that_draws->bounds());

scoped_refptr<ThumbnailLayer> static_layer =
tab_content_manager_->GetStaticLayer(id);
Expand Down

0 comments on commit f7acd09

Please sign in to comment.