Bug 1265386: Convert code in widget/ to |UniquePtr|, r=nfroyd

This patch replaces all references to |nsAutoPtr| in widget/ by references
to |UniquePtr|. |nsAutoPtr| is deprecated and will go away soon.

MozReview-Commit-ID: 8xAS79wTkPC
This commit is contained in:
Thomas Zimmermann 2016-07-22 10:56:13 +02:00
Родитель 48ef99e762
Коммит 9bf5588624
3 изменённых файлов: 12 добавлений и 14 удалений

Просмотреть файл

@ -74,7 +74,6 @@ using namespace mozilla;
typedef mozilla::dom::GamepadPlatformService GamepadPlatformService;
nsIGeolocationUpdate *gLocationCallback = nullptr;
nsAutoPtr<mozilla::AndroidGeckoEvent> gLastSizeChange;
nsAppShell* nsAppShell::sAppShell;
StaticAutoPtr<Mutex> nsAppShell::sAppShellLock;

Просмотреть файл

@ -13,7 +13,6 @@
#include "mozAccessibleProtocol.h"
#endif
#include "nsAutoPtr.h"
#include "nsISupports.h"
#include "nsBaseWidget.h"
#include "nsWeakPtr.h"
@ -627,7 +626,7 @@ protected:
// Used in OMTC BasicLayers mode. Presents the BasicCompositor result
// surface to the screen using an OpenGL context.
nsAutoPtr<GLPresenter> mGLPresenter;
mozilla::UniquePtr<GLPresenter> mGLPresenter;
mozilla::UniquePtr<mozilla::VibrancyManager> mVibrancyManager;
RefPtr<mozilla::SwipeTracker> mSwipeTracker;

Просмотреть файл

@ -275,12 +275,12 @@ namespace {
class GLPresenter : public GLManager
{
public:
static GLPresenter* CreateForWindow(nsIWidget* aWindow)
static mozilla::UniquePtr<GLPresenter> CreateForWindow(nsIWidget* aWindow)
{
// Contrary to CompositorOGL, we allow unaccelerated OpenGL contexts to be
// used. BasicCompositor only requires very basic GL functionality.
RefPtr<GLContext> context = gl::GLContextProvider::CreateForWindow(aWindow, false);
return context ? new GLPresenter(context) : nullptr;
return context ? MakeUnique<GLPresenter>(context) : nullptr;
}
explicit GLPresenter(GLContext* aContext);
@ -291,7 +291,7 @@ public:
{
MOZ_ASSERT(aTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB);
MOZ_ASSERT(aFormat == gfx::SurfaceFormat::R8G8B8A8);
return mRGBARectProgram;
return mRGBARectProgram.get();
}
virtual const gfx::Matrix4x4& GetProjMatrix() const override
{
@ -315,7 +315,7 @@ public:
protected:
RefPtr<mozilla::gl::GLContext> mGLContext;
nsAutoPtr<mozilla::layers::ShaderProgramOGL> mRGBARectProgram;
mozilla::UniquePtr<mozilla::layers::ShaderProgramOGL> mRGBARectProgram;
gfx::Matrix4x4 mProjMatrix;
GLuint mQuadVBO;
};
@ -1988,7 +1988,7 @@ nsChildView::CleanupWindowEffects()
bool
nsChildView::PreRender(LayerManagerComposite* aManager)
{
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
UniquePtr<GLManager> manager(GLManager::CreateGLManager(aManager));
if (!manager) {
return true;
}
@ -2010,7 +2010,7 @@ nsChildView::PreRender(LayerManagerComposite* aManager)
void
nsChildView::PostRender(LayerManagerComposite* aManager)
{
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
UniquePtr<GLManager> manager(GLManager::CreateGLManager(aManager));
if (!manager) {
return;
}
@ -2023,9 +2023,9 @@ void
nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager,
LayoutDeviceIntRect aRect)
{
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
mozilla::UniquePtr<GLManager> manager(GLManager::CreateGLManager(aManager));
if (manager) {
DrawWindowOverlay(manager, aRect);
DrawWindowOverlay(manager.get(), aRect);
}
}
@ -2718,11 +2718,11 @@ nsChildView::DoRemoteComposition(const LayoutDeviceIntRect& aRenderRect)
mGLPresenter->BeginFrame(aRenderRect.Size());
// Draw the result from the basic compositor.
mBasicCompositorImage->Draw(mGLPresenter, LayoutDeviceIntPoint(0, 0));
mBasicCompositorImage->Draw(mGLPresenter.get(), LayoutDeviceIntPoint(0, 0));
// DrawWindowOverlay doesn't do anything for non-GL, so it didn't paint
// anything during the basic compositor transaction. Draw the overlay now.
DrawWindowOverlay(mGLPresenter, aRenderRect);
DrawWindowOverlay(mGLPresenter.get(), aRenderRect);
mGLPresenter->EndFrame();
@ -3008,7 +3008,7 @@ GLPresenter::GLPresenter(GLContext* aContext)
mGLContext->MakeCurrent();
ShaderConfigOGL config;
config.SetTextureTarget(LOCAL_GL_TEXTURE_RECTANGLE_ARB);
mRGBARectProgram = new ShaderProgramOGL(mGLContext,
mRGBARectProgram = MakeUnique<ShaderProgramOGL>(mGLContext,
ProgramProfileOGL::GetProfileFor(config));
// Create mQuadVBO.