Skip to content

Commit

Permalink
Bug 1265386: Convert code in widget/ to |UniquePtr|, r=nfroyd
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tdz committed Jul 21, 2016
1 parent 72bc614 commit e0f8ad5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion widget/android/nsAppShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions widget/cocoa/nsChildView.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "mozAccessibleProtocol.h"
#endif

#include "nsAutoPtr.h"
#include "nsISupports.h"
#include "nsBaseWidget.h"
#include "nsWeakPtr.h"
Expand Down Expand Up @@ -627,7 +626,7 @@ class nsChildView : public nsBaseWidget

// 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;
Expand Down
20 changes: 10 additions & 10 deletions widget/cocoa/nsChildView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void EnsureLogInitialized()
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.
Expand All @@ -291,7 +291,7 @@ void EnsureLogInitialized()
{
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
{
Expand All @@ -315,7 +315,7 @@ virtual void BindAndDrawQuad(ShaderProgramOGL *aProg,

protected:
RefPtr<mozilla::gl::GLContext> mGLContext;
nsAutoPtr<mozilla::layers::ShaderProgramOGL> mRGBARectProgram;
mozilla::UniquePtr<mozilla::layers::ShaderProgramOGL> mRGBARectProgram;
gfx::Matrix4x4 mProjMatrix;
GLuint mQuadVBO;
};
Expand Down Expand Up @@ -1988,7 +1988,7 @@ inline uint16_t COLOR8TOCOLOR16(uint8_t color8)
bool
nsChildView::PreRender(LayerManagerComposite* aManager)
{
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
UniquePtr<GLManager> manager(GLManager::CreateGLManager(aManager));
if (!manager) {
return true;
}
Expand All @@ -2010,7 +2010,7 @@ inline uint16_t COLOR8TOCOLOR16(uint8_t color8)
void
nsChildView::PostRender(LayerManagerComposite* aManager)
{
nsAutoPtr<GLManager> manager(GLManager::CreateGLManager(aManager));
UniquePtr<GLManager> manager(GLManager::CreateGLManager(aManager));
if (!manager) {
return;
}
Expand All @@ -2023,9 +2023,9 @@ inline uint16_t COLOR8TOCOLOR16(uint8_t color8)
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);
}
}

Expand Down Expand Up @@ -2718,11 +2718,11 @@ static void MakeRegionsNonOverlapping(Region& aFirst, Regions& ... aRest)
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();

Expand Down Expand Up @@ -3008,7 +3008,7 @@ explicit AutoBackgroundSetter(NSView* aView) {
mGLContext->MakeCurrent();
ShaderConfigOGL config;
config.SetTextureTarget(LOCAL_GL_TEXTURE_RECTANGLE_ARB);
mRGBARectProgram = new ShaderProgramOGL(mGLContext,
mRGBARectProgram = MakeUnique<ShaderProgramOGL>(mGLContext,
ProgramProfileOGL::GetProfileFor(config));

// Create mQuadVBO.
Expand Down

0 comments on commit e0f8ad5

Please sign in to comment.