Java Code Examples for org.chromium.base.ThreadUtils#checkUiThread()

The following examples show how to use org.chromium.base.ThreadUtils#checkUiThread() . 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: ChromeBrowserInitializer.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void handleSynchronousStartupInternal(final boolean startGpuProcess)
        throws ProcessInitException {
    ThreadUtils.checkUiThread();

    BrowserParts parts = new EmptyBrowserParts() {
        @Override
        public boolean shouldStartGpuProcess() {
            return startGpuProcess;
        }
    };
    handlePreNativeStartup(parts);
    handlePostNativeStartup(false, parts);
}
 
Example 2
Source File: ChromeBrowserInitializer.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Execute startup tasks that can be done without native libraries. See {@link BrowserParts} for
 * a list of calls to be implemented.
 * @param parts The delegate for the {@link ChromeBrowserInitializer} to communicate
 *              initialization tasks.
 */
public void handlePreNativeStartup(final BrowserParts parts) {
    ThreadUtils.checkUiThread();

    ProcessInitializationHandler.getInstance().initializePreNative();
    preInflationStartup();
    parts.preInflationStartup();
    if (parts.isActivityFinishing()) return;

    preInflationStartupDone();
    parts.setContentViewAndLoadLibrary();
    postInflationStartup();
    parts.postInflationStartup();
}
 
Example 3
Source File: ProcessInitializationHandler.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * @return The ProcessInitializationHandler for use during the lifetime of the browser process.
 */
@SuppressFBWarnings("LI_LAZY_INIT_STATIC")
public static ProcessInitializationHandler getInstance() {
    ThreadUtils.checkUiThread();
    if (sInstance == null) {
        sInstance = AppHooks.get().createProcessInitializationHandler();
    }
    return sInstance;
}
 
Example 4
Source File: ProcessInitializationHandler.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes any dependencies that must occur after the native library has been loaded.
 */
public final void initializePostNative() {
    ThreadUtils.checkUiThread();
    if (mInitializedPostNative) return;
    handlePostNativeInitialization();
    mInitializedPostNative = true;
}
 
Example 5
Source File: ProcessInitializationHandler.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Handle application level deferred startup tasks that can be lazily done after all
 * the necessary initialization has been completed. Should only be triggered once per browser
 * process lifetime. Any calls requiring network access should probably go here.
 *
 * Keep these tasks short and break up long tasks into multiple smaller tasks, as they run on
 * the UI thread and are blocking. Remember to follow RAIL guidelines, as much as possible, and
 * that most devices are quite slow, so leave enough buffer.
 */
public final void initializeDeferredStartupTasks() {
    ThreadUtils.checkUiThread();
    if (mInitializedDeferredStartupTasks) return;
    mInitializedDeferredStartupTasks = true;

    RecordHistogram.recordLongTimesHistogram("UMA.Debug.EnableCrashUpload.DeferredStartUptime2",
            SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
            TimeUnit.MILLISECONDS);

    handleDeferredStartupTasksInitialization();
}
 
Example 6
Source File: ProcessInitializationHandler.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 * Initializes the any dependencies that must occur before native library has been loaded.
 * <p>
 * Adding anything expensive to this must be avoided as it would delay the Chrome startup path.
 * <p>
 * All entry points that do not rely on {@link ChromeBrowserInitializer} must call this on
 * startup.
 */
public final void initializePreNative() {
    ThreadUtils.checkUiThread();
    if (mInitializedPreNative) return;
    handlePreNativeInitialization();
    mInitializedPreNative = true;
}