зеркало из https://github.com/mozilla/gecko-dev.git
Bug 960709 - Part 4: Use HealthRecorder.isEnabled to make StubbedHealthRecorder use more efficient. r=rnewman
This commit is contained in:
Родитель
f37d0f3ab9
Коммит
aefdac2abf
|
@ -2594,7 +2594,7 @@ abstract public class BrowserApp extends GeckoApp
|
|||
final EventDispatcher dispatcher,
|
||||
final String osLocale,
|
||||
final String appLocale,
|
||||
SessionInformation previousSession) {
|
||||
final SessionInformation previousSession) {
|
||||
return new BrowserHealthRecorder(context,
|
||||
profilePath,
|
||||
dispatcher,
|
||||
|
|
|
@ -2117,7 +2117,7 @@ public abstract class GeckoApp
|
|||
|
||||
final HealthRecorder rec = mHealthRecorder;
|
||||
mHealthRecorder = null;
|
||||
if (rec != null) {
|
||||
if (rec != null && rec.isEnabled()) {
|
||||
// Closing a BrowserHealthRecorder could incur a write.
|
||||
ThreadUtils.postToBackgroundThread(new Runnable() {
|
||||
@Override
|
||||
|
@ -2834,7 +2834,7 @@ public abstract class GeckoApp
|
|||
final EventDispatcher dispatcher,
|
||||
final String osLocale,
|
||||
final String appLocale,
|
||||
SessionInformation previousSession) {
|
||||
final SessionInformation previousSession) {
|
||||
// GeckoApp does not need to record any health information - return a stub.
|
||||
return new StubbedHealthRecorder();
|
||||
}
|
||||
|
|
|
@ -168,6 +168,10 @@ public class BrowserHealthRecorder implements HealthRecorder, GeckoEventListener
|
|||
}
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shut down database connections, unregister event listeners, and perform
|
||||
* provider-specific uninitialization.
|
||||
|
|
|
@ -13,6 +13,11 @@ import org.json.JSONObject;
|
|||
* HealthRecorder is an interface into the Firefox Health Report storage system.
|
||||
*/
|
||||
public interface HealthRecorder {
|
||||
/**
|
||||
* Returns whether the Health Recorder is actively recording events.
|
||||
*/
|
||||
public boolean isEnabled();
|
||||
|
||||
public void setCurrentSession(SessionInformation session);
|
||||
public void checkForOrphanSessions();
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ import org.json.JSONObject;
|
|||
* nothing.
|
||||
*/
|
||||
public class StubbedHealthRecorder implements HealthRecorder {
|
||||
public boolean isEnabled() { return false; }
|
||||
|
||||
public void setCurrentSession(SessionInformation session) { }
|
||||
public void checkForOrphanSessions() { }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче