Bug 1258481 - Use RegionBuilder for nsRegion IPC. r=jrmuizel
☠☠ backed out by af8f8a484581 ☠ ☠
authorBenoit Girard <b56girard@gmail.com>
Wed, 23 Mar 2016 11:36:53 -0400
changeset 290071 8e7a8791854f07b4134f88cf97079f353d9b2fb5
parent 290070 5e60a574fcec34b325090b82917e98c5bc5b623b
child 290072 c3c85d59ec72519765722caf648c4abfe30179ed
push id30114
push usercbook@mozilla.com
push dateThu, 24 Mar 2016 15:15:54 +0000
treeherdermozilla-central@24c5fbde4488 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1258481
milestone48.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 1258481 - Use RegionBuilder for nsRegion IPC. r=jrmuizel MozReview-Commit-ID: 6Ma8sVkfeuj
gfx/ipc/GfxMessageUtils.h
gfx/src/nsRegion.h
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -2,35 +2,35 @@
 /* vim: set sw=2 ts=8 et tw=80 : */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __GFXMESSAGEUTILS_H__
 #define __GFXMESSAGEUTILS_H__
 
+#include "FilterSupport.h"
+#include "FrameMetrics.h"
+#include "ImageTypes.h"
+#include "RegionBuilder.h"
 #include "base/process_util.h"
 #include "chrome/common/ipc_message_utils.h"
-#include "ipc/IPCMessageUtils.h"
-
-#include <stdint.h>
-
-#include "mozilla/gfx/Matrix.h"
 #include "gfxPoint.h"
 #include "gfxRect.h"
+#include "gfxTypes.h"
+#include "ipc/IPCMessageUtils.h"
+#include "mozilla/gfx/Matrix.h"
+#include "mozilla/layers/AsyncDragMetrics.h"
+#include "mozilla/layers/CompositorTypes.h"
+#include "mozilla/layers/GeckoContentController.h"
+#include "mozilla/layers/LayersTypes.h"
 #include "nsRect.h"
 #include "nsRegion.h"
-#include "gfxTypes.h"
-#include "mozilla/layers/AsyncDragMetrics.h"
-#include "mozilla/layers/LayersTypes.h"
-#include "mozilla/layers/CompositorTypes.h"
-#include "ImageTypes.h"
-#include "FrameMetrics.h"
-#include "FilterSupport.h"
-#include "mozilla/layers/GeckoContentController.h"
+
+#include <stdint.h>
 
 #ifdef _MSC_VER
 #pragma warning( disable : 4800 )
 #endif
 
 namespace mozilla {
 
 typedef gfxImageFormat PixelFormat;
@@ -362,34 +362,39 @@ struct ParamTraits<mozilla::gfx::IntSize
 
 template<typename Region, typename Rect, typename Iter>
 struct RegionParamTraits
 {
   typedef Region paramType;
 
   static void Write(Message* msg, const paramType& param)
   {
+
     for (auto iter = param.RectIter(); !iter.Done(); iter.Next()) {
       const Rect& r = iter.Get();
       MOZ_RELEASE_ASSERT(!r.IsEmpty());
       WriteParam(msg, r);
     }
     // empty rects are sentinel values because nsRegions will never
     // contain them
     WriteParam(msg, Rect());
   }
 
   static bool Read(const Message* msg, void** iter, paramType* result)
   {
+    RegionBuilder<Region> builder;
     Rect rect;
     while (ReadParam(msg, iter, &rect)) {
-      if (rect.IsEmpty())
+      if (rect.IsEmpty()) {
+        *result = builder.ToRegion();
         return true;
-      result->Or(*result, rect);
+      }
+      builder.Or(rect);
     }
+
     return false;
   }
 };
 
 template<class Units>
 struct ParamTraits<mozilla::gfx::IntRegionTyped<Units>>
   : RegionParamTraits<mozilla::gfx::IntRegionTyped<Units>,
                       mozilla::gfx::IntRectTyped<Units>,
--- a/gfx/src/nsRegion.h
+++ b/gfx/src/nsRegion.h
@@ -826,17 +826,17 @@ class IntRegionTyped :
 public:
   typedef IntRectTyped<units> RectType;
   typedef IntPointTyped<units> PointType;
   typedef IntMarginTyped<units> MarginType;
 
   // Forward constructors.
   IntRegionTyped() {}
   MOZ_IMPLICIT IntRegionTyped(const IntRectTyped<units>& aRect) : Super(aRect) {}
-  IntRegionTyped(const IntRegionTyped& aRegion) : Super(aRegion) {}
+  explicit IntRegionTyped(const IntRegionTyped& aRegion) : Super(aRegion) {}
   IntRegionTyped(const nsTArray<pixman_box32_t>& aRects) : Super(aRects) {}
   IntRegionTyped(IntRegionTyped&& aRegion) : Super(mozilla::Move(aRegion)) {}
 
   // Assignment operators need to be forwarded as well, otherwise the compiler
   // will declare deleted ones.
   IntRegionTyped& operator=(const IntRegionTyped& aRegion)
   {
     return Super::operator=(aRegion);