Bug 1276669 - Part 1: Make nsHtml5Atoms initialization explicit in nsLayoutStatics. r=hsivonen, a=ritu
authorNathan Froyd <froydnj@mozilla.com>
Thu, 26 Jan 2017 15:43:39 -0500
changeset 375818 77ab0b39793686c3ce68e5e881973f9bdbd59fc3
parent 375817 8a28269883ab9eb995123feb521e46402d9c3e90
child 375819 9feaa1d4b820f808154e306588b0cdfe6622c952
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsivonen, ritu
bugs1276669
milestone53.0a2
Bug 1276669 - Part 1: Make nsHtml5Atoms initialization explicit in nsLayoutStatics. r=hsivonen, a=ritu Moving the html5 atoms out into their own initialization phase makes the initialization of atoms more explicit and avoids problems with trying to move modules around so their atoms get initialized in the correct place. As an aesthetic bonus, this change produces pleasing symmetry in nsHtml5Module::{Initialize,Release}Statics. Reviewed-by: Nathan Froyd <froydnj@mozilla.com>
layout/build/nsLayoutStatics.cpp
parser/html/nsHtml5Module.cpp
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -45,16 +45,17 @@
 #include "nsTreeSanitizer.h"
 #include "nsCellMap.h"
 #include "nsTextFrame.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsTextFragment.h"
 #include "nsCSSRuleProcessor.h"
 #include "nsCORSListenerProxy.h"
 #include "nsHTMLDNSPrefetch.h"
+#include "nsHtml5Atoms.h"
 #include "nsHtml5Module.h"
 #include "mozilla/dom/FallbackEncoding.h"
 #include "nsFocusManager.h"
 #include "nsListControlFrame.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "SVGElementFactory.h"
 #include "nsSVGUtils.h"
 #include "nsMathMLAtoms.h"
@@ -154,16 +155,17 @@ nsLayoutStatics::Initialize()
   // Register all of our atoms once
   nsCSSAnonBoxes::AddRefAtoms();
   nsCSSPseudoClasses::AddRefAtoms();
   nsCSSPseudoElements::AddRefAtoms();
   nsCSSKeywords::AddRefTable();
   nsCSSProps::AddRefTable();
   nsColorNames::AddRefTable();
   nsGkAtoms::AddRefAtoms();
+  nsHtml5Atoms::AddRefAtoms();
 
   StartupJSEnvironment();
   rv = nsRegion::InitStatic();
   if (NS_FAILED(rv)) {
     NS_ERROR("Could not initialize nsRegion");
     return rv;
   }
 
--- a/parser/html/nsHtml5Module.cpp
+++ b/parser/html/nsHtml5Module.cpp
@@ -25,17 +25,16 @@ bool nsHtml5Module::sOffMainThread = tru
 nsIThread* nsHtml5Module::sStreamParserThread = nullptr;
 nsIThread* nsHtml5Module::sMainThread = nullptr;
 
 // static
 void
 nsHtml5Module::InitializeStatics()
 {
   Preferences::AddBoolVarCache(&sOffMainThread, "html5.offmainthread");
-  nsHtml5Atoms::AddRefAtoms();
   nsHtml5AttributeName::initializeStatics();
   nsHtml5ElementName::initializeStatics();
   nsHtml5HtmlAttributes::initializeStatics();
   nsHtml5NamedCharacters::initializeStatics();
   nsHtml5Portability::initializeStatics();
   nsHtml5StackNode::initializeStatics();
   nsHtml5Tokenizer::initializeStatics();
   nsHtml5TreeBuilder::initializeStatics();