Bug 1083067 part.10 nsGtkIMModule should use NS_INLINE_DECL_REFCOUNTING r=m_kato
--- a/widget/gtk/nsGtkIMModule.h
+++ b/widget/gtk/nsGtkIMModule.h
@@ -22,45 +22,22 @@ class nsWindow;
class nsGtkIMModule
{
protected:
typedef mozilla::widget::InputContext InputContext;
typedef mozilla::widget::InputContextAction InputContextAction;
public:
- nsrefcnt AddRef()
- {
- NS_PRECONDITION(int32_t(mRefCnt) >= 0, "mRefCnt is negative");
- ++mRefCnt;
- NS_LOG_ADDREF(this, mRefCnt, "nsGtkIMModule", sizeof(*this));
- return mRefCnt;
- }
- nsrefcnt Release()
- {
- NS_PRECONDITION(mRefCnt != 0, "mRefCnt is alrady zero");
- --mRefCnt;
- NS_LOG_RELEASE(this, mRefCnt, "nsGtkIMModule");
- if (mRefCnt == 0) {
- mRefCnt = 1; /* stabilize */
- delete this;
- return 0;
- }
- return mRefCnt;
- }
-
-protected:
- nsAutoRefCnt mRefCnt;
-
-public:
// aOwnerWindow is a pointer of the owner window. When aOwnerWindow is
// destroyed, the related IME contexts are released (i.e., IME cannot be
// used with the instance after that).
explicit nsGtkIMModule(nsWindow* aOwnerWindow);
- ~nsGtkIMModule();
+
+ NS_INLINE_DECL_REFCOUNTING(nsGtkIMModule)
// "Enabled" means the users can use all IMEs.
// I.e., the focus is in the normal editors.
bool IsEnabled() const;
// OnFocusWindow is a notification that aWindow is going to be focused.
void OnFocusWindow(nsWindow* aWindow);
// OnBlurWindow is a notification that aWindow is going to be unfocused.
@@ -85,16 +62,18 @@ public:
nsresult EndIMEComposition(nsWindow* aCaller);
void SetInputContext(nsWindow* aCaller,
const InputContext* aContext,
const InputContextAction* aAction);
InputContext GetInputContext();
void OnUpdateComposition();
protected:
+ ~nsGtkIMModule();
+
// Owner of an instance of this class. This should be top level window.
// The owner window must release the contexts when it's destroyed because
// the IME contexts need the native window. If OnDestroyWindow() is called
// with the owner window, it'll release IME contexts. Otherwise, it'll
// just clean up any existing composition if it's related to the destroying
// child window.
nsWindow* mOwnerWindow;