зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1325112 - 2. Purge caches in debug geckoview_example; r=rbarker
Preload Gecko with the "-purgecaches" flag in debug builds of geckoview_example, similar to what we do for Fennec. MozReview-Commit-ID: dBZgBbDUQ9
This commit is contained in:
Родитель
cf5d7c70ea
Коммит
e53a5e57a0
|
@ -284,16 +284,30 @@ public class GeckoView extends LayerView
|
|||
init(context, newSettings);
|
||||
}
|
||||
|
||||
public static final void preload(Context context) {
|
||||
final GeckoProfile profile = GeckoProfile.get(
|
||||
context.getApplicationContext());
|
||||
/**
|
||||
* Preload GeckoView by starting Gecko in the background, if Gecko is not already running.
|
||||
*
|
||||
* @param context Activity or Application Context for starting GeckoView.
|
||||
*/
|
||||
public static void preload(final Context context) {
|
||||
preload(context, /* geckoArgs */ null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Preload GeckoView by starting Gecko with the specified arguments in the background,
|
||||
* if Geckois not already running.
|
||||
*
|
||||
* @param context Activity or Application Context for starting GeckoView.
|
||||
* @param geckoArgs Arguments to be passed to Gecko, if Gecko is not already running
|
||||
*/
|
||||
public static void preload(final Context context, final String geckoArgs) {
|
||||
final Context appContext = context.getApplicationContext();
|
||||
if (GeckoAppShell.getApplicationContext() == null) {
|
||||
GeckoAppShell.setApplicationContext(context.getApplicationContext());
|
||||
GeckoAppShell.setApplicationContext(appContext);
|
||||
}
|
||||
|
||||
if (GeckoThread.initMainProcess(profile,
|
||||
/* args */ null,
|
||||
if (GeckoThread.initMainProcess(GeckoProfile.get(appContext),
|
||||
geckoArgs,
|
||||
/* debugging */ false)) {
|
||||
GeckoThread.launch();
|
||||
}
|
||||
|
|
|
@ -31,6 +31,11 @@ public class GeckoViewActivity extends Activity {
|
|||
Log.i(LOGTAG, "zerdatime " + SystemClock.elapsedRealtime() +
|
||||
" - application start");
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
// In debug builds, we want to load JavaScript resources fresh with each build.
|
||||
GeckoView.preload(this, "-purgecaches");
|
||||
}
|
||||
|
||||
setContentView(R.layout.geckoview_activity);
|
||||
|
||||
mGeckoView = (GeckoView) findViewById(R.id.gecko_view);
|
||||
|
|
Загрузка…
Ссылка в новой задаче