Bug 835641: Don't SendUpdateDimensions() when they haven't changed. r=roc
authorChris Jones <jones.chris.g@gmail.com>
Mon, 28 Jan 2013 23:49:38 -0800
changeset 120169 a24051aa1b468405d4c474c324941007cfd037ca
parent 120168 126481a3ca242bb5f116d197dd2b56d2ce37081f
child 120170 bc2bbe9836c7c40eedca35e79d4f73974736e20d
push id24239
push userryanvm@gmail.com
push dateTue, 29 Jan 2013 14:36:31 +0000
treeherdermozilla-central@d3a5e1de98b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs835641
milestone21.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 835641: Don't SendUpdateDimensions() when they haven't changed. r=roc
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -80,19 +80,22 @@ TabParent::TabParent(const TabContext& a
   , mFrameElement(NULL)
   , mIMESelectionAnchor(0)
   , mIMESelectionFocus(0)
   , mIMEComposing(false)
   , mIMECompositionEnding(false)
   , mIMECompositionStart(0)
   , mIMESeqno(0)
   , mEventCaptureDepth(0)
+  , mRect(0, 0, 0, 0)
   , mDimensions(0, 0)
+  , mOrientation(0)
   , mDPI(0)
   , mShown(false)
+  , mUpdatedDimensions(false)
   , mMarkedDestroying(false)
   , mIsDestroyed(false)
 {
 }
 
 TabParent::~TabParent()
 {
 }
@@ -260,22 +263,30 @@ TabParent::Show(const nsIntSize& size)
 void
 TabParent::UpdateDimensions(const nsRect& rect, const nsIntSize& size)
 {
   if (mIsDestroyed) {
     return;
   }
   hal::ScreenConfiguration config;
   hal::GetCurrentScreenConfiguration(&config);
+  ScreenOrientation orientation = config.orientation();
 
-  unused << SendUpdateDimensions(rect, size, config.orientation());
-  if (RenderFrameParent* rfp = GetRenderFrame()) {
-    rfp->NotifyDimensionsChanged(size.width, size.height);
+  if (!mUpdatedDimensions || mOrientation != orientation ||
+      mDimensions != size || !mRect.IsEqualEdges(rect)) {
+    mUpdatedDimensions = true;
+    mRect = rect;
+    mDimensions = size;
+    mOrientation = orientation;
+
+    unused << SendUpdateDimensions(mRect, mDimensions, mOrientation);
+    if (RenderFrameParent* rfp = GetRenderFrame()) {
+      rfp->NotifyDimensionsChanged(mDimensions.width, mDimensions.height);
+    }
   }
-  mDimensions = size;
 }
 
 void
 TabParent::UpdateFrame(const FrameMetrics& aFrameMetrics)
 {
   if (!mIsDestroyed) {
     unused << SendUpdateFrame(aFrameMetrics);
   }
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -271,19 +271,22 @@ protected:
     // Compositions in almost all cases are small enough for nsAutoString
     nsAutoString mIMECompositionText;
     uint32_t mIMECompositionStart;
     uint32_t mIMESeqno;
 
     // The number of event series we're currently capturing.
     int32_t mEventCaptureDepth;
 
+    nsRect mRect;
     nsIntSize mDimensions;
+    ScreenOrientation mOrientation;
     float mDPI;
     bool mShown;
+    bool mUpdatedDimensions;
 
 private:
     already_AddRefed<nsFrameLoader> GetFrameLoader() const;
     already_AddRefed<nsIWidget> GetWidget() const;
     layout::RenderFrameParent* GetRenderFrame();
     void TryCacheDPI();
 
     // When true, we create a pan/zoom controller for our frame and