本文整理汇总了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);
}