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