Bug 1528881 - Part 9: gfx/layers: Move CreateTextureHostBasic/D3D11/OGL() function declarations to header files. r=mattwoodrow
authorChris Peterson <cpeterson@mozilla.com>
Sun, 17 Feb 2019 23:05:15 -0800
changeset 519497 0df9a1e522afbc4fedd23fa72bc307aac7d06185
parent 519496 13bf48ec0625e11cd3a21e0db5da6bbc26b965fa
child 519498 63536a044a29b3f723e3ee829f260dafc41feb54
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1528881
milestone67.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 1528881 - Part 9: gfx/layers: Move CreateTextureHostBasic/D3D11/OGL() function declarations to header files. r=mattwoodrow clang's -Wmissing-prototypes option identifies global functions that can be made static (because they're only called from one compilation unit) or removed (if they're never called). In this case, moving these functions' declarations to header files means the same declaration will be seen by the .cpp files defining each function and TextureHost.cpp calling the functions. Differential Revision: https://phabricator.services.mozilla.com/D20268
gfx/layers/basic/TextureHostBasic.h
gfx/layers/composite/TextureHost.cpp
gfx/layers/d3d11/TextureD3D11.h
gfx/layers/opengl/TextureHostOGL.h
--- a/gfx/layers/basic/TextureHostBasic.h
+++ b/gfx/layers/basic/TextureHostBasic.h
@@ -10,16 +10,20 @@
 #include "CompositableHost.h"
 #include "mozilla/layers/LayersSurfaces.h"
 #include "mozilla/layers/TextureHost.h"
 #include "mozilla/gfx/2D.h"
 
 namespace mozilla {
 namespace layers {
 
+already_AddRefed<TextureHost> CreateTextureHostBasic(
+    const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator,
+    LayersBackend aBackend, TextureFlags aFlags);
+
 /**
  * A texture source interface that can be used by the software Compositor.
  */
 class TextureSourceBasic {
  public:
   TextureSourceBasic() : mFromYCBCR(false) {}
   virtual ~TextureSourceBasic() {}
   virtual gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) = 0;
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -48,16 +48,17 @@
 #  include "mozilla/layers/X11TextureHost.h"
 #endif
 
 #ifdef XP_MACOSX
 #  include "../opengl/MacIOSurfaceTextureHostOGL.h"
 #endif
 
 #ifdef XP_WIN
+#  include "mozilla/layers/TextureD3D11.h"
 #  include "mozilla/layers/TextureDIB.h"
 #endif
 
 #if 0
 #  define RECYCLE_LOG(...) printf_stderr(__VA_ARGS__)
 #else
 #  define RECYCLE_LOG(...) \
     do {                   \
@@ -158,31 +159,16 @@ uint64_t TextureHost::GetTextureSerial(P
 
 PTextureParent* TextureHost::GetIPDLActor() { return mActor; }
 
 void TextureHost::SetLastFwdTransactionId(uint64_t aTransactionId) {
   MOZ_ASSERT(mFwdTransactionId <= aTransactionId);
   mFwdTransactionId = aTransactionId;
 }
 
-// implemented in TextureHostOGL.cpp
-already_AddRefed<TextureHost> CreateTextureHostOGL(
-    const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator,
-    LayersBackend aBackend, TextureFlags aFlags);
-
-// implemented in TextureHostBasic.cpp
-already_AddRefed<TextureHost> CreateTextureHostBasic(
-    const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator,
-    LayersBackend aBackend, TextureFlags aFlags);
-
-// implemented in TextureD3D11.cpp
-already_AddRefed<TextureHost> CreateTextureHostD3D11(
-    const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator,
-    LayersBackend aBackend, TextureFlags aFlags);
-
 already_AddRefed<TextureHost> TextureHost::Create(
     const SurfaceDescriptor& aDesc, const ReadLockDescriptor& aReadLock,
     ISurfaceAllocator* aDeallocator, LayersBackend aBackend,
     TextureFlags aFlags, wr::MaybeExternalImageId& aExternalImageId) {
   RefPtr<TextureHost> result;
 
   switch (aDesc.type()) {
     case SurfaceDescriptor::TSurfaceDescriptorBuffer:
--- a/gfx/layers/d3d11/TextureD3D11.h
+++ b/gfx/layers/d3d11/TextureD3D11.h
@@ -20,16 +20,20 @@
 
 namespace mozilla {
 namespace gl {
 class GLBlitHelper;
 }
 
 namespace layers {
 
+already_AddRefed<TextureHost> CreateTextureHostD3D11(
+    const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator,
+    LayersBackend aBackend, TextureFlags aFlags);
+
 class MOZ_RAII AutoTextureLock {
  public:
   AutoTextureLock(IDXGIKeyedMutex* aMutex, HRESULT& aResult,
                   uint32_t aTimeout = 0);
   ~AutoTextureLock();
 
  private:
   RefPtr<IDXGIKeyedMutex> mMutex;
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -48,16 +48,20 @@ class Compositor;
 class CompositorOGL;
 class TextureImageTextureSourceOGL;
 class GLTextureSource;
 
 void ApplySamplingFilterToBoundTexture(gl::GLContext* aGL,
                                        gfx::SamplingFilter aSamplingFilter,
                                        GLuint aTarget = LOCAL_GL_TEXTURE_2D);
 
+already_AddRefed<TextureHost> CreateTextureHostOGL(
+    const SurfaceDescriptor& aDesc, ISurfaceAllocator* aDeallocator,
+    LayersBackend aBackend, TextureFlags aFlags);
+
 /*
  * TextureHost implementations for the OpenGL backend.
  *
  * Note that it is important to be careful about the ownership model with
  * the OpenGL backend, due to some widget limitation on Linux: before
  * the nsBaseWidget associated with our OpenGL context has been completely
  * deleted, every resource belonging to the OpenGL context MUST have been
  * released. At the moment the teardown sequence happens in the middle of