org.chromium.chrome.browser.init.EmptyBrowserParts Java Examples
The following examples show how to use
org.chromium.chrome.browser.init.EmptyBrowserParts.
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: ChromeBrowserSyncAdapter.java From delion with Apache License 2.0 | 6 votes |
private BrowserParts getBrowserParts(final Context context, final String account, final PendingInvalidation invalidation, final SyncResult syncResult, final Semaphore semaphore) { return new EmptyBrowserParts() { @Override public void finishNativeInitialization() { // Startup succeeded, so we can notify the invalidation. notifyInvalidation(invalidation.mObjectSource, invalidation.mObjectId, invalidation.mVersion, invalidation.mPayload); semaphore.release(); } @Override public void onStartupFailure() { // The startup failed, so we defer the invalidation. DelayedInvalidationsController.getInstance().addPendingInvalidation( context, account, invalidation); // Using numIoExceptions so Android will treat this as a soft error. syncResult.stats.numIoExceptions++; semaphore.release(); } }; }
Example #2
Source File: ChromeBrowserSyncAdapter.java From AndroidChromium with Apache License 2.0 | 6 votes |
private BrowserParts getBrowserParts(final Context context, final String account, final PendingInvalidation invalidation, final SyncResult syncResult, final Semaphore semaphore) { return new EmptyBrowserParts() { @Override public void finishNativeInitialization() { // Startup succeeded, so we can notify the invalidation. notifyInvalidation(invalidation.mObjectSource, invalidation.mObjectId, invalidation.mVersion, invalidation.mPayload); semaphore.release(); } @Override public void onStartupFailure() { // The startup failed, so we defer the invalidation. DelayedInvalidationsController.getInstance().addPendingInvalidation( context, account, invalidation); // Using numIoExceptions so Android will treat this as a soft error. syncResult.stats.numIoExceptions++; semaphore.release(); } }; }
Example #3
Source File: ChromeBrowserSyncAdapter.java From 365browser with Apache License 2.0 | 6 votes |
private BrowserParts getBrowserParts(final Context context, final String account, final PendingInvalidation invalidation, final SyncResult syncResult, final Semaphore semaphore) { return new EmptyBrowserParts() { @Override public void finishNativeInitialization() { // Startup succeeded, so we can notify the invalidation. notifyInvalidation(invalidation.mObjectSource, invalidation.mObjectId, invalidation.mVersion, invalidation.mPayload); semaphore.release(); } @Override public void onStartupFailure() { // The startup failed, so we defer the invalidation. DelayedInvalidationsController.getInstance().addPendingInvalidation( context, account, invalidation); // Using numIoExceptions so Android will treat this as a soft error. syncResult.stats.numIoExceptions++; semaphore.release(); } }; }
Example #4
Source File: AccountsChangedReceiver.java From delion with Apache License 2.0 | 5 votes |
@SuppressFBWarnings("DM_EXIT") private static void startBrowserIfNeededAndValidateAccounts(final Context context) { BrowserParts parts = new EmptyBrowserParts() { @Override public void finishNativeInitialization() { ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { SigninHelper.get(context).validateAccountSettings(true); } }); } @Override public void onStartupFailure() { // Startup failed. So notify SigninHelper of changed accounts via // shared prefs. SigninHelper.markAccountsChangedPref(context); } }; try { ChromeBrowserInitializer.getInstance(context).handlePreNativeStartup(parts); ChromeBrowserInitializer.getInstance(context).handlePostNativeStartup(true, parts); } catch (ProcessInitException e) { Log.e(TAG, "Unable to load native library.", e); ChromeApplication.reportStartupErrorAndExit(e); } }
Example #5
Source File: AccountsChangedReceiver.java From AndroidChromium with Apache License 2.0 | 5 votes |
@SuppressFBWarnings("DM_EXIT") private static void startBrowserIfNeededAndValidateAccounts(final Context context) { BrowserParts parts = new EmptyBrowserParts() { @Override public void finishNativeInitialization() { ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { SigninHelper.get(context).validateAccountSettings(true); } }); } @Override public void onStartupFailure() { // Startup failed. So notify SigninHelper of changed accounts via // shared prefs. SigninHelper.markAccountsChangedPref(context); } }; try { ChromeBrowserInitializer.getInstance(context).handlePreNativeStartup(parts); ChromeBrowserInitializer.getInstance(context).handlePostNativeStartup(true, parts); } catch (ProcessInitException e) { Log.e(TAG, "Unable to load native library.", e); ChromeApplication.reportStartupErrorAndExit(e); } }
Example #6
Source File: NativeBackgroundTask.java From 365browser with Apache License 2.0 | 5 votes |
/** * Ensure that native is started before running the task. If native fails to start, the task is * going to be rescheduled, by issuing a {@see TaskFinishedCallback} with parameter set to * <c>true</c>. * * @param context the current context * @param startWithNativeRunnable A runnable that will execute #onStartTaskWithNative, after the * native is loaded. * @param rescheduleRunnable A runnable that will be called to reschedule the task in case * native initialization fails. */ protected final void runWithNative(final Context context, final Runnable startWithNativeRunnable, final Runnable rescheduleRunnable) { if (isNativeLoaded()) { ThreadUtils.postOnUiThread(startWithNativeRunnable); return; } final BrowserParts parts = new EmptyBrowserParts() { @Override public void finishNativeInitialization() { ThreadUtils.postOnUiThread(startWithNativeRunnable); } @Override public void onStartupFailure() { ThreadUtils.postOnUiThread(rescheduleRunnable); } }; ThreadUtils.postOnUiThread(new Runnable() { @Override public void run() { // If task was stopped before we got here, don't start native initialization. if (mTaskStopped) return; try { ChromeBrowserInitializer.getInstance(context).handlePreNativeStartup(parts); ChromeBrowserInitializer.getInstance(context).handlePostNativeStartup( true /* isAsync */, parts); } catch (ProcessInitException e) { Log.e(TAG, "ProcessInitException while starting the browser process."); rescheduleRunnable.run(); return; } } }); }
Example #7
Source File: AccountsChangedReceiver.java From 365browser with Apache License 2.0 | 5 votes |
@SuppressFBWarnings("DM_EXIT") private static void startBrowserIfNeededAndValidateAccounts(final Context context) { BrowserParts parts = new EmptyBrowserParts() { @Override public void finishNativeInitialization() { ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { SigninHelper.get(context).validateAccountSettings(true); } }); } @Override public void onStartupFailure() { // Startup failed. So notify SigninHelper of changed accounts via // shared prefs. SigninHelper.markAccountsChangedPref(context); } }; try { ChromeBrowserInitializer.getInstance(context).handlePreNativeStartup(parts); ChromeBrowserInitializer.getInstance(context).handlePostNativeStartup(true, parts); } catch (ProcessInitException e) { Log.e(TAG, "Unable to load native library.", e); ChromeApplication.reportStartupErrorAndExit(e); } }