Bug 715836 - Ensure the UI is only modified from the UI thread. r=pcwalton
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 13 Jan 2012 07:03:22 -0500
changeset 85638 157c86d30692cd09b572cf03628e1439f9544963
parent 85637 317592537ff6226d89d776d62135ff6263ea494f
child 85639 d13c738c54ce627f0091580a5825f037c9652a83
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspcwalton
bugs715836
milestone12.0a1
Bug 715836 - Ensure the UI is only modified from the UI thread. r=pcwalton
mobile/android/base/gfx/LayerController.java
--- a/mobile/android/base/gfx/LayerController.java
+++ b/mobile/android/base/gfx/LayerController.java
@@ -207,17 +207,23 @@ public class LayerController {
      * Sets the entire viewport metrics at once. This function does not notify the layer client or
      * the pan/zoom controller, so you will need to call notifyLayerClientOfGeometryChange() or
      * notifyPanZoomControllerOfGeometryChange() after calling this. You must hold the monitor
      * while calling this.
      */
     public void setViewportMetrics(ViewportMetrics viewport) {
         mViewportMetrics = new ViewportMetrics(viewport);
         Log.d(LOGTAG, "setViewportMetrics: " + mViewportMetrics);
-        GeckoApp.mAppContext.repositionPluginViews(false);
+        // this function may or may not be called on the UI thread,
+        // but repositionPluginViews must only be called on the UI thread.
+        GeckoApp.mAppContext.runOnUiThread(new Runnable() {
+            public void run() {
+                GeckoApp.mAppContext.repositionPluginViews(false);
+            }
+        });
         mView.requestRender();
     }
 
     /**
      * Scales the viewport, keeping the given focus point in the same place before and after the
      * scale operation. You must hold the monitor while calling this.
      */
     public void scaleWithFocus(float zoomFactor, PointF focus) {