inlining addref/release for thebes. bug 342593. r=mrbkap
git-svn-id: svn://10.0.0.236/trunk@200787 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
5cd47d3772
commit
78f6230cab
@ -49,7 +49,7 @@
|
||||
* abstract class, and use gfxContext to draw on this surface.
|
||||
*/
|
||||
class THEBES_API gfxASurface {
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(gfxASurface)
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
@ -65,7 +65,7 @@ class gfxTextRun;
|
||||
* pattern set by SetPattern, SetColor or SetSource.
|
||||
*/
|
||||
class THEBES_API gfxContext {
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(gfxContext)
|
||||
|
||||
public:
|
||||
/**
|
||||
|
||||
@ -117,7 +117,7 @@ struct THEBES_API gfxFontStyle {
|
||||
|
||||
/* a SPECIFIC single font family */
|
||||
class THEBES_API gfxFont {
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(gfxFont)
|
||||
|
||||
public:
|
||||
gfxFont(const nsAString &aName, const gfxFontStyle *aFontGroup);
|
||||
@ -204,7 +204,7 @@ protected:
|
||||
|
||||
// these do not copy the text
|
||||
class THEBES_API gfxTextRun {
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(gfxTextRun)
|
||||
|
||||
public:
|
||||
virtual void Draw(gfxContext *aContext, gfxPoint pt) = 0;
|
||||
|
||||
@ -50,7 +50,7 @@ class gfxContext;
|
||||
class THEBES_API gfxPattern {
|
||||
friend class gfxContext;
|
||||
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(gfxPattern)
|
||||
|
||||
public:
|
||||
// from another surface
|
||||
|
||||
@ -61,17 +61,27 @@ typedef double gfxFloat;
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#define THEBES_IMPL_REFCOUNTING(_class) \
|
||||
NS_IMPL_ADDREF(_class) \
|
||||
NS_IMPL_RELEASE(_class)
|
||||
|
||||
#define THEBES_DECL_REFCOUNTING \
|
||||
public: \
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void); \
|
||||
NS_IMETHOD_(nsrefcnt) Release(void); \
|
||||
protected: \
|
||||
nsAutoRefCnt mRefCnt; \
|
||||
NS_DECL_OWNINGTHREAD \
|
||||
#define THEBES_INLINE_DECL_REFCOUNTING(_class) \
|
||||
public: \
|
||||
nsrefcnt AddRef(void) { \
|
||||
NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \
|
||||
++mRefCnt; \
|
||||
NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \
|
||||
return mRefCnt; \
|
||||
} \
|
||||
nsrefcnt Release(void) { \
|
||||
NS_PRECONDITION(0 != mRefCnt, "dup release"); \
|
||||
--mRefCnt; \
|
||||
NS_LOG_RELEASE(this, mRefCnt, #_class); \
|
||||
if (mRefCnt == 0) { \
|
||||
mRefCnt = 1; /* stabilize */ \
|
||||
NS_DELETEXPCOM(this); \
|
||||
return 0; \
|
||||
} \
|
||||
return mRefCnt; \
|
||||
} \
|
||||
protected: \
|
||||
nsAutoRefCnt mRefCnt; \
|
||||
public:
|
||||
|
||||
#endif /* GFX_TYPES_H */
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
class WeightTable
|
||||
{
|
||||
public:
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(WeightTable)
|
||||
|
||||
WeightTable() : mWeights(0) {}
|
||||
~WeightTable() {
|
||||
@ -238,7 +238,7 @@ static PRUint8 CharRangeBit(PRUint32 ch) {
|
||||
class FontEntry
|
||||
{
|
||||
public:
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(FontEntry)
|
||||
|
||||
FontEntry(const nsAString& aName, PRUint16 aFontType) :
|
||||
mName(aName), mFontType(aFontType), mUnicodeFont(PR_FALSE),
|
||||
|
||||
@ -25,7 +25,6 @@ CPPSRCS = \
|
||||
gfxASurface.cpp \
|
||||
gfxContext.cpp \
|
||||
gfxImageSurface.cpp \
|
||||
gfxPattern.cpp \
|
||||
gfxFont.cpp \
|
||||
gfxPlatform.cpp \
|
||||
$(NULL)
|
||||
|
||||
@ -288,8 +288,6 @@ gfxAtsuiFontGroup::MakeTextRun(const nsAString& aString)
|
||||
** gfxAtsuiTextRun
|
||||
**/
|
||||
|
||||
THEBES_IMPL_REFCOUNTING(gfxAtsuiTextRun)
|
||||
|
||||
gfxAtsuiTextRun::gfxAtsuiTextRun(const nsAString& aString, gfxAtsuiFontGroup *aGroup)
|
||||
: mString(aString), mGroup(aGroup)
|
||||
{
|
||||
|
||||
@ -52,9 +52,6 @@
|
||||
#include "gfxASurface.h"
|
||||
#include "gfxPattern.h"
|
||||
|
||||
THEBES_IMPL_REFCOUNTING(gfxContext)
|
||||
THEBES_IMPL_REFCOUNTING(gfxASurface)
|
||||
|
||||
gfxContext::gfxContext(gfxASurface *surface) :
|
||||
mSurface(surface)
|
||||
{
|
||||
|
||||
@ -46,9 +46,6 @@
|
||||
|
||||
#include "nsCRT.h"
|
||||
|
||||
THEBES_IMPL_REFCOUNTING(gfxFont)
|
||||
THEBES_IMPL_REFCOUNTING(gfxTextRun)
|
||||
|
||||
gfxFont::gfxFont(const nsAString &aName, const gfxFontStyle *aFontStyle) :
|
||||
mName(aName), mStyle(aFontStyle)
|
||||
{
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Oracle Corporation code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Oracle Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@pavlov.net>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "gfxPattern.h"
|
||||
|
||||
THEBES_IMPL_REFCOUNTING(gfxPattern)
|
||||
@ -66,9 +66,6 @@ inline HDC GetDCFromSurface(gfxASurface *aSurface) {
|
||||
return NS_STATIC_CAST(gfxWindowsSurface*, aSurface)->GetDC();
|
||||
}
|
||||
|
||||
THEBES_IMPL_REFCOUNTING(WeightTable)
|
||||
THEBES_IMPL_REFCOUNTING(FontEntry)
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* class gfxWindowsFont
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user