Skip to content

Commit

Permalink
Bug 1265953, part 1 - Convert most of the cocoa widget code from nsAu…
Browse files Browse the repository at this point in the history
…toPtr to UniquePtr. r=mstange
  • Loading branch information
jwatt committed Apr 19, 2016
1 parent 8dfa4c3 commit 05e8c46
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 19 deletions.
8 changes: 4 additions & 4 deletions widget/cocoa/nsChildView.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,10 @@ class nsChildView : public nsBaseWidget
CGContextRef mTitlebarCGContext;

// Compositor thread only
nsAutoPtr<RectTextureImage> mResizerImage;
nsAutoPtr<RectTextureImage> mCornerMaskImage;
nsAutoPtr<RectTextureImage> mTitlebarImage;
nsAutoPtr<RectTextureImage> mBasicCompositorImage;
mozilla::UniquePtr<RectTextureImage> mResizerImage;
mozilla::UniquePtr<RectTextureImage> mCornerMaskImage;
mozilla::UniquePtr<RectTextureImage> mTitlebarImage;
mozilla::UniquePtr<RectTextureImage> mBasicCompositorImage;

// The area of mTitlebarCGContext that has changed and needs to be
// uploaded to to mTitlebarImage. Main thread only.
Expand Down
8 changes: 4 additions & 4 deletions widget/cocoa/nsChildView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2072,7 +2072,7 @@ inline uint16_t COLOR8TOCOLOR16(uint8_t color8)
}

if (!mResizerImage) {
mResizerImage = new RectTextureImage(aManager->gl());
mResizerImage = MakeUnique<RectTextureImage>(aManager->gl());
}

LayoutDeviceIntSize size = mResizeIndicatorRect.Size();
Expand Down Expand Up @@ -2286,7 +2286,7 @@ inline uint16_t COLOR8TOCOLOR16(uint8_t color8)
mUpdatedTitlebarRegion.SetEmpty();

if (!mTitlebarImage) {
mTitlebarImage = new RectTextureImage(aManager->gl());
mTitlebarImage = MakeUnique<RectTextureImage>(aManager->gl());
}

mTitlebarImage->UpdateFromCGContext(mTitlebarRect.Size(),
Expand All @@ -2310,7 +2310,7 @@ inline uint16_t COLOR8TOCOLOR16(uint8_t color8)
MutexAutoLock lock(mEffectsLock);

if (!mCornerMaskImage) {
mCornerMaskImage = new RectTextureImage(aManager->gl());
mCornerMaskImage = MakeUnique<RectTextureImage>(aManager->gl());
}

LayoutDeviceIntSize size(mDevPixelCornerRadius, mDevPixelCornerRadius);
Expand Down Expand Up @@ -2631,7 +2631,7 @@ static void MakeRegionsNonOverlapping(Region& aFirst, Regions& ... aRest)
LayoutDeviceIntSize renderSize = mBounds.Size();

if (!mBasicCompositorImage) {
mBasicCompositorImage = new RectTextureImage(mGLPresenter->gl());
mBasicCompositorImage = MakeUnique<RectTextureImage>(mGLPresenter->gl());
}

RefPtr<gfx::DrawTarget> drawTarget =
Expand Down
2 changes: 1 addition & 1 deletion widget/cocoa/nsCocoaWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

#import <Cocoa/Cocoa.h>

#include "mozilla/RefPtr.h"
#include "nsBaseWidget.h"
#include "nsPIWidgetCocoa.h"
#include "nsAutoPtr.h"
#include "nsCocoaUtils.h"

class nsCocoaWindow;
Expand Down
2 changes: 1 addition & 1 deletion widget/cocoa/nsDeviceContextSpecX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

#include "nsDeviceContextSpecX.h"

#include "mozilla/RefPtr.h"
#include "nsCRT.h"
#include <unistd.h>

#include "nsAutoPtr.h"
#include "nsQueryObject.h"
#include "nsIServiceManager.h"
#include "nsIPrintOptions.h"
Expand Down
2 changes: 1 addition & 1 deletion widget/cocoa/nsMenuBarX.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class nsMenuBarX : public nsMenuGroupOwnerX, public nsChangeObserver
int tag, NativeMenuItemTarget* target);
nsresult CreateApplicationMenu(nsMenuX* inMenu);

nsTArray< nsAutoPtr<nsMenuX> > mMenuArray;
nsTArray<mozilla::UniquePtr<nsMenuX>> mMenuArray;
nsIWidget* mParentWindow; // [weak]
GeckoNSMenu* mNativeMenu; // root menu, representing entire menu bar
};
Expand Down
4 changes: 2 additions & 2 deletions widget/cocoa/nsMenuBarX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
uint32_t length = mMenuArray.Length();
// first find a menu in the menu bar
for (unsigned int i = 0; i < length; i++) {
nsMenuX* menu = mMenuArray[i];
nsMenuX* menu = mMenuArray[i].get();
if (!nsMenuUtilsX::NodeIsHiddenOrCollapsed(menu->Content())) {
visible++;
if (visible == (targetIndex + 1)) {
Expand Down Expand Up @@ -366,7 +366,7 @@
NS_ERROR("Requesting menu at invalid index!");
return NULL;
}
return mMenuArray[aIndex];
return mMenuArray[aIndex].get();
}

nsMenuX* nsMenuBarX::GetXULHelpMenu()
Expand Down
2 changes: 0 additions & 2 deletions widget/cocoa/nsMenuGroupOwnerX.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
#include "nsIMutationObserver.h"
#include "nsHashKeys.h"
#include "nsDataHashtable.h"
#include "nsAutoPtr.h"
#include "nsString.h"


class nsMenuItemX;
class nsChangeObserver;
class nsIWidget;
Expand Down
2 changes: 1 addition & 1 deletion widget/cocoa/nsMenuItemIconX.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef nsMenuItemIconX_h_
#define nsMenuItemIconX_h_

#include "mozilla/RefPtr.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "imgINotificationObserver.h"

class nsIURI;
Expand Down
2 changes: 1 addition & 1 deletion widget/cocoa/nsMenuItemX.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#ifndef nsMenuItemX_h_
#define nsMenuItemX_h_

#include "mozilla/RefPtr.h"
#include "nsMenuBaseX.h"
#include "nsMenuGroupOwnerX.h"
#include "nsChangeObserver.h"
#include "nsAutoPtr.h"

#import <Cocoa/Cocoa.h>

Expand Down
2 changes: 1 addition & 1 deletion widget/cocoa/nsScreenManagerCocoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

#import <Cocoa/Cocoa.h>

#include "mozilla/RefPtr.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "nsIScreenManager.h"
#include "nsScreenCocoa.h"

Expand Down
2 changes: 1 addition & 1 deletion widget/cocoa/nsSystemStatusBarCocoa.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#ifndef nsSystemStatusBarCocoa_h_
#define nsSystemStatusBarCocoa_h_

#include "mozilla/RefPtr.h"
#include "nsISystemStatusBar.h"
#include "nsClassHashtable.h"
#include "nsAutoPtr.h"

class nsStandaloneNativeMenu;
@class NSStatusItem;
Expand Down

0 comments on commit 05e8c46

Please sign in to comment.