mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 880171 - Part 2: handle failure to retrieve storage from EnvironmentBuilder. r=nalexander
This commit is contained in:
parent
d709778bb9
commit
17b7e70961
@ -84,9 +84,10 @@ public class BrowserHealthRecorder implements GeckoEventListener {
|
||||
|
||||
private final AtomicBoolean orphanChecked = new AtomicBoolean(false);
|
||||
private volatile int env = -1;
|
||||
|
||||
private ContentProviderClient client;
|
||||
private volatile HealthReportDatabaseStorage storage;
|
||||
private final ProfileInformationCache profileCache;
|
||||
private ContentProviderClient client;
|
||||
private final EventDispatcher dispatcher;
|
||||
|
||||
public static class SessionInformation {
|
||||
@ -238,7 +239,12 @@ public class BrowserHealthRecorder implements GeckoEventListener {
|
||||
|
||||
this.storage = EnvironmentBuilder.getStorage(this.client, profilePath);
|
||||
if (this.storage == null) {
|
||||
throw new IllegalStateException("No storage in health recorder!");
|
||||
// Stick around even if we don't have storage: eventually we'll
|
||||
// want to report total failures of FHR storage itself, and this
|
||||
// way callers don't need to worry about whether their health
|
||||
// recorder didn't initialize.
|
||||
this.client.release();
|
||||
this.client = null;
|
||||
}
|
||||
|
||||
this.profileCache = new ProfileInformationCache(profilePath);
|
||||
@ -334,6 +340,10 @@ public class BrowserHealthRecorder implements GeckoEventListener {
|
||||
if (this.env != -1) {
|
||||
return this.env;
|
||||
}
|
||||
if (this.storage == null) {
|
||||
// Oh well.
|
||||
return -1;
|
||||
}
|
||||
return this.env = EnvironmentBuilder.registerCurrentEnvironment(this.storage,
|
||||
this.profileCache);
|
||||
}
|
||||
@ -467,6 +477,9 @@ public class BrowserHealthRecorder implements GeckoEventListener {
|
||||
// Belt and braces.
|
||||
if (storage == null) {
|
||||
Log.w(LOG_TAG, "Storage is null during init; shutting down?");
|
||||
if (state == State.INITIALIZING) {
|
||||
state = State.INITIALIZATION_FAILED;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user