Bug 1426329 - Reduce includes of GLContext.h in headers. - r=lenzak draft
authorJeff Gilbert <jgilbert@mozilla.com>
Wed, 20 Dec 2017 00:43:11 -0800
changeset 713386 d4dd62e364e38990bddb6dc8bd89f63c8859c553
parent 713235 1624b88874765bf57e9feba176d30149c748d9d2
child 744331 d998d9b4d5e8e110722c84764ed9e25daf89f826
push id93640
push userbmo:jgilbert@mozilla.com
push dateWed, 20 Dec 2017 09:36:07 +0000
reviewerslenzak
bugs1426329
milestone59.0a1
Bug 1426329 - Reduce includes of GLContext.h in headers. - r=lenzak MozReview-Commit-ID: LPrK3ghNI5f
gfx/gl/GLLibraryEGL.h
gfx/gl/GLTypes.h
gfx/gl/SharedSurface.cpp
gfx/gl/SharedSurface.h
gfx/vr/ipc/VRLayerChild.h
widget/android/AndroidCompositorWidget.h
--- a/gfx/gl/GLLibraryEGL.h
+++ b/gfx/gl/GLLibraryEGL.h
@@ -13,42 +13,26 @@
 #include "mozilla/StaticMutex.h"
 #include "mozilla/ThreadLocal.h"
 #include "nsIFile.h"
 #include "GeckoProfiler.h"
 
 #include <bitset>
 #include <vector>
 
-#ifdef XP_WIN
-    #ifndef WIN32_LEAN_AND_MEAN
-        #define WIN32_LEAN_AND_MEAN 1
-    #endif
-
-    #include <windows.h>
-
-    typedef HDC EGLNativeDisplayType;
-    typedef HBITMAP EGLNativePixmapType;
-    typedef HWND EGLNativeWindowType;
-#else
-    typedef void* EGLNativeDisplayType;
-    typedef void* EGLNativePixmapType;
-    typedef void* EGLNativeWindowType;
-
-    #ifdef ANDROID
-        // We only need to explicitly dlopen egltrace
-        // on android as we can use LD_PRELOAD or other tricks
-        // on other platforms. We look for it in /data/local
-        // as that's writeable by all users
-        //
-        // This should really go in GLLibraryEGL.cpp but we currently reference
-        // APITRACE_LIB in GLContextProviderEGL.cpp. Further refactoring
-        // will come in subsequent patches on Bug 732865
-        #define APITRACE_LIB "/data/local/tmp/egltrace.so"
-    #endif
+#ifdef ANDROID
+    // We only need to explicitly dlopen egltrace
+    // on android as we can use LD_PRELOAD or other tricks
+    // on other platforms. We look for it in /data/local
+    // as that's writeable by all users
+    //
+    // This should really go in GLLibraryEGL.cpp but we currently reference
+    // APITRACE_LIB in GLContextProviderEGL.cpp. Further refactoring
+    // will come in subsequent patches on Bug 732865
+    #define APITRACE_LIB "/data/local/tmp/egltrace.so"
 #endif
 
 #if defined(MOZ_X11)
 #define EGL_DEFAULT_DISPLAY  ((EGLNativeDisplayType)mozilla::DefaultXDisplay())
 #else
 #define EGL_DEFAULT_DISPLAY  ((EGLNativeDisplayType)0)
 #endif
 
--- a/gfx/gl/GLTypes.h
+++ b/gfx/gl/GLTypes.h
@@ -1,13 +1,13 @@
 /* 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/. */
 
-#if !defined(GLTYPES_H_)
+#ifndef GLTYPES_H_
 #define GLTYPES_H_
 
 #include <stddef.h>
 #include <stdint.h>
 
 #ifndef GLAPIENTRY
 # ifdef WIN32
 #  include <windef.h>
@@ -89,9 +89,26 @@ typedef uint64_t EGLTime;
 
 #define EGL_NO_CONTEXT       ((EGLContext)0)
 #define EGL_NO_DISPLAY       ((EGLDisplay)0)
 #define EGL_NO_SURFACE       ((EGLSurface)0)
 #define EGL_NO_CONFIG        ((EGLConfig)nullptr)
 #define EGL_NO_SYNC          ((EGLSync)0)
 #define EGL_NO_IMAGE         ((EGLImage)0)
 
+
+#ifdef XP_WIN
+    #ifndef WIN32_LEAN_AND_MEAN
+        #define WIN32_LEAN_AND_MEAN 1
+    #endif
+
+    #include <windef.h>
+
+    typedef HDC EGLNativeDisplayType;
+    typedef HBITMAP EGLNativePixmapType;
+    typedef HWND EGLNativeWindowType;
+#else
+    typedef void* EGLNativeDisplayType;
+    typedef void* EGLNativePixmapType;
+    typedef void* EGLNativeWindowType;
 #endif
+
+#endif // GLTYPES_H_
--- a/gfx/gl/SharedSurface.cpp
+++ b/gfx/gl/SharedSurface.cpp
@@ -214,16 +214,18 @@ SharedSurface::SharedSurface(SharedSurfa
     , mGL(gl)
     , mSize(size)
     , mHasAlpha(hasAlpha)
     , mCanRecycle(canRecycle)
     , mIsLocked(false)
     , mIsProducerAcquired(false)
 { }
 
+SharedSurface::~SharedSurface() = default;
+
 layers::TextureFlags
 SharedSurface::GetTextureFlags() const
 {
     return layers::TextureFlags::NO_FLAGS;
 }
 
 void
 SharedSurface::LockProd()
--- a/gfx/gl/SharedSurface.h
+++ b/gfx/gl/SharedSurface.h
@@ -71,18 +71,17 @@ protected:
     SharedSurface(SharedSurfaceType type,
                   AttachmentType attachType,
                   GLContext* gl,
                   const gfx::IntSize& size,
                   bool hasAlpha,
                   bool canRecycle);
 
 public:
-    virtual ~SharedSurface() {
-    }
+    virtual ~SharedSurface();
 
     // Specifies to the TextureClient any flags which
     // are required by the SharedSurface backend.
     virtual layers::TextureFlags GetTextureFlags() const;
 
     bool IsLocked() const { return mIsLocked; }
     bool IsProducerAcquired() const { return mIsProducerAcquired; }
 
--- a/gfx/vr/ipc/VRLayerChild.h
+++ b/gfx/vr/ipc/VRLayerChild.h
@@ -6,17 +6,16 @@
 
 #ifndef GFX_VR_LAYERCHILD_H
 #define GFX_VR_LAYERCHILD_H
 
 #include "VRManagerChild.h"
 
 #include "mozilla/RefPtr.h"
 #include "mozilla/gfx/PVRLayerChild.h"
-#include "GLContext.h"
 #include "gfxVR.h"
 
 class nsICanvasRenderingContextInternal;
 
 namespace mozilla {
 class WebGLContext;
 namespace dom {
 class HTMLCanvasElement;
--- a/widget/android/AndroidCompositorWidget.h
+++ b/widget/android/AndroidCompositorWidget.h
@@ -1,19 +1,17 @@
 /* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * 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 mozilla_widget_AndroidCompositorWidget_h
 #define mozilla_widget_AndroidCompositorWidget_h
 
-#include "GLContext.h"
-#include "GLLibraryEGL.h"
-#include "GLTypes.h"
+#include "GLDefs.h"
 #include "mozilla/widget/InProcessCompositorWidget.h"
 
 struct ANativeWindow;
 
 namespace mozilla {
 namespace widget {
 
 /**