Bug 670500 - Make nsCellMap::Init return void; r=roc
authorMs2ger <ms2ger@gmail.com>
Fri, 15 Jul 2011 12:18:33 +0200
changeset 72820 fe97ea8f631207d9538ff865d02b03a67a133ffb
parent 72819 e00f235a80e4f69b85261fef01df8cc15961390d
child 72821 53d0d74e602e1ba9c3d24fd1f0b8df518294214d
push id20775
push userMs2ger@gmail.com
push dateFri, 15 Jul 2011 10:33:57 +0000
treeherdermozilla-central@037f02f89d5b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs670500
milestone8.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 670500 - Make nsCellMap::Init return void; r=roc
layout/build/nsLayoutStatics.cpp
layout/tables/nsCellMap.cpp
layout/tables/nsCellMap.h
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -171,21 +171,17 @@ nsLayoutStatics::Initialize()
   }
 
   rv = nsTextFragment::Init();
   if (NS_FAILED(rv)) {
     NS_ERROR("Could not initialize nsTextFragment");
     return rv;
   }
 
-  rv = nsCellMap::Init();
-  if (NS_FAILED(rv)) {
-    NS_ERROR("Could not initialize nsCellMap");
-    return rv;
-  }
+  nsCellMap::Init();
 
   nsCSSRendering::Init();
 
   nsTextFrameTextRunCache::Init();
 
   rv = nsHTMLDNSPrefetch::Initialize();
   if (NS_FAILED(rv)) {
     NS_ERROR("Could not initialize HTML DNS prefetch");
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -164,41 +164,39 @@ nsTableCellMap::InsertGroupCellMap(nsCel
   }
   aNewMap.SetNextSibling(next);
 }
 
 void nsTableCellMap::InsertGroupCellMap(nsTableRowGroupFrame*  aNewGroup,
                                         nsTableRowGroupFrame*& aPrevGroup)
 {
   nsCellMap* newMap = new nsCellMap(aNewGroup, mBCInfo != nsnull);
-  if (newMap) {
-    nsCellMap* prevMap = nsnull;
-    nsCellMap* lastMap = mFirstMap;
-    if (aPrevGroup) {
-      nsCellMap* map = mFirstMap;
-      while (map) {
-        lastMap = map;
-        if (map->GetRowGroup() == aPrevGroup) {
-          prevMap = map;
-          break;
-        }
-        map = map->GetNextSibling();
+  nsCellMap* prevMap = nsnull;
+  nsCellMap* lastMap = mFirstMap;
+  if (aPrevGroup) {
+    nsCellMap* map = mFirstMap;
+    while (map) {
+      lastMap = map;
+      if (map->GetRowGroup() == aPrevGroup) {
+        prevMap = map;
+        break;
       }
+      map = map->GetNextSibling();
     }
-    if (!prevMap) {
-      if (aPrevGroup) {
-        prevMap = lastMap;
-        aPrevGroup = (prevMap) ? prevMap->GetRowGroup() : nsnull;
-      }
-      else {
-        aPrevGroup = nsnull;
-      }
+  }
+  if (!prevMap) {
+    if (aPrevGroup) {
+      prevMap = lastMap;
+      aPrevGroup = (prevMap) ? prevMap->GetRowGroup() : nsnull;
     }
-    InsertGroupCellMap(prevMap, *newMap);
+    else {
+      aPrevGroup = nsnull;
+    }
   }
+  InsertGroupCellMap(prevMap, *newMap);
 }
 
 void nsTableCellMap::RemoveGroupCellMap(nsTableRowGroupFrame* aGroup)
 {
   nsCellMap* map = mFirstMap;
   nsCellMap* prior = nsnull;
   while (map) {
     if (map->GetRowGroup() == aGroup) {
@@ -1172,24 +1170,21 @@ nsCellMap::~nsCellMap()
     PRUint32 colCount = row.Length();
     for (PRUint32 colX = 0; colX < colCount; colX++) {
       DestroyCellData(row[colX]);
     }
   }
 }
 
 /* static */
-nsresult
+void
 nsCellMap::Init()
 {
-  NS_ASSERTION(!sEmptyRow, "How did that happen?");
+  NS_ABORT_IF_FALSE(!sEmptyRow, "How did that happen?");
   sEmptyRow = new nsCellMap::CellDataArray();
-  NS_ENSURE_TRUE(sEmptyRow, NS_ERROR_OUT_OF_MEMORY);
-
-  return NS_OK;
 }
 
 /* static */
 void
 nsCellMap::Shutdown()
 {
   delete sEmptyRow;
   sEmptyRow = nsnull;
--- a/layout/tables/nsCellMap.h
+++ b/layout/tables/nsCellMap.h
@@ -306,17 +306,17 @@ public:
     */
   nsCellMap(nsTableRowGroupFrame* aRowGroupFrame, PRBool aIsBC);
 
   /** destructor
     * NOT VIRTUAL BECAUSE THIS CLASS SHOULD **NEVER** BE SUBCLASSED
     */
   ~nsCellMap();
 
-  static nsresult Init();
+  static void Init();
   static void Shutdown();
 
   nsCellMap* GetNextSibling() const;
   void SetNextSibling(nsCellMap* aSibling);
 
   nsTableRowGroupFrame* GetRowGroup() const;
 
   nsTableCellFrame* GetCellFrame(PRInt32   aRowIndex,