Bug 758635 - Move a call to resizeView so that we don't send two resize events to gecko when the keyboard comes up. r=jrmuizel
authorKartikaya Gupta <kgupta@mozilla.com>
Sun, 03 Jun 2012 17:50:00 -0400
changeset 95714 3b1d53c1f729d330e76992706f7c641d8ee16efd
parent 95713 6c7d83e5cb2b8b16180b4dcbdc5a13df0adbe8e2
child 95715 9896fdad513eeb7cd3a86f37caa18826202ba88f
push id22837
push usereakhgari@mozilla.com
push dateMon, 04 Jun 2012 15:31:50 +0000
treeherdermozilla-central@fc94f4339da7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs758635
milestone15.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 758635 - Move a call to resizeView so that we don't send two resize events to gecko when the keyboard comes up. r=jrmuizel
mobile/android/base/gfx/GLController.java
mobile/android/base/gfx/LayerRenderer.java
--- a/mobile/android/base/gfx/GLController.java
+++ b/mobile/android/base/gfx/GLController.java
@@ -99,34 +99,37 @@ public class GLController {
     synchronized void surfaceDestroyed() {
         mSurfaceValid = false;
         notifyAll();
     }
 
     synchronized void surfaceChanged(int newWidth, int newHeight) {
         mWidth = newWidth;
         mHeight = newHeight;
-        mView.getRenderer().resizeView(mWidth, mHeight);
         mSurfaceValid = true;
         notifyAll();
     }
 
     private void initEGL() {
         mEGL = (EGL10)EGLContext.getEGL();
 
         mEGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
         if (mEGLDisplay == EGL10.EGL_NO_DISPLAY) {
             throw new GLControllerException("eglGetDisplay() failed");
         }
 
         mEGLConfig = chooseConfig();
 
-        if (mView.getRenderer() != null) {
-            mView.getRenderer().resizeView(mWidth, mHeight);
-        }
+        // updating the state in the view/controller/client should be
+        // done on the main UI thread, not the GL renderer thread
+        mView.post(new Runnable() {
+            public void run() {
+                mView.setViewportSize(new IntSize(mWidth, mHeight));
+            }
+        });
     }
 
     private EGLConfig chooseConfig() {
         int[] numConfigs = new int[1];
         if (!mEGL.eglChooseConfig(mEGLDisplay, CONFIG_SPEC, null, 0, numConfigs) ||
                 numConfigs[0] <= 0) {
             throw new GLControllerException("No available EGL configurations " +
                                             getEGLError());
--- a/mobile/android/base/gfx/LayerRenderer.java
+++ b/mobile/android/base/gfx/LayerRenderer.java
@@ -308,28 +308,16 @@ public class LayerRenderer {
         return createContext(new RectF(viewport), pageRect, zoomFactor);
     }
 
     private RenderContext createContext(RectF viewport, RectF pageRect, float zoomFactor) {
         return new RenderContext(viewport, pageRect, zoomFactor, mPositionHandle, mTextureHandle,
                                  mCoordBuffer);
     }
 
-    public void resizeView(final int width, final int height) {
-        // updating the state in the view/controller/client should be
-        // done on the main UI thread, not the GL renderer thread
-        mView.post(new Runnable() {
-            public void run() {
-                mView.setViewportSize(new IntSize(width, height));
-            }
-        });
-
-        /* TODO: Throw away tile images? */
-    }
-
     private void updateDroppedFrames(long frameStartTime) {
         int frameElapsedTime = (int)(SystemClock.uptimeMillis() - frameStartTime);
 
         /* Update the running statistics. */
         mFrameTimingsSum -= mFrameTimings[mCurrentFrame];
         mFrameTimingsSum += frameElapsedTime;
         mDroppedFrames -= (mFrameTimings[mCurrentFrame] + 1) / MAX_FRAME_TIME;
         mDroppedFrames += (frameElapsedTime + 1) / MAX_FRAME_TIME;