OSDN Git Service

Do not call invalidate() in draw(). This improved
authorGrace Kloba <klobag@google.com>
Thu, 18 Mar 2010 04:11:15 +0000 (21:11 -0700)
committerGrace Kloba <klobag@google.com>
Thu, 18 Mar 2010 05:48:20 +0000 (22:48 -0700)
Browser loading performance by 10%. Loading nytimes.com
on Sholes with plugin dropped from 30s to 26s.

As FakedTitleBar is shown while a page is loading,
there is no need to update the WebView TitleBar's
progress which is always behind.This improved Browser
loading performance by another 10%. Loading nytimes.com
on Sholes with plugin dropped from 26s to 23s.

Fix http://b/issue?id=2520517

src/com/android/browser/BrowserActivity.java

index 4c8fc5c..2012f61 100644 (file)
@@ -214,6 +214,8 @@ public class BrowserActivity extends Activity
                 .findViewById(R.id.fullscreen_custom_content);
         frameLayout.addView(mBrowserFrameLayout, COVER_SCREEN_PARAMS);
         mTitleBar = new TitleBar(this);
+        // mTitleBar will be always shown in the fully loaded mode
+        mTitleBar.setProgress(100);
         mFakeTitleBar = new TitleBar(this);
 
         // Create the tab control and our initial tab
@@ -832,9 +834,6 @@ public class BrowserActivity extends Activity
             if (mWebView == null || mWebView.getScrollY() > getHeight()) {
                 super.draw(canvas);
             }
-            // Need to invalidate so that if the scroll position changes, we
-            // still draw as appropriate.
-            invalidate();
         }
     }
 
@@ -2659,7 +2658,6 @@ public class BrowserActivity extends Activity
     // -------------------------------------------------------------------------
 
     void onProgressChanged(WebView view, int newProgress) {
-        mTitleBar.setProgress(newProgress);
         mFakeTitleBar.setProgress(newProgress);
 
         if (newProgress == 100) {