Bug 1072313: P2 Prevent instanciating MacIOSurfaceLib directly. r=mattwoodrow a=lizzard
authorJean-Yves Avenard <jyavenard@mozilla.com>
Wed, 23 Sep 2015 13:34:40 +0200
changeset 296237 6fda011396e29dbc62e7e87a508f2fc2f181dd9f
parent 296236 0fca8425e231ec11ec5cfc736751db0d98a05e48
child 296238 17e945dc4f4ab5540a764725c655a4765de0a9a8
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, lizzard
bugs1072313
milestone43.0a2
Bug 1072313: P2 Prevent instanciating MacIOSurfaceLib directly. r=mattwoodrow a=lizzard
gfx/2d/MacIOSurface.h
--- a/gfx/2d/MacIOSurface.h
+++ b/gfx/2d/MacIOSurface.h
@@ -57,17 +57,17 @@ enum CGContextType {
   CG_CONTEXT_TYPE_UNKNOWN = 0,
   // These are found by inspection, it's possible they could be changed
   CG_CONTEXT_TYPE_BITMAP = 4,
   CG_CONTEXT_TYPE_IOSURFACE = 8
 };
 
 CGContextType GetContextType(CGContextRef ref);
 
-class MacIOSurface : public mozilla::external::AtomicRefCounted<MacIOSurface> {
+class MacIOSurface final : public mozilla::external::AtomicRefCounted<MacIOSurface> {
 public:
   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(MacIOSurface)
   typedef mozilla::gfx::SourceSurface SourceSurface;
 
   // The usage count of the IOSurface is increased by 1 during the lifetime
   // of the MacIOSurface instance.
   // MacIOSurface holds a reference to the corresponding IOSurface.
 
@@ -77,17 +77,17 @@ public:
   static void ReleaseIOSurface(MacIOSurface *aIOSurface);
   static already_AddRefed<MacIOSurface> LookupSurface(IOSurfaceID aSurfaceID,
                                                            double aContentsScaleFactor = 1.0,
                                                            bool aHasAlpha = true);
 
   explicit MacIOSurface(const void *aIOSurfacePtr,
                         double aContentsScaleFactor = 1.0,
                         bool aHasAlpha = true);
-  virtual ~MacIOSurface();
+  ~MacIOSurface();
   IOSurfaceID GetIOSurfaceID();
   void *GetBaseAddress();
   void *GetBaseAddressOfPlane(size_t planeIndex);
   size_t GetPlaneCount();
   OSType GetPixelFormat();
   // GetWidth() and GetHeight() return values in "display pixels".  A
   // "display pixel" is the smallest fully addressable part of a display.
   // But in HiDPI modes each "display pixel" corresponds to more than one
@@ -120,19 +120,19 @@ public:
 
 private:
   friend class nsCARenderer;
   const void* mIOSurfacePtr;
   double mContentsScaleFactor;
   bool mHasAlpha;
 };
 
-class MacIOSurfaceLib: public MacIOSurface {
+class MacIOSurfaceLib {
 public:
-  MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(MacIOSurfaceLib)
+  MacIOSurfaceLib() = delete;
   static void                        *sIOSurfaceFramework;
   static void                        *sOpenGLFramework;
   static void                        *sCoreGraphicsFramework;
   static void                        *sCoreVideoFramework;
   static bool                         isLoaded;
   static IOSurfaceCreateFunc          sCreate;
   static IOSurfaceGetIDFunc           sGetID;
   static IOSurfaceLookupFunc          sLookup;