Bug 1352093 - Use an integer type for sNumLivingContexts that won't overflow when counting objects. r=mstange, a=ritu
authorMats Palmgren <mats@mozilla.com>
Wed, 03 May 2017 10:40:51 -0400
changeset 396146 fe9a9a0ccf2068090d0280ac6cacef710bd2cc3c
parent 396145 b7a8c7f7e088072112926bcfa9c8169643d9c9ec
child 396147 e664fb8bf2fd8f686c73cb61cdd58c0b16d4d739
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, ritu
bugs1352093
milestone54.0
Bug 1352093 - Use an integer type for sNumLivingContexts that won't overflow when counting objects. r=mstange, a=ritu MozReview-Commit-ID: 2w9y0flEdrX
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/CanvasRenderingContext2D.h
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -1074,17 +1074,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
 NS_INTERFACE_MAP_END
 
 /**
  ** CanvasRenderingContext2D impl
  **/
 
 
 // Initialize our static variables.
-uint32_t CanvasRenderingContext2D::sNumLivingContexts = 0;
+uintptr_t CanvasRenderingContext2D::sNumLivingContexts = 0;
 DrawTarget* CanvasRenderingContext2D::sErrorTarget = nullptr;
 static bool sMaxContextsInitialized = false;
 static int32_t sMaxContexts = 0;
 
 
 
 CanvasRenderingContext2D::CanvasRenderingContext2D(layers::LayersBackend aCompositorBackend)
   : mRenderingMode(RenderingMode::OpenGLBackendMode)
--- a/dom/canvas/CanvasRenderingContext2D.h
+++ b/dom/canvas/CanvasRenderingContext2D.h
@@ -572,17 +572,17 @@ protected:
 
   nsresult InitializeWithTarget(mozilla::gfx::DrawTarget* aSurface,
                                 int32_t aWidth, int32_t aHeight);
 
   /**
     * The number of living nsCanvasRenderingContexts.  When this goes down to
     * 0, we free the premultiply and unpremultiply tables, if they exist.
     */
-  static uint32_t sNumLivingContexts;
+  static uintptr_t sNumLivingContexts;
 
   static mozilla::gfx::DrawTarget* sErrorTarget;
 
   void SetTransformInternal(const mozilla::gfx::Matrix& aTransform);
 
   // Some helpers.  Doesn't modify a color on failure.
   void SetStyleFromUnion(const StringOrCanvasGradientOrCanvasPattern& aValue,
                          Style aWhichStyle);