Bug 1460874 - Part 3: Rename initalize() method for more clarity. r=geckoview-reviewers,snorp
☠☠ backed out by cd616c3e3eea ☠ ☠
authorJan Henning <jh+bugzilla@buttercookie.de>
Wed, 13 Feb 2019 20:10:11 +0000
changeset 458945 c7fce6c79bef
parent 458944 d42e39761eb8
child 458946 02f24dec5ae4
push id35552
push usershindli@mozilla.com
push dateThu, 14 Feb 2019 04:39:44 +0000
treeherdermozilla-central@c6829642e2d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeckoview-reviewers, snorp
bugs1460874
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1460874 - Part 3: Rename initalize() method for more clarity. r=geckoview-reviewers,snorp Going forward, we want to be able to toggle the enabled state at all times, and being able to do this before calling initialize() seems a bit inconsistent. Hence, we rename it to the more neutral-sounding attachToContext(). Differential Revision: https://phabricator.services.mozilla.com/D17745
mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
mobile/android/base/java/org/mozilla/gecko/GeckoFontScaleListener.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
@@ -207,17 +207,17 @@ public class GeckoApplication extends Ap
         });
 
         GeckoNetworkManager.getInstance().stop();
     }
 
     public void onApplicationForeground() {
         if (mIsInitialResume) {
             GeckoBatteryManager.getInstance().start(this);
-            GeckoFontScaleListener.getInstance().initialize(this);
+            GeckoFontScaleListener.getInstance().attachToContext(this);
             GeckoNetworkManager.getInstance().start(this);
             mIsInitialResume = false;
         } else if (mPausedGecko) {
             GeckoThread.onResume();
             mPausedGecko = false;
             GeckoNetworkManager.getInstance().start(this);
         }
 
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoFontScaleListener.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoFontScaleListener.java
@@ -28,50 +28,50 @@ class GeckoFontScaleListener
     private static final int FONT_INFLATION_ON_DEFAULT_VALUE = 120;
     private static final float DEFAULT_FONT_SCALE = 1.0f;
 
     // We're referencing the *application* context, so this is in fact okay.
     @SuppressLint("StaticFieldLeak")
     private static final GeckoFontScaleListener sInstance = new GeckoFontScaleListener();
 
     private Context mApplicationContext;
-    private boolean mInitialized;
+    private boolean mAttached;
     private boolean mRunning;
 
     public static GeckoFontScaleListener getInstance() {
         return sInstance;
     }
 
     private GeckoFontScaleListener() {
         super(null);
     }
 
-    public synchronized void initialize(final Context context) {
-        if (mInitialized) {
-            Log.w(LOGTAG, "Already initialized!");
+    public synchronized void attachToContext(final Context context) {
+        if (mAttached) {
+            Log.w(LOGTAG, "Already attached!");
             return;
         }
 
         mApplicationContext = context.getApplicationContext();
         SharedPreferences prefs = GeckoSharedPrefs.forApp(mApplicationContext);
         prefs.registerOnSharedPreferenceChangeListener(this);
         onPrefChange(prefs);
-        mInitialized = true;
+        mAttached = true;
     }
 
-    public synchronized void shutdown() {
-        if (!mInitialized) {
-            Log.w(LOGTAG, "Already shut down!");
+    public synchronized void detachFromContext() {
+        if (!mAttached) {
+            Log.w(LOGTAG, "Already detached!");
             return;
         }
 
         GeckoSharedPrefs.forApp(mApplicationContext).unregisterOnSharedPreferenceChangeListener(this);
         stop();
         mApplicationContext = null;
-        mInitialized = false;
+        mAttached = false;
     }
 
     private synchronized void start() {
         if (mRunning) {
             return;
         }
 
         ContentResolver contentResolver = mApplicationContext.getContentResolver();