本文整理匯總了Java中org.chromium.chrome.browser.precache.PrecacheController類的典型用法代碼示例。如果您正苦於以下問題:Java PrecacheController類的具體用法?Java PrecacheController怎麽用?Java PrecacheController使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PrecacheController類屬於org.chromium.chrome.browser.precache包,在下文中一共展示了PrecacheController類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: launchBrowser
import org.chromium.chrome.browser.precache.PrecacheController; //導入依賴的package包/類
@VisibleForTesting
@SuppressFBWarnings("DM_EXIT")
protected void launchBrowser(Context context, String tag) {
Log.i(TAG, "Launching browser");
try {
ChromeBrowserInitializer.getInstance(this).handleSynchronousStartup();
} catch (ProcessInitException e) {
Log.e(TAG, "ProcessInitException while starting the browser process");
switch (tag) {
case PrecacheController.PERIODIC_TASK_TAG:
case PrecacheController.CONTINUATION_TASK_TAG:
// Record the failure persistently, and upload to UMA when the library
// successfully loads next time.
PrecacheUMA.record(PrecacheUMA.Event.PRECACHE_TASK_LOAD_LIBRARY_FAIL);
break;
default:
break;
}
// Since the library failed to initialize nothing in the application
// can work, so kill the whole application not just the activity.
System.exit(-1);
}
}
示例2: onRunTask
import org.chromium.chrome.browser.precache.PrecacheController; //導入依賴的package包/類
@Override
@VisibleForTesting
public int onRunTask(final TaskParams params) {
final String taskTag = params.getTag();
Log.i(TAG, "[" + taskTag + "] Woken up at " + new java.util.Date().toString());
final ChromeBackgroundServiceWaiter waiter = getWaiterIfNeeded(params.getExtras());
final Context context = this;
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
switch (taskTag) {
case BackgroundSyncLauncher.TASK_TAG:
handleBackgroundSyncEvent(context, taskTag);
break;
case OfflinePageUtils.TASK_TAG:
handleOfflinePageBackgroundLoad(
context, params.getExtras(), waiter, taskTag);
break;
case SnippetsLauncher.TASK_TAG_WIFI:
case SnippetsLauncher.TASK_TAG_FALLBACK:
handleFetchSnippets(context, taskTag);
break;
case PrecacheController.PERIODIC_TASK_TAG:
case PrecacheController.CONTINUATION_TASK_TAG:
handlePrecache(context, taskTag);
break;
case DownloadResumptionScheduler.TASK_TAG:
DownloadResumptionScheduler.getDownloadResumptionScheduler(
context.getApplicationContext()).handleDownloadResumption();
break;
default:
Log.i(TAG, "Unknown task tag " + taskTag);
break;
}
}
});
// If needed, block the GcmNetworkManager thread until the UI thread has finished its work.
waitForTaskIfNeeded(waiter);
return GcmNetworkManager.RESULT_SUCCESS;
}
示例3: hasPrecacheInstance
import org.chromium.chrome.browser.precache.PrecacheController; //導入依賴的package包/類
@VisibleForTesting
protected boolean hasPrecacheInstance() {
return PrecacheController.hasInstance();
}
示例4: precache
import org.chromium.chrome.browser.precache.PrecacheController; //導入依賴的package包/類
@VisibleForTesting
protected void precache(Context context, String tag) {
PrecacheController.get(context).precache(tag);
}
示例5: reschedulePrecacheTasksOnUpgrade
import org.chromium.chrome.browser.precache.PrecacheController; //導入依賴的package包/類
@VisibleForTesting
protected void reschedulePrecacheTasksOnUpgrade() {
PrecacheController.rescheduleTasksOnUpgrade(this);
}