Java Code Examples for org.chromium.base.ObserverList.RewindableIterator#rewind()
The following examples show how to use
org.chromium.base.ObserverList.RewindableIterator#rewind() .
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: TabWebContentsObserver.java From delion with Apache License 2.0 | 5 votes |
@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 2
Source File: TabWebContentsObserver.java From AndroidChromium with Apache License 2.0 | 5 votes |
@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 3
Source File: TabWebContentsObserver.java From 365browser with Apache License 2.0 | 4 votes |
@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(); } }