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-21 13:29:33 +02:00
Родитель d8818e0d94
Коммит 0b68c0c6df
3 изменённых файлов: 11 добавлений и 13 удалений

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

@ -73,7 +73,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,7 +275,7 @@ 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.
@ -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.