Bug 1257667 - Pre: Allow retrieving GeckoApplication's RefWatcher for leak-spotting r=sebastian

MozReview-Commit-ID: GmGxDt72ljq
This commit is contained in:
Andrzej Hunt 2016-03-17 13:54:00 -07:00
Родитель 8294df13e7
Коммит 1df58c3516
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -12,6 +12,7 @@ import android.os.SystemClock;
import android.util.Log;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.db.BrowserDB;
@ -38,6 +39,8 @@ public class GeckoApplication extends Application
private LightweightTheme mLightweightTheme;
private RefWatcher mRefWatcher;
public GeckoApplication() {
super();
instance = this;
@ -47,6 +50,11 @@ public class GeckoApplication extends Application
return instance;
}
public static RefWatcher getRefWatcher(Context context) {
GeckoApplication app = (GeckoApplication) context.getApplicationContext();
return app.mRefWatcher;
}
@Override
public Context getContext() {
return this;
@ -128,7 +136,7 @@ public class GeckoApplication extends Application
public void onCreate() {
Log.i(LOG_TAG, "zerdatime " + SystemClock.uptimeMillis() + " - Fennec application start");
LeakCanary.install(this);
mRefWatcher = LeakCanary.install(this);
final Context context = getApplicationContext();
HardwareUtils.init(context);