Bug 1082986 - Use RefPtr to hold Compositor r=nical

This commit is contained in:
Sotaro Ikeda 2014-10-16 06:48:29 -07:00
parent da7f85e29b
commit 5aefa96260
17 changed files with 32 additions and 25 deletions

View File

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MacIOSurfaceTextureHostBasic.h"
#include "mozilla/layers/BasicCompositor.h"
#include "mozilla/gfx/MacIOSurface.h"
namespace mozilla {

View File

@ -6,6 +6,7 @@
#ifndef MOZILLA_GFX_MACIOSURFACETEXTUREHOST_BASIC_H
#define MOZILLA_GFX_MACIOSURFACETEXTUREHOST_BASIC_H
#include "mozilla/layers/BasicCompositor.h"
#include "mozilla/layers/TextureHostBasic.h"
class MacIOSurface;
@ -41,7 +42,7 @@ public:
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
protected:
BasicCompositor* mCompositor;
RefPtr<BasicCompositor> mCompositor;
RefPtr<MacIOSurface> mSurface;
RefPtr<gfx::SourceSurface> mSourceSurface;
};
@ -80,7 +81,7 @@ public:
#endif
protected:
BasicCompositor* mCompositor;
RefPtr<BasicCompositor> mCompositor;
RefPtr<MacIOSurfaceTextureSourceBasic> mTextureSource;
RefPtr<MacIOSurface> mSurface;
};

View File

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "X11TextureSourceBasic.h"
#include "mozilla/layers/BasicCompositor.h"
#include "gfxXlibSurface.h"
#include "gfx2DGlue.h"

View File

@ -6,6 +6,7 @@
#ifndef MOZILLA_GFX_X11TEXTURESOURCEBASIC__H
#define MOZILLA_GFX_X11TEXTURESOURCEBASIC__H
#include "mozilla/layers/BasicCompositor.h"
#include "mozilla/layers/TextureHostBasic.h"
#include "mozilla/gfx/2D.h"
@ -37,7 +38,7 @@ public:
static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType);
protected:
BasicCompositor* mCompositor;
RefPtr<BasicCompositor> mCompositor;
RefPtr<gfxXlibSurface> mSurface;
RefPtr<gfx::SourceSurface> mSourceSurface;
};

View File

@ -16,6 +16,7 @@
#include "mozilla/gfx/Rect.h" // for Rect
#include "mozilla/gfx/Types.h" // for Filter
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc
#include "mozilla/layers/Effects.h" // for Texture Effect
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
@ -311,7 +312,7 @@ protected:
TextureInfo mTextureInfo;
uint64_t mAsyncID;
uint64_t mCompositorID;
Compositor* mCompositor;
RefPtr<Compositor> mCompositor;
Layer* mLayer;
RefPtr<CompositableBackendSpecificData> mBackendData;
uint32_t mFlashCounter; // used when the pref "layers.flash-borders" is true.

View File

@ -15,6 +15,7 @@
#include "mozilla/gfx/2D.h" // for DataSourceSurface
#include "mozilla/gfx/Point.h" // for IntSize, IntPoint
#include "mozilla/gfx/Types.h" // for SurfaceFormat, etc
#include "mozilla/layers/Compositor.h" // for Compositor
#include "mozilla/layers/CompositorTypes.h" // for TextureFlags, etc
#include "mozilla/layers/FenceUtils.h" // for FenceHandle
#include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
@ -495,7 +496,7 @@ protected:
bool Upload(nsIntRegion *aRegion = nullptr);
bool MaybeUpload(nsIntRegion *aRegion = nullptr);
Compositor* mCompositor;
RefPtr<Compositor> mCompositor;
RefPtr<DataTextureSource> mFirstSource;
nsIntRegion mMaybeUpdatedRegion;
gfx::IntSize mSize;
@ -630,7 +631,7 @@ protected:
bool mIsLocked;
gl::SharedSurface* const mSurf;
Compositor* mCompositor;
RefPtr<Compositor> mCompositor;
RefPtr<TextureSource> mTexSource;
};

View File

@ -41,13 +41,13 @@ X11TextureHost::Lock()
switch (mCompositor->GetBackendType()) {
case LayersBackend::LAYERS_BASIC:
mTextureSource =
new X11TextureSourceBasic(static_cast<BasicCompositor*>(mCompositor),
new X11TextureSourceBasic(static_cast<BasicCompositor*>(mCompositor.get()),
mSurface);
break;
#ifdef GL_PROVIDER_GLX
case LayersBackend::LAYERS_OPENGL:
mTextureSource =
new X11TextureSourceOGL(static_cast<CompositorOGL*>(mCompositor),
new X11TextureSourceOGL(static_cast<CompositorOGL*>(mCompositor.get()),
mSurface);
break;
#endif

View File

@ -45,7 +45,7 @@ public:
#endif
protected:
Compositor* mCompositor;
RefPtr<Compositor> mCompositor;
RefPtr<TextureSource> mTextureSource;
RefPtr<gfxXlibSurface> mSurface;
};

View File

@ -157,7 +157,12 @@ private:
void InitializeImpl();
InitParams mInitParams;
CompositorOGL* mCompositor;
/**
* There is temporary a cycle between the compositor and the render target,
* each having a strong ref to the other. The compositor's reference to
* the target is always cleared at the end of a frame.
*/
RefPtr<CompositorOGL> mCompositor;
GLContext* mGL;
GLuint mTextureHandle;
GLuint mFBO;

View File

@ -9,7 +9,6 @@
#include <ui/GraphicBuffer.h>
#include "GrallocImages.h" // for GrallocImage
#include "mozilla/layers/GrallocTextureHost.h"
#include "mozilla/layers/CompositorOGL.h"
#include "mozilla/layers/SharedBufferManagerParent.h"
#include "EGLImageHelpers.h"
#include "GLReadTexImageHelper.h"

View File

@ -7,6 +7,7 @@
#define MOZILLA_GFX_GRALLOCTEXTUREHOST_H
#ifdef MOZ_WIDGET_GONK
#include "mozilla/layers/CompositorOGL.h"
#include "mozilla/layers/TextureHostOGL.h"
#include "mozilla/layers/ShadowLayerUtilsGralloc.h"
#include <ui/GraphicBuffer.h>
@ -75,7 +76,7 @@ public:
protected:
RefPtr<TextureSharedDataGonkOGL> mTextureBackendSpecificData;
CompositorOGL* mCompositor;
RefPtr<CompositorOGL> mCompositor;
GrallocTextureHostOGL* mTextureHost;
android::sp<android::GraphicBuffer> mGraphicBuffer;
EGLImage mEGLImage;

View File

@ -5,7 +5,6 @@
#include "MacIOSurfaceTextureHostOGL.h"
#include "mozilla/gfx/MacIOSurface.h"
#include "mozilla/layers/CompositorOGL.h"
#include "GLContextCGL.h"
namespace mozilla {

View File

@ -6,6 +6,7 @@
#ifndef MOZILLA_GFX_MACIOSURFACETEXTUREHOSTOGL_H
#define MOZILLA_GFX_MACIOSURFACETEXTUREHOSTOGL_H
#include "mozilla/layers/CompositorOGL.h"
#include "mozilla/layers/TextureHostOGL.h"
class MacIOSurface;
@ -49,7 +50,7 @@ public:
gl::GLContext* gl() const;
protected:
CompositorOGL* mCompositor;
RefPtr<CompositorOGL> mCompositor;
RefPtr<MacIOSurface> mSurface;
};
@ -92,7 +93,7 @@ public:
#endif
protected:
CompositorOGL* mCompositor;
RefPtr<CompositorOGL> mCompositor;
RefPtr<MacIOSurfaceTextureSourceOGL> mTextureSource;
RefPtr<MacIOSurface> mSurface;
};

View File

@ -14,7 +14,6 @@
#include "gfxReusableSurfaceWrapper.h" // for gfxReusableSurfaceWrapper
#include "mozilla/gfx/2D.h" // for DataSourceSurface
#include "mozilla/gfx/BaseSize.h" // for BaseSize
#include "mozilla/layers/CompositorOGL.h" // for CompositorOGL
#ifdef MOZ_WIDGET_GONK
# include "GrallocImages.h" // for GrallocImage
# include "EGLImageHelpers.h"

View File

@ -20,6 +20,7 @@
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
#include "mozilla/gfx/Point.h" // for IntSize, IntPoint
#include "mozilla/gfx/Types.h" // for SurfaceFormat, etc
#include "mozilla/layers/CompositorOGL.h" // for CompositorOGL
#include "mozilla/layers/CompositorTypes.h" // for TextureFlags
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
#include "mozilla/layers/TextureHost.h" // for TextureHost, etc
@ -396,7 +397,7 @@ public:
protected:
const gfx::IntSize mSize;
CompositorOGL* mCompositor;
RefPtr<CompositorOGL> mCompositor;
const GLuint mTex;
const gfx::SurfaceFormat mFormat;
const GLenum mTextureTarget;
@ -442,7 +443,7 @@ public:
gl::GLContext* gl() const;
protected:
CompositorOGL* mCompositor;
RefPtr<CompositorOGL> mCompositor;
nsSurfaceTexture* const mSurfTex;
const gfx::SurfaceFormat mFormat;
const GLenum mTextureTarget;
@ -489,7 +490,7 @@ public:
protected:
nsSurfaceTexture* const mSurfTex;
const gfx::IntSize mSize;
CompositorOGL* mCompositor;
RefPtr<CompositorOGL> mCompositor;
RefPtr<SurfaceTextureSource> mTextureSource;
};
@ -533,7 +534,7 @@ public:
gl::GLContext* gl() const;
protected:
CompositorOGL* mCompositor;
RefPtr<CompositorOGL> mCompositor;
const EGLImage mImage;
const gfx::SurfaceFormat mFormat;
const GLenum mTextureTarget;
@ -580,7 +581,7 @@ public:
protected:
const EGLImage mImage;
const gfx::IntSize mSize;
CompositorOGL* mCompositor;
RefPtr<CompositorOGL> mCompositor;
RefPtr<EGLImageTextureSource> mTextureSource;
};

View File

@ -6,7 +6,6 @@
#ifdef GL_PROVIDER_GLX
#include "X11TextureSourceOGL.h"
#include "mozilla/layers/CompositorOGL.h"
#include "gfxXlibSurface.h"
#include "gfx2DGlue.h"

View File

@ -8,6 +8,7 @@
#ifdef GL_PROVIDER_GLX
#include "mozilla/layers/CompositorOGL.h"
#include "mozilla/layers/TextureHostOGL.h"
#include "mozilla/gfx/2D.h"
@ -46,7 +47,7 @@ public:
static gfx::SurfaceFormat ContentTypeToSurfaceFormat(gfxContentType aType);
protected:
CompositorOGL* mCompositor;
RefPtr<CompositorOGL> mCompositor;
nsRefPtr<gfxXlibSurface> mSurface;
RefPtr<gfx::SourceSurface> mSourceSurface;
GLuint mTexture;