本文整理匯總了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;
}
示例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);
}
示例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);
}
示例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);
}
示例5: didAddTab
import org.chromium.chrome.browser.metrics.PageLoadMetrics; //導入依賴的package包/類
@Override
public void didAddTab(Tab tab, TabLaunchType type) {
PageLoadMetrics.addObserver(mMetricsObserver);
tab.addObserver(mTabObserver);
}
示例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);
}
示例7: tabRemoved
import org.chromium.chrome.browser.metrics.PageLoadMetrics; //導入依賴的package包/類
@Override
public void tabRemoved(Tab tab) {
tab.removeObserver(mTabObserver);
PageLoadMetrics.removeObserver(mMetricsObserver);
}