@Override
 public void destroy() {
   if (mSceneLayer != null) {
     mSceneLayer.destroy();
     mSceneLayer = null;
   }
 }
  @Override
  protected void updateSceneLayer(
      Rect viewport,
      Rect contentViewport,
      LayerTitleCache layerTitleCache,
      TabContentManager tabContentManager,
      ResourceManager resourceManager,
      ChromeFullscreenManager fullscreenManager) {
    super.updateSceneLayer(
        viewport,
        contentViewport,
        layerTitleCache,
        tabContentManager,
        resourceManager,
        fullscreenManager);
    assert mSceneLayer != null;

    final LayoutTab[] tabs = getLayoutTabsToRender();
    if (tabs == null || tabs.length != 1 || tabs[0].getId() == Tab.INVALID_TAB_ID) {
      return;
    }
    LayoutTab layoutTab = tabs[0];
    final float dpToPx = getContext().getResources().getDisplayMetrics().density;

    mReaderModeSceneLayer.update(mReaderModePanel, resourceManager);

    mSceneLayer.update(
        dpToPx, contentViewport, layerTitleCache, tabContentManager, fullscreenManager, layoutTab);

    // TODO(pedrosimonetti): Coordinate w/ dtrainor@ to improve integration with TreeProvider.
    SceneLayer overlayLayer = null;
    if (mSearchPanel.isShowing()) {
      overlayLayer = super.getSceneLayer();
    } else if (mReaderModePanel != null && mReaderModePanel.isShowing()) {
      overlayLayer = mReaderModeSceneLayer;
    }
    mSceneLayer.setContentSceneLayer(overlayLayer);

    // TODO(dtrainor): Find the best way to properly track this metric for cold starts.
    // We should probably erase the thumbnail when we select a tab that we need to restore.
    if (tabContentManager != null && tabContentManager.hasFullCachedThumbnail(layoutTab.getId())) {
      TabModelBase.logPerceivedTabSwitchLatencyMetric();
    }
  }