Bug 888676 - NPE accessing mHealthRecorder in GeckoApp. r=nalexander

This commit is contained in:
Richard Newman 2013-07-02 12:08:09 -07:00
parent a50b5669ae
commit 14c62d3a68

View File

@ -556,9 +556,13 @@ abstract public class GeckoApp
geckoConnected();
// This method is already running on the background thread, so we
// know that mHealthRecorder will exist. This method is cheap, so
// don't spawn a new runnable.
mHealthRecorder.recordGeckoStartupTime(mGeckoReadyStartupTimer.getElapsed());
// know that mHealthRecorder will exist. That doesn't stop us being
// paranoid.
// This method is cheap, so don't spawn a new runnable.
final BrowserHealthRecorder rec = mHealthRecorder;
if (rec != null) {
rec.recordGeckoStartupTime(mGeckoReadyStartupTimer.getElapsed());
}
} else if (event.equals("ToggleChrome:Hide")) {
toggleChrome(false);
} else if (event.equals("ToggleChrome:Show")) {
@ -1529,7 +1533,10 @@ abstract public class GeckoApp
ThreadUtils.getBackgroundHandler().postDelayed(new Runnable() {
@Override
public void run() {
mHealthRecorder.recordJavaStartupTime(javaDuration);
final BrowserHealthRecorder rec = mHealthRecorder;
if (rec != null) {
rec.recordJavaStartupTime(javaDuration);
}
// Sync settings need Gecko to be loaded, so
// no hurry in starting this.
@ -1876,7 +1883,6 @@ abstract public class GeckoApp
// track the duration of the session.
final long now = System.currentTimeMillis();
final long realTime = android.os.SystemClock.elapsedRealtime();
final BrowserHealthRecorder rec = mHealthRecorder;
ThreadUtils.postToBackgroundThread(new Runnable() {
@Override
@ -1891,8 +1897,11 @@ abstract public class GeckoApp
currentSession.recordBegin(editor);
editor.commit();
final BrowserHealthRecorder rec = mHealthRecorder;
if (rec != null) {
rec.setCurrentSession(currentSession);
} else {
Log.w(LOGTAG, "Can't record session: rec is null.");
}
}
});