當前位置: 首頁>>代碼示例>>Java>>正文


Java PageLoadMetrics類代碼示例

本文整理匯總了Java中org.chromium.chrome.browser.metrics.PageLoadMetrics的典型用法代碼示例。如果您正苦於以下問題:Java PageLoadMetrics類的具體用法?Java PageLoadMetrics怎麽用?Java PageLoadMetrics使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PageLoadMetrics類屬於org.chromium.chrome.browser.metrics包,在下文中一共展示了PageLoadMetrics類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: notifyPageLoadMetric

import org.chromium.chrome.browser.metrics.PageLoadMetrics; //導入依賴的package包/類
/**
 * Notifies the application of a page load metric.
 *
 * TODD(lizeb): Move this to a proper method in {@link CustomTabsCallback} once one is
 * available.
 *
 * @param session Session identifier.
 * @param metricName Name of the page load metric.
 * @param navigationStartTick Absolute navigation start time, as TimeTicks taken from native.
 *
 * @param offsetMs Offset in ms from navigationStart.
 */
boolean notifyPageLoadMetric(CustomTabsSessionToken session, String metricName,
        long navigationStartTick, long offsetMs) {
    CustomTabsCallback callback = mClientManager.getCallbackForSession(session);
    if (callback == null) return false;

    if (!mNativeTickOffsetUsComputed) {
        // Compute offset from time ticks to uptimeMillis.
        mNativeTickOffsetUsComputed = true;
        long nativeNowUs = TimeUtils.nativeGetTimeTicksNowUs();
        long javaNowUs = SystemClock.uptimeMillis() * 1000;
        mNativeTickOffsetUs = nativeNowUs - javaNowUs;
    }

    Bundle args = new Bundle();
    args.putLong(PageLoadMetrics.NAVIGATION_START,
            (navigationStartTick - mNativeTickOffsetUs) / 1000);
    args.putLong(metricName, offsetMs);
    try {
        callback.extraCallback(PAGE_LOAD_METRICS_CALLBACK, args);
    } catch (Exception e) {
        // Pokemon exception handling, see above and crbug.com/517023.
        return false;
    }
    return true;
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:38,代碼來源:CustomTabsConnection.java

示例2: onFirstContentfulPaint

import org.chromium.chrome.browser.metrics.PageLoadMetrics; //導入依賴的package包/類
@Override
public void onFirstContentfulPaint(WebContents webContents, long firstContentfulPaintMs) {
    if (webContents != mTab.getWebContents()) return;

    mConnection.notifyPageLoadMetric(
            mSession, PageLoadMetrics.FIRST_CONTENTFUL_PAINT, firstContentfulPaintMs);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:8,代碼來源:CustomTabActivity.java

示例3: onFirstContentfulPaint

import org.chromium.chrome.browser.metrics.PageLoadMetrics; //導入依賴的package包/類
@Override
public void onFirstContentfulPaint(
        WebContents webContents, long navigationStartTick, long firstContentfulPaintMs) {
    if (webContents != mWebContents) return;

    mConnection.notifyPageLoadMetric(mSession, PageLoadMetrics.FIRST_CONTENTFUL_PAINT,
            navigationStartTick, firstContentfulPaintMs);
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:9,代碼來源:CustomTabActivity.java

示例4: onLoadEventStart

import org.chromium.chrome.browser.metrics.PageLoadMetrics; //導入依賴的package包/類
@Override
public void onLoadEventStart(
        WebContents webContents, long navigationStartTick, long loadEventStartMs) {
    if (webContents != mWebContents) return;

    mConnection.notifyPageLoadMetric(mSession, PageLoadMetrics.LOAD_EVENT_START,
            navigationStartTick, loadEventStartMs);
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:9,代碼來源:CustomTabActivity.java

示例5: didAddTab

import org.chromium.chrome.browser.metrics.PageLoadMetrics; //導入依賴的package包/類
@Override
public void didAddTab(Tab tab, TabLaunchType type) {
    PageLoadMetrics.addObserver(mMetricsObserver);
    tab.addObserver(mTabObserver);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:6,代碼來源:CustomTabActivity.java

示例6: didCloseTab

import org.chromium.chrome.browser.metrics.PageLoadMetrics; //導入依賴的package包/類
@Override
public void didCloseTab(int tabId, boolean incognito) {
    PageLoadMetrics.removeObserver(mMetricsObserver);
    // Finish the activity after we intent out.
    if (getTabModelSelector().getCurrentModel().getCount() == 0) finishAndClose(false);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:7,代碼來源:CustomTabActivity.java

示例7: tabRemoved

import org.chromium.chrome.browser.metrics.PageLoadMetrics; //導入依賴的package包/類
@Override
public void tabRemoved(Tab tab) {
    tab.removeObserver(mTabObserver);
    PageLoadMetrics.removeObserver(mMetricsObserver);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:6,代碼來源:CustomTabActivity.java


注:本文中的org.chromium.chrome.browser.metrics.PageLoadMetrics類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。