Java Code Examples for org.chromium.base.metrics.RecordHistogram#recordCustomTimesHistogram()

The following examples show how to use org.chromium.base.metrics.RecordHistogram#recordCustomTimesHistogram() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientManager.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Registers that a client has launched a URL inside a Custom Tab.
 */
public synchronized void registerLaunch(CustomTabsSessionToken session, String url) {
    int outcome = getPredictionOutcome(session, url);
    RecordHistogram.recordEnumeratedHistogram(
            "CustomTabs.PredictionStatus", outcome, PREDICTION_STATUS_COUNT);

    SessionParams params = mSessionParams.get(session);
    if (outcome == GOOD_PREDICTION) {
        long elapsedTimeMs = SystemClock.elapsedRealtime()
                - params.getLastMayLaunchUrlTimestamp();
        RequestThrottler.getForUid(mContext, params.uid).registerSuccess(
                params.mPredictedUrl);
        RecordHistogram.recordCustomTimesHistogram("CustomTabs.PredictionToLaunch",
                elapsedTimeMs, 1, TimeUnit.MINUTES.toMillis(3), TimeUnit.MILLISECONDS, 100);
    }
    RecordHistogram.recordEnumeratedHistogram(
            "CustomTabs.WarmupStateOnLaunch", getWarmupState(session), SESSION_WARMUP_COUNT);
    if (params != null) params.setPredictionMetrics(null, 0);
}
 
Example 2
Source File: ToolbarManager.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Handle all necessary tasks that can be delayed until initialization completes.
 * @param activityCreationTimeMs The time of creation for the activity this toolbar belongs to.
 * @param activityName Simple class name for the activity this toolbar belongs to.
 */
public void onDeferredStartup(final long activityCreationTimeMs,
        final String activityName) {
    // Record startup performance statistics
    long elapsedTime = SystemClock.elapsedRealtime() - activityCreationTimeMs;
    if (elapsedTime < RECORD_UMA_PERFORMANCE_METRICS_DELAY_MS) {
        ThreadUtils.postOnUiThreadDelayed(new Runnable() {
            @Override
            public void run() {
                onDeferredStartup(activityCreationTimeMs, activityName);
            }
        }, RECORD_UMA_PERFORMANCE_METRICS_DELAY_MS - elapsedTime);
    }
    RecordHistogram.recordTimesHistogram("MobileStartup.ToolbarFirstDrawTime." + activityName,
            mToolbar.getFirstDrawTime() - activityCreationTimeMs, TimeUnit.MILLISECONDS);

    long firstFocusTime = mToolbar.getLocationBar().getFirstUrlBarFocusTime();
    if (firstFocusTime != 0) {
        RecordHistogram.recordCustomTimesHistogram(
                "MobileStartup.ToolbarFirstFocusTime." + activityName,
                firstFocusTime - activityCreationTimeMs, MIN_FOCUS_TIME_FOR_UMA_HISTOGRAM_MS,
                MAX_FOCUS_TIME_FOR_UMA_HISTOGRAM_MS, TimeUnit.MILLISECONDS, 50);
    }
}
 
Example 3
Source File: ClientManager.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Registers that a client has launched a URL inside a Custom Tab.
 */
public synchronized void registerLaunch(CustomTabsSessionToken session, String url) {
    int outcome = getPredictionOutcome(session, url);
    RecordHistogram.recordEnumeratedHistogram(
            "CustomTabs.PredictionStatus", outcome, PREDICTION_STATUS_COUNT);

    SessionParams params = mSessionParams.get(session);
    if (outcome == GOOD_PREDICTION) {
        long elapsedTimeMs = SystemClock.elapsedRealtime()
                - params.getLastMayLaunchUrlTimestamp();
        RequestThrottler.getForUid(mContext, params.uid).registerSuccess(
                params.mPredictedUrl);
        RecordHistogram.recordCustomTimesHistogram("CustomTabs.PredictionToLaunch",
                elapsedTimeMs, 1, TimeUnit.MINUTES.toMillis(3), TimeUnit.MILLISECONDS, 100);
    }
    RecordHistogram.recordEnumeratedHistogram(
            "CustomTabs.WarmupStateOnLaunch", getWarmupState(session), SESSION_WARMUP_COUNT);

    if (params == null) return;

    int value = (params.lowConfidencePrediction ? LOW_CONFIDENCE : 0)
            + (params.highConfidencePrediction ? HIGH_CONFIDENCE : 0);
    RecordHistogram.recordEnumeratedHistogram(
            "CustomTabs.MayLaunchUrlType", value, MAY_LAUNCH_URL_TYPE_COUNT);
    params.resetPredictionMetrics();
}
 
Example 4
Source File: ToolbarManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Handle all necessary tasks that can be delayed until initialization completes.
 * @param activityCreationTimeMs The time of creation for the activity this toolbar belongs to.
 * @param activityName Simple class name for the activity this toolbar belongs to.
 */
public void onDeferredStartup(final long activityCreationTimeMs,
        final String activityName) {
    // Record startup performance statistics
    long elapsedTime = SystemClock.elapsedRealtime() - activityCreationTimeMs;
    if (elapsedTime < RECORD_UMA_PERFORMANCE_METRICS_DELAY_MS) {
        ThreadUtils.postOnUiThreadDelayed(new Runnable() {
            @Override
            public void run() {
                onDeferredStartup(activityCreationTimeMs, activityName);
            }
        }, RECORD_UMA_PERFORMANCE_METRICS_DELAY_MS - elapsedTime);
    }
    RecordHistogram.recordTimesHistogram("MobileStartup.ToolbarFirstDrawTime." + activityName,
            mToolbar.getFirstDrawTime() - activityCreationTimeMs, TimeUnit.MILLISECONDS);

    long firstFocusTime = mToolbar.getLocationBar().getFirstUrlBarFocusTime();
    if (firstFocusTime != 0) {
        RecordHistogram.recordCustomTimesHistogram(
                "MobileStartup.ToolbarFirstFocusTime." + activityName,
                firstFocusTime - activityCreationTimeMs, MIN_FOCUS_TIME_FOR_UMA_HISTOGRAM_MS,
                MAX_FOCUS_TIME_FOR_UMA_HISTOGRAM_MS, TimeUnit.MILLISECONDS, 50);
    }
}
 
Example 5
Source File: ClientManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Registers that a client has launched a URL inside a Custom Tab.
 */
public synchronized void registerLaunch(CustomTabsSessionToken session, String url) {
    int outcome = getPredictionOutcome(session, url);
    RecordHistogram.recordEnumeratedHistogram(
            "CustomTabs.PredictionStatus", outcome, PREDICTION_STATUS_COUNT);

    SessionParams params = mSessionParams.get(session);
    if (outcome == GOOD_PREDICTION) {
        long elapsedTimeMs = SystemClock.elapsedRealtime()
                - params.getLastMayLaunchUrlTimestamp();
        RequestThrottler.getForUid(mContext, params.uid).registerSuccess(
                params.mPredictedUrl);
        RecordHistogram.recordCustomTimesHistogram("CustomTabs.PredictionToLaunch",
                elapsedTimeMs, 1, TimeUnit.MINUTES.toMillis(3), TimeUnit.MILLISECONDS, 100);
    }
    RecordHistogram.recordEnumeratedHistogram(
            "CustomTabs.WarmupStateOnLaunch", getWarmupState(session), SESSION_WARMUP_COUNT);
    if (params != null) params.setPredictionMetrics(null, 0);
}
 
Example 6
Source File: ToolbarManager.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Handle all necessary tasks that can be delayed until initialization completes.
 * @param activityCreationTimeMs The time of creation for the activity this toolbar belongs to.
 * @param activityName Simple class name for the activity this toolbar belongs to.
 */
public void onDeferredStartup(final long activityCreationTimeMs,
        final String activityName) {
    // Record startup performance statistics
    long elapsedTime = SystemClock.elapsedRealtime() - activityCreationTimeMs;
    if (elapsedTime < RECORD_UMA_PERFORMANCE_METRICS_DELAY_MS) {
        ThreadUtils.postOnUiThreadDelayed(new Runnable() {
            @Override
            public void run() {
                onDeferredStartup(activityCreationTimeMs, activityName);
            }
        }, RECORD_UMA_PERFORMANCE_METRICS_DELAY_MS - elapsedTime);
    }
    RecordHistogram.recordTimesHistogram("MobileStartup.ToolbarFirstDrawTime." + activityName,
            mToolbar.getFirstDrawTime() - activityCreationTimeMs, TimeUnit.MILLISECONDS);

    long firstFocusTime = mToolbar.getLocationBar().getFirstUrlBarFocusTime();
    if (firstFocusTime != 0) {
        RecordHistogram.recordCustomTimesHistogram(
                "MobileStartup.ToolbarFirstFocusTime." + activityName,
                firstFocusTime - activityCreationTimeMs, MIN_FOCUS_TIME_FOR_UMA_HISTOGRAM_MS,
                MAX_FOCUS_TIME_FOR_UMA_HISTOGRAM_MS, TimeUnit.MILLISECONDS, 50);
    }
}
 
Example 7
Source File: CustomTabObserver.java    From delion with Apache License 2.0 6 votes vote down vote up
@Override
public void onPageLoadFinished(Tab tab) {
    long pageLoadFinishedTimestamp = SystemClock.elapsedRealtime();
    mCustomTabsConnection.notifyNavigationEvent(
            mSession, CustomTabsCallback.NAVIGATION_FINISHED);
    // Both histograms (commit and PLT) are reported here, to make sure
    // that they are always recorded together, and that we only record
    // commits for successful navigations.
    if (mCurrentState == STATE_WAITING_LOAD_FINISH && mIntentReceivedTimestamp > 0) {
        long timeToPageLoadStartedMs = mPageLoadStartedTimestamp - mIntentReceivedTimestamp;
        long timeToPageLoadFinishedMs =
                pageLoadFinishedTimestamp - mIntentReceivedTimestamp;
        // Same bounds and bucket count as "Startup.FirstCommitNavigationTime"
        RecordHistogram.recordCustomTimesHistogram(
                "CustomTabs.IntentToFirstCommitNavigationTime", timeToPageLoadStartedMs,
                1, TimeUnit.MINUTES.toMillis(1), TimeUnit.MILLISECONDS, 225);
        // Same bounds and bucket count as PLT histograms.
        RecordHistogram.recordCustomTimesHistogram("CustomTabs.IntentToPageLoadedTime",
                timeToPageLoadFinishedMs, 10, TimeUnit.MINUTES.toMillis(10),
                TimeUnit.MILLISECONDS, 100);
    }
    resetPageLoadTracking();
}
 
Example 8
Source File: MemoryUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
public void onLowMemory() {
    memoryNotificationForeground(FOREGROUND_LOW);
    long now = SystemClock.elapsedRealtime();
    if (mLastLowMemoryMsec >= 0) {
        RecordHistogram.recordCustomTimesHistogram("MemoryAndroid.LowMemoryTimeBetween",
                now - mLastLowMemoryMsec, 0, TimeUnit.MINUTES.toMillis(10),
                TimeUnit.MILLISECONDS, 50);
    }
    mLastLowMemoryMsec = now;
}
 
Example 9
Source File: TabWebContentsObserver.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void didCommitProvisionalLoadForFrame(long frameId, boolean isMainFrame, String url,
        int transitionType) {
    if (isMainFrame && UmaUtils.isRunningApplicationStart()) {
        // Currently it takes about 2000ms to commit a navigation if the measurement
        // begins very early in the browser start. How many buckets (b) are needed to
        // explore the _typical_ values with granularity 100ms and a maximum duration
        // of 1 minute?
        //   s^{n+1} / s^{n} = 2100 / 2000
        //   s = 1.05
        //   s^b = 60000
        //   b = ln(60000) / ln(1.05) ~= 225
        RecordHistogram.recordCustomTimesHistogram("Startup.FirstCommitNavigationTime",
                SystemClock.uptimeMillis() - UmaUtils.getMainEntryPointTime(),
                1, 60000 /* 1 minute */, TimeUnit.MILLISECONDS, 225);
        UmaUtils.setRunningApplicationStart(false);
    }

    if (isMainFrame) {
        mTab.setIsTabStateDirty(true);
        mTab.updateTitle();
    }

    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidCommitProvisionalLoadForFrame(
                mTab, frameId, isMainFrame, url, transitionType);
    }

    observers.rewind();
    while (observers.hasNext()) {
        observers.next().onUrlUpdated(mTab);
    }

    if (!isMainFrame) return;
    mTab.handleDidCommitProvisonalLoadForFrame(url, transitionType);
}
 
Example 10
Source File: CustomTabObserver.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void onPageLoadFinished(Tab tab) {
    long pageLoadFinishedTimestamp = SystemClock.elapsedRealtime();
    if (mCustomTabsConnection != null) {
        mCustomTabsConnection.notifyNavigationEvent(
                mSession, CustomTabsCallback.NAVIGATION_FINISHED);
    }
    // Both histograms (commit and PLT) are reported here, to make sure
    // that they are always recorded together, and that we only record
    // commits for successful navigations.
    if (mCurrentState == STATE_WAITING_LOAD_FINISH && mIntentReceivedTimestamp > 0) {
        long timeToPageLoadStartedMs = mPageLoadStartedTimestamp - mIntentReceivedTimestamp;
        long timeToPageLoadFinishedMs =
                pageLoadFinishedTimestamp - mIntentReceivedTimestamp;

        String histogramPrefix = mOpenedByChrome ? "ChromeGeneratedCustomTab" : "CustomTabs";
        RecordHistogram.recordCustomTimesHistogram(
                histogramPrefix + ".IntentToFirstCommitNavigationTime2.ZoomedOut",
                timeToPageLoadStartedMs,
                50, TimeUnit.MINUTES.toMillis(10), TimeUnit.MILLISECONDS, 50);
        RecordHistogram.recordCustomTimesHistogram(
                histogramPrefix + ".IntentToFirstCommitNavigationTime2.ZoomedIn",
                timeToPageLoadStartedMs, 200, 1000, TimeUnit.MILLISECONDS, 100);
        // Same bounds and bucket count as PLT histograms.
        RecordHistogram.recordCustomTimesHistogram(histogramPrefix + ".IntentToPageLoadedTime",
                timeToPageLoadFinishedMs, 10, TimeUnit.MINUTES.toMillis(10),
                TimeUnit.MILLISECONDS, 100);
    }
    resetPageLoadTracking();
    captureNavigationInfo(tab);
}
 
Example 11
Source File: TabUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Records a sample in a histogram of times. This is the Java equivalent of the
 * UMA_HISTOGRAM_LONG_TIMES_100.
 */
private void recordLongTimesHistogram100(String name, long duration) {
    RecordHistogram.recordCustomTimesHistogram(
            name, TimeUnit.MILLISECONDS.toMillis(duration),
            TimeUnit.MILLISECONDS.toMillis(1), TimeUnit.HOURS.toMillis(1),
            TimeUnit.MILLISECONDS, 100);
}
 
Example 12
Source File: TabWebContentsObserver.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void didCommitProvisionalLoadForFrame(long frameId, boolean isMainFrame, String url,
        int transitionType) {
    if (isMainFrame && UmaUtils.isRunningApplicationStart()) {
        // Currently it takes about 2000ms to commit a navigation if the measurement
        // begins very early in the browser start. How many buckets (b) are needed to
        // explore the _typical_ values with granularity 100ms and a maximum duration
        // of 1 minute?
        //   s^{n+1} / s^{n} = 2100 / 2000
        //   s = 1.05
        //   s^b = 60000
        //   b = ln(60000) / ln(1.05) ~= 225
        RecordHistogram.recordCustomTimesHistogram("Startup.FirstCommitNavigationTime2",
                SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
                1, 60000 /* 1 minute */, TimeUnit.MILLISECONDS, 225);
        UmaUtils.setRunningApplicationStart(false);
    }

    if (isMainFrame) {
        mTab.setIsTabStateDirty(true);
        mTab.updateTitle();
    }

    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidCommitProvisionalLoadForFrame(
                mTab, frameId, isMainFrame, url, transitionType);
    }

    observers.rewind();
    while (observers.hasNext()) {
        observers.next().onUrlUpdated(mTab);
    }

    if (!isMainFrame) return;
    mTab.handleDidCommitProvisonalLoadForFrame(url, transitionType);
}
 
Example 13
Source File: TabUma.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Records a sample in a histogram of times. This is the Java equivalent of the
 * UMA_HISTOGRAM_LONG_TIMES_100.
 */
private void recordLongTimesHistogram100(String name, long duration) {
    RecordHistogram.recordCustomTimesHistogram(
            name, TimeUnit.MILLISECONDS.toMillis(duration),
            TimeUnit.MILLISECONDS.toMillis(1), TimeUnit.HOURS.toMillis(1),
            TimeUnit.MILLISECONDS, 100);
}
 
Example 14
Source File: MemoryUma.java    From 365browser with Apache License 2.0 5 votes vote down vote up
public void onLowMemory() {
    memoryNotificationForeground(FOREGROUND_LOW);
    long now = SystemClock.elapsedRealtime();
    if (mLastLowMemoryMsec >= 0) {
        RecordHistogram.recordCustomTimesHistogram("MemoryAndroid.LowMemoryTimeBetween",
                now - mLastLowMemoryMsec, 0, TimeUnit.MINUTES.toMillis(10),
                TimeUnit.MILLISECONDS, 50);
    }
    mLastLowMemoryMsec = now;
}
 
Example 15
Source File: GeolocationHeader.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/** Records a data point for one of the GeolocationHeader.TimeListening* histograms. */
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE")
private static void recordTimeListeningHistogram(
        int locationSource, boolean locationAttached, long duration) {
    String name = getTimeListeningHistogramEnum(locationSource, locationAttached);
    if (name == null) return;
    RecordHistogram.recordCustomTimesHistogram(
            name, duration, 1, TIME_LISTENING_HISTOGRAM_MAX_MILLIS, TimeUnit.MILLISECONDS, 50);
}
 
Example 16
Source File: TabUma.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Records a sample in a histogram of times. This is the Java equivalent of the
 * UMA_HISTOGRAM_LONG_TIMES_100.
 */
private void recordLongTimesHistogram100(String name, long duration) {
    RecordHistogram.recordCustomTimesHistogram(
            name, TimeUnit.MILLISECONDS.toMillis(duration),
            TimeUnit.MILLISECONDS.toMillis(1), TimeUnit.HOURS.toMillis(1),
            TimeUnit.MILLISECONDS, 100);
}
 
Example 17
Source File: MemoryUma.java    From delion with Apache License 2.0 5 votes vote down vote up
public void onLowMemory() {
    memoryNotificationForeground(FOREGROUND_LOW);
    long now = SystemClock.elapsedRealtime();
    if (mLastLowMemoryMsec >= 0) {
        RecordHistogram.recordCustomTimesHistogram("MemoryAndroid.LowMemoryTimeBetween",
                now - mLastLowMemoryMsec, 0, TimeUnit.MINUTES.toMillis(10),
                TimeUnit.MILLISECONDS, 50);
    }
    mLastLowMemoryMsec = now;
}
 
Example 18
Source File: ChromeTabbedActivity.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
protected void recordIntentToCreationTime(long timeMs) {
    super.recordIntentToCreationTime(timeMs);
    RecordHistogram.recordCustomTimesHistogram("MobileStartup.IntentToCreationTime.TabbedMode",
            timeMs, 1, TimeUnit.SECONDS.toMillis(30), TimeUnit.MILLISECONDS, 50);
}
 
Example 19
Source File: CustomTabObserver.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void onPageLoadFinished(Tab tab) {
    long pageLoadFinishedTimestamp = SystemClock.elapsedRealtime();
    if (mCustomTabsConnection != null) {
        mCustomTabsConnection.notifyNavigationEvent(
                mSession, CustomTabsCallback.NAVIGATION_FINISHED);
    }

    if (mCurrentState == STATE_WAITING_LOAD_FINISH && mIntentReceivedTimestamp > 0) {
        String histogramPrefix = mOpenedByChrome ? "ChromeGeneratedCustomTab" : "CustomTabs";
        long timeToPageLoadFinishedMs = pageLoadFinishedTimestamp - mIntentReceivedTimestamp;
        if (mPageLoadStartedTimestamp > 0) {
            long timeToPageLoadStartedMs = mPageLoadStartedTimestamp - mIntentReceivedTimestamp;
            // Intent to Load Start is recorded here to make sure we do not record
            // failed/aborted page loads.
            RecordHistogram.recordCustomTimesHistogram(
                    histogramPrefix + ".IntentToFirstCommitNavigationTime2.ZoomedOut",
                    timeToPageLoadStartedMs, 50, TimeUnit.MINUTES.toMillis(10),
                    TimeUnit.MILLISECONDS, 50);
            RecordHistogram.recordCustomTimesHistogram(
                    histogramPrefix + ".IntentToFirstCommitNavigationTime2.ZoomedIn",
                    timeToPageLoadStartedMs, 200, 1000, TimeUnit.MILLISECONDS, 100);
        }
        // Same bounds and bucket count as PLT histograms.
        RecordHistogram.recordCustomTimesHistogram(histogramPrefix + ".IntentToPageLoadedTime",
                timeToPageLoadFinishedMs, 10, TimeUnit.MINUTES.toMillis(10),
                TimeUnit.MILLISECONDS, 100);

        // Not all page loads go through a navigation commit (prerender for instance).
        if (mPageLoadStartedTimestamp != 0) {
            long timeToFirstCommitMs = mFirstCommitTimestamp - mIntentReceivedTimestamp;
            // Current median is 550ms, and long tail is very long. ZoomedIn gives good view of
            // the median and ZoomedOut gives a good overview.
            RecordHistogram.recordCustomTimesHistogram(
                    "CustomTabs.IntentToFirstCommitNavigationTime3.ZoomedIn",
                    timeToFirstCommitMs, 200, 1000, TimeUnit.MILLISECONDS, 100);
            // For ZoomedOut very rarely is it under 50ms and this range matches
            // CustomTabs.IntentToFirstCommitNavigationTime2.ZoomedOut.
            RecordHistogram.recordCustomTimesHistogram(
                    "CustomTabs.IntentToFirstCommitNavigationTime3.ZoomedOut",
                    timeToFirstCommitMs, 50, TimeUnit.MINUTES.toMillis(10),
                    TimeUnit.MILLISECONDS, 50);
        }
    }
    resetPageLoadTracking();
    captureNavigationInfo(tab);
}
 
Example 20
Source File: TabWebContentsObserver.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void didFinishNavigation(String url, boolean isInMainFrame, boolean isErrorPage,
        boolean hasCommitted, boolean isSameDocument, boolean isFragmentNavigation,
        Integer pageTransition, int errorCode, String errorDescription, int httpStatusCode) {
    RewindableIterator<TabObserver> observers = mTab.getTabObservers();
    while (observers.hasNext()) {
        observers.next().onDidFinishNavigation(mTab, url, isInMainFrame, isErrorPage,
                hasCommitted, isSameDocument, isFragmentNavigation, pageTransition, errorCode,
                httpStatusCode);
    }

    if (errorCode != 0) {
        mTab.updateThemeColorIfNeeded(true);
        if (isInMainFrame) mTab.didFailPageLoad(errorCode);

        recordErrorInPolicyAuditor(url, errorDescription, errorCode);
    }

    if (!hasCommitted) return;
    if (isInMainFrame && UmaUtils.isRunningApplicationStart()) {
        // Current median is 550ms, and long tail is very long. ZoomedIn gives good view of the
        // median and ZoomedOut gives a good overview.
        RecordHistogram.recordCustomTimesHistogram(
                "Startup.FirstCommitNavigationTime2.ZoomedIn",
                SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
                200, 1000, TimeUnit.MILLISECONDS, 100);
        // For ZoomedOut very rarely is it under 50ms and this range matches
        // CustomTabs.IntentToFirstCommitNavigationTime2.ZoomedOut.
        RecordHistogram.recordCustomTimesHistogram(
                "Startup.FirstCommitNavigationTime2.ZoomedOut",
                SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
                50, TimeUnit.MINUTES.toMillis(10), TimeUnit.MILLISECONDS, 50);
        UmaUtils.setRunningApplicationStart(false);
    }

    if (isInMainFrame) {
        mTab.setIsTabStateDirty(true);
        mTab.updateTitle();
        mTab.handleDidFinishNavigation(url, pageTransition);
        mTab.setIsShowingErrorPage(isErrorPage);
    }

    observers.rewind();
    while (observers.hasNext()) {
        observers.next().onUrlUpdated(mTab);
    }

    FullscreenManager fullscreenManager = mTab.getFullscreenManager();
    if (isInMainFrame && !isSameDocument && fullscreenManager != null) {
        fullscreenManager.setPersistentFullscreenMode(false);
    }

    if (isInMainFrame) {
        mTab.stopSwipeRefreshHandler();
    }
}