We were allocating and re-allocating a view-sized buffer and then claiming it was 32x32. Cut that down to stop wastage. Also drop unused method.
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 24 Feb 2012 12:11:32 -0500
changeset 89248 bcc2d71384aed19aaf61f348bef51973397ad584
parent 89247 cd1291b1f66cbdcf3627a00aa8a57d3a4c02094b
child 89249 4a8ec32c2606377b441966c25ddbc1ad7d8f4de9
push id22242
push userkgupta@mozilla.com
push dateWed, 14 Mar 2012 15:19:09 +0000
treeherdermozilla-central@936ef50fa498 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone13.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
We were allocating and re-allocating a view-sized buffer and then claiming it was 32x32. Cut that down to stop wastage. Also drop unused method.
widget/android/nsWindow.cpp
widget/android/nsWindow.h
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -818,28 +818,16 @@ nsWindow::GetLayerManager(PLayersChild*,
 
                 mLayerManager = CreateBasicLayerManager();
         }
     }
 
     return mLayerManager;
 }
 
-gfxASurface*
-nsWindow::GetThebesSurface()
-{
-    /* This is really a dummy surface; this is only used when doing reflow, because
-     * we need a RenderingContext to measure text against.
-     */
-
-    // XXX this really wants to return already_AddRefed, but this only really gets used
-    // on direct assignment to a gfxASurface
-    return new gfxImageSurface(gfxIntSize(5,5), gfxImageSurface::ImageFormatRGB24);
-}
-
 void
 nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
 {
     if (!AndroidBridge::Bridge())
         return;
 
     nsWindow *win = TopWindow();
     if (!win)
@@ -1178,26 +1166,17 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae)
 
 #if 0
     // BEGIN HACK: gl layers
     nsPaintEvent event(true, NS_PAINT, this);
     nsIntRect tileRect(0, 0, gAndroidBounds.width, gAndroidBounds.height);
     event.region = tileRect;
 #endif
 
-    static unsigned char *bits2 = NULL;
-    static gfxIntSize bitsSize(0, 0);
-    if (bitsSize.width != gAndroidBounds.width || bitsSize.height != gAndroidBounds.height) {
-        if (bits2) {
-            delete[] bits2;
-        }
-        bits2 = new unsigned char[gAndroidBounds.width * gAndroidBounds.height * 2];
-        bitsSize = gAndroidBounds;
-    }
-
+    static unsigned char *bits2 = new unsigned char[32 * 32 * 2];
     nsRefPtr<gfxImageSurface> targetSurface =
         new gfxImageSurface(bits2, gfxIntSize(32, 32), 32 * 2,
                             gfxASurface::ImageFormatRGB16_565);
 
 #if 0
     nsRefPtr<gfxContext> ctx = new gfxContext(targetSurface);
     AutoLayerManagerSetup setupLayerManager(this, ctx, BasicLayerManager::BUFFER_NONE);
 
@@ -1212,18 +1191,16 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae)
 
     AndroidGeckoLayerClient &client = AndroidBridge::Bridge()->GetLayerClient();
     if (!client.BeginDrawing(gAndroidBounds.width, gAndroidBounds.height,
                              dirtyRect, metadata)) {
         __android_log_print(ANDROID_LOG_ERROR, "Gecko", "### BeginDrawing returned false!");
         return;
     }
 
-    unsigned char *bits = NULL;
-
     if (targetSurface->CairoStatus()) {
         ALOG("### Failed to create a valid surface from the bitmap");
     } else {
         __android_log_print(ANDROID_LOG_ERROR, "Gecko", "### Calling DrawTo()!");
         DrawTo(targetSurface, dirtyRect);
     }
 
     __android_log_print(ANDROID_LOG_ERROR, "Gecko", "### Calling EndDrawing()!");
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -168,17 +168,16 @@ public:
     NS_IMETHOD OnIMETextChange(PRUint32 aStart, PRUint32 aOldEnd, PRUint32 aNewEnd);
     NS_IMETHOD OnIMESelectionChange(void);
     virtual nsIMEUpdatePreference GetIMEUpdatePreference();
 
     LayerManager* GetLayerManager (PLayersChild* aShadowManager = nsnull, 
                                    LayersBackend aBackendHint = LayerManager::LAYERS_NONE, 
                                    LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, 
                                    bool* aAllowRetaining = nsnull);
-    gfxASurface* GetThebesSurface();
 
     NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
 
 #ifdef ACCESSIBILITY
     static bool sAccessibilityEnabled;
 #endif
 
 #ifdef MOZ_JAVA_COMPOSITOR