Commit 2f0dc808 authored by lizeb's avatar lizeb Committed by Commit bot

customtabs: Don't cache the Tab in PageLoadMetricsObserver.

Only the WebContents is needed, don't keep a reference to Tab, that
keeps a reference to the Activity.

BUG=715724

Review-Url: https://codereview.chromium.org/2847533004
Cr-Commit-Position: refs/heads/master@{#468060}
parent 7db35ca7
......@@ -133,19 +133,19 @@ public class CustomTabActivity extends ChromeActivity {
private static class PageLoadMetricsObserver implements PageLoadMetrics.Observer {
private final CustomTabsConnection mConnection;
private final CustomTabsSessionToken mSession;
private final Tab mTab;
private final WebContents mWebContents;
public PageLoadMetricsObserver(CustomTabsConnection connection,
CustomTabsSessionToken session, Tab tab) {
mConnection = connection;
mSession = session;
mTab = tab;
mWebContents = tab.getWebContents();
}
@Override
public void onFirstContentfulPaint(
WebContents webContents, long navigationStartTick, long firstContentfulPaintMs) {
if (webContents != mTab.getWebContents()) return;
if (webContents != mWebContents) return;
mConnection.notifyPageLoadMetric(mSession, PageLoadMetrics.FIRST_CONTENTFUL_PAINT,
navigationStartTick, firstContentfulPaintMs);
......@@ -154,7 +154,7 @@ public class CustomTabActivity extends ChromeActivity {
@Override
public void onLoadEventStart(
WebContents webContents, long navigationStartTick, long loadEventStartMs) {
if (webContents != mTab.getWebContents()) return;
if (webContents != mWebContents) return;
mConnection.notifyPageLoadMetric(mSession, PageLoadMetrics.LOAD_EVENT_START,
navigationStartTick, loadEventStartMs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment