Java Code Examples for org.chromium.chrome.browser.ChromeActivity#hadWarmStart()

The following examples show how to use org.chromium.chrome.browser.ChromeActivity#hadWarmStart() . 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: NewTabPageUma.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Records the type of load for the NTP, such as cold or warm start.
 */
public static void recordLoadType(ChromeActivity activity) {
    if (activity.getLastUserInteractionTime() > 0) {
        RecordHistogram.recordEnumeratedHistogram(
                "NewTabPage.LoadType", LOAD_TYPE_OTHER, LOAD_TYPE_COUNT);
        return;
    }

    if (activity.hadWarmStart()) {
        RecordHistogram.recordEnumeratedHistogram(
                "NewTabPage.LoadType", LOAD_TYPE_WARM_START, LOAD_TYPE_COUNT);
        return;
    }

    RecordHistogram.recordEnumeratedHistogram(
            "NewTabPage.LoadType", LOAD_TYPE_COLD_START, LOAD_TYPE_COUNT);
}
 
Example 2
Source File: NewTabPageUma.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Records how much time elapsed from start until the search box became available to the user.
 */
public static void recordSearchAvailableLoadTime(ChromeActivity activity) {
    // Log the time it took for the search box to be displayed at startup, based on the
    // timestamp on the intent for the activity. If the user has interacted with the
    // activity already, it's not a startup, and the timestamp on the activity would not be
    // relevant either.
    if (activity.getLastUserInteractionTime() != 0) return;
    long timeFromIntent = SystemClock.elapsedRealtime()
            - IntentHandler.getTimestampFromIntent(activity.getIntent());
    if (activity.hadWarmStart()) {
        RecordHistogram.recordMediumTimesHistogram(
                "NewTabPage.SearchAvailableLoadTime2.WarmStart", timeFromIntent,
                TimeUnit.MILLISECONDS);
    } else {
        RecordHistogram.recordMediumTimesHistogram(
                "NewTabPage.SearchAvailableLoadTime2.ColdStart", timeFromIntent,
                TimeUnit.MILLISECONDS);
    }
}