bug 1155829 - inline MaiHyperlink::GetAtkHyperlink r=surkov
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Tue, 07 Apr 2015 15:56:28 -0400
changeset 240257 86d231dcc30cfd654edbe6311c923914df7f1642
parent 240256 5a16a3825802963b523479515d255b38d92786b6
child 240258 7e3e8edde0a3e9dd06bd07214da6077b07cb8726
push id28627
push userkwierso@gmail.com
push dateTue, 21 Apr 2015 22:25:44 +0000
treeherdermozilla-central@fcbc5a4f5bb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1155829
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1155829 - inline MaiHyperlink::GetAtkHyperlink r=surkov
accessible/atk/nsMaiHyperlink.cpp
accessible/atk/nsMaiHyperlink.h
--- a/accessible/atk/nsMaiHyperlink.cpp
+++ b/accessible/atk/nsMaiHyperlink.cpp
@@ -89,46 +89,35 @@ mai_atk_hyperlink_get_type(void)
     }
     return type;
 }
 
 MaiHyperlink::MaiHyperlink(Accessible* aHyperLink) :
     mHyperlink(aHyperLink),
     mMaiAtkHyperlink(nullptr)
 {
-}
-
-MaiHyperlink::~MaiHyperlink()
-{
-    if (mMaiAtkHyperlink) {
-        MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nullptr;
-        g_object_unref(mMaiAtkHyperlink);
-    }
-}
-
-AtkHyperlink*
-MaiHyperlink::GetAtkHyperlink(void)
-{
-  NS_ENSURE_TRUE(mHyperlink, nullptr);
-
-  if (mMaiAtkHyperlink)
-    return mMaiAtkHyperlink;
-
   if (!mHyperlink->IsLink())
-    return nullptr;
+    return;
 
     mMaiAtkHyperlink =
         reinterpret_cast<AtkHyperlink *>
                         (g_object_new(mai_atk_hyperlink_get_type(), nullptr));
     NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY");
-    NS_ENSURE_TRUE(mMaiAtkHyperlink, nullptr);
+    if (!mMaiAtkHyperlink)
+      return;
 
     MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = this;
+}
 
-    return mMaiAtkHyperlink;
+MaiHyperlink::~MaiHyperlink()
+{
+  if (mMaiAtkHyperlink) {
+    MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nullptr;
+    g_object_unref(mMaiAtkHyperlink);
+  }
 }
 
 
 /* static functions for ATK callbacks */
 
 void
 classInitCB(AtkHyperlinkClass *aClass)
 {
--- a/accessible/atk/nsMaiHyperlink.h
+++ b/accessible/atk/nsMaiHyperlink.h
@@ -22,17 +22,17 @@ namespace a11y {
 
 class MaiHyperlink
 {
 public:
   explicit MaiHyperlink(Accessible* aHyperLink);
   ~MaiHyperlink();
 
 public:
-  AtkHyperlink *GetAtkHyperlink(void);
+  AtkHyperlink* GetAtkHyperlink() const { return mMaiAtkHyperlink; }
   Accessible* GetAccHyperlink()
     { return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nullptr; }
 
 protected:
   Accessible* mHyperlink;
   AtkHyperlink* mMaiAtkHyperlink;
 };