Bug 736237 - Don't update about:home on database operations. r=lucasr
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Wed, 04 Apr 2012 21:29:31 +0200
changeset 94332 b6cc76f45b95e6637cf6fee180f52ab591d320a0
parent 94331 1540736ae9934dca9f2acc6fd77816a66ecc6df8
child 94333 02b15cf9157fb02b4132ed25b5009ac40dcf6812
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs736237
milestone14.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 736237 - Don't update about:home on database operations. r=lucasr
mobile/android/base/AboutHomeContent.java
mobile/android/base/GeckoApp.java
--- a/mobile/android/base/AboutHomeContent.java
+++ b/mobile/android/base/AboutHomeContent.java
@@ -725,16 +725,23 @@ public class AboutHomeContent extends Sc
                                      String[] from, int[] to) {
             super(context, layout, c, from, to);
         }
 
         @Override
         public int getCount() {
             return Math.min(super.getCount(), getNumberOfTopSites());
         }
+
+        @Override
+        protected void onContentChanged () {
+            // Don't do anything. We don't want to regenerate every time
+            // our history database is updated.
+            return;
+        }
     }
 
     class TopSitesViewBinder implements SimpleCursorAdapter.ViewBinder {
         private boolean updateThumbnail(View view, Cursor cursor, int thumbIndex) {
             byte[] b = cursor.getBlob(thumbIndex);
             ImageView thumbnail = (ImageView) view;
 
             if (b == null) {
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -719,28 +719,32 @@ abstract public class GeckoApp
                     mBrowserToolbar.setFavicon(tab.getFavicon());
                     mBrowserToolbar.setSecurityMode(tab.getSecurityMode());
                     mBrowserToolbar.setProgressVisibility(tab.getState() == Tab.STATE_LOADING);
                 }
             }
         });
     }
 
-    void handleClearHistory() {
+    void updateAboutHomeTopSites() {
         if (mAboutHomeContent == null)
             return;
 
         GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
             public void run() {
                 mAboutHomeContent.update(GeckoApp.mAppContext,
                         EnumSet.of(AboutHomeContent.UpdateFlags.TOP_SITES));
             }
         });
     }
 
+    void handleClearHistory() {
+        updateAboutHomeTopSites();
+    }
+
     public StartupMode getStartupMode() {
         // This function might touch the disk and should not
         // be called from UI's main thread.
 
         synchronized(this) {
             if (mStartupMode != null)
                 return mStartupMode;
 
@@ -2280,23 +2284,28 @@ abstract public class GeckoApp
         File profileDir = getProfile().getDir();
         long currentTime = SystemClock.uptimeMillis();
 
         if (profileDir != null) {
             Log.i(LOGTAG, "checking profile migration in: " + profileDir.getAbsolutePath());
             final GeckoApp app = GeckoApp.mAppContext;
             ProfileMigrator profileMigrator =
                 new ProfileMigrator(app.getContentResolver(), profileDir);
+
             // Do a migration run on the first start after an upgrade.
             if (!profileMigrator.hasMigrationRun()) {
                 final SetupScreen setupScreen = new SetupScreen(app);
+
                 // don't show unless this take a while
                 setupScreen.showDelayed(mMainHandler);
                 profileMigrator.launch();
                 setupScreen.dismiss();
+
+                // Update about:home with the new information.
+                updateAboutHomeTopSites();
             }
         }
         long timeDiff = SystemClock.uptimeMillis() - currentTime;
         Log.i(LOGTAG, "Profile migration took " + timeDiff + " ms");
     }
 
     /**
      * The FilePickerPromptRunnable has to be called to show an intent-like