Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(676)

Side by Side Diff: Source/core/Init.cpp

Issue 464043002: Refactor module initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 static bool isRegistered = false; 72 static bool isRegistered = false;
73 if (isRegistered) 73 if (isRegistered)
74 return; 74 return;
75 isRegistered = true; 75 isRegistered = true;
76 76
77 Document::registerEventFactory(EventFactory::create()); 77 Document::registerEventFactory(EventFactory::create());
78 } 78 }
79 79
80 void CoreInitializer::init() 80 void CoreInitializer::init()
81 { 81 {
82 if (m_isInited) 82 ASSERT(!m_isInited);
83 return;
84 m_isInited = true; 83 m_isInited = true;
85 84
86 // It would make logical sense to do this and WTF::StringStatics::init() in 85 // It would make logical sense to do this and WTF::StringStatics::init() in
87 // WTF::initialize() but there are ordering dependencies. 86 // WTF::initialize() but there are ordering dependencies.
88 AtomicString::init(); 87 AtomicString::init();
89 HTMLNames::init(); 88 HTMLNames::init();
90 SVGNames::init(); 89 SVGNames::init();
91 XLinkNames::init(); 90 XLinkNames::init();
92 MathMLNames::init(); 91 MathMLNames::init();
93 XMLNSNames::init(); 92 XMLNSNames::init();
94 XMLNames::init(); 93 XMLNames::init();
95 94
96 initEventNames(); 95 initEventNames();
97 initEventTargetNames(); 96 initEventTargetNames();
98 EventTypeNames::init(); 97 EventTypeNames::init();
99 FetchInitiatorTypeNames::init(); 98 FetchInitiatorTypeNames::init();
100 FontFamilyNames::init(); 99 FontFamilyNames::init();
101 HTMLTokenizerNames::init(); 100 HTMLTokenizerNames::init();
102 InputTypeNames::init(); 101 InputTypeNames::init();
103 MediaFeatureNames::init(); 102 MediaFeatureNames::init();
104 MediaTypeNames::init(); 103 MediaTypeNames::init();
105 104
106 WTF::StringStatics::init(); 105 WTF::StringStatics::init();
107 QualifiedName::init(); 106 QualifiedName::init();
108 Partitions::init(); 107 Partitions::init();
109 EventTracer::initialize(); 108 EventTracer::initialize();
110 109
111 initBindings();
112 registerEventFactory(); 110 registerEventFactory();
113 111
114 // Ensure that the main thread's thread-local data is initialized before 112 // Ensure that the main thread's thread-local data is initialized before
115 // starting any worker threads. 113 // starting any worker threads.
116 PlatformThreadData::current(); 114 PlatformThreadData::current();
117 115
118 StringImpl::freezeStaticStrings(); 116 StringImpl::freezeStaticStrings();
119 117
120 // Creates HTMLParserThread::shared, but does not start the thread. 118 // Creates HTMLParserThread::shared, but does not start the thread.
121 HTMLParserThread::init(); 119 HTMLParserThread::init();
122 } 120 }
123 121
124 void CoreInitializer::shutdown() 122 void CoreInitializer::shutdown()
125 { 123 {
126 // Make sure we stop the HTMLParserThread before Platform::current() is clea red. 124 // Make sure we stop the HTMLParserThread before Platform::current() is clea red.
127 HTMLParserThread::shutdown(); 125 HTMLParserThread::shutdown();
128 126
129 Partitions::shutdown(); 127 Partitions::shutdown();
130 } 128 }
131 129
132 } // namespace blink 130 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698