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

Side by Side Diff: Source/modules/InitModules.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
« Source/core/Init.h ('K') | « Source/modules/InitModules.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "InitModules.h" 6 #include "InitModules.h"
7 7
8 #include "bindings/modules/v8/ModuleBindingsInitializer.h" 8 #include "bindings/modules/v8/ModuleBindingsInitializer.h"
9 #include "core/EventTypeNames.h" 9 #include "core/EventTypeNames.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
11 #include "modules/EventModulesFactory.h" 11 #include "modules/EventModulesFactory.h"
12 #include "modules/EventModulesNames.h" 12 #include "modules/EventModulesNames.h"
13 #include "modules/EventTargetModulesNames.h" 13 #include "modules/EventTargetModulesNames.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 void ModulesInitializer::init()
18 {
19 ASSERT(!m_isInited);
20
21 // Strings must be initialized before calling CoreInitializer::init().
22 initEventNames();
23 initEventTargetNames();
24 registerEventFactory();
25 initBindings();
26
27 CoreInitializer::init();
28 }
abarth-chromium 2014/08/12 21:42:55 I'd add an ASSERT(m_isInited); at the end of this
cmumford 2014/08/12 22:26:35 Done.
29
17 void ModulesInitializer::initEventNames() 30 void ModulesInitializer::initEventNames()
18 { 31 {
19 EventNames::init();
20 EventNames::initModules(); 32 EventNames::initModules();
21 } 33 }
22 34
23 void ModulesInitializer::initEventTargetNames() 35 void ModulesInitializer::initEventTargetNames()
24 { 36 {
25 EventTargetNames::init();
26 EventTargetNames::initModules(); 37 EventTargetNames::initModules();
27 } 38 }
28 39
29 void ModulesInitializer::registerEventFactory() 40 void ModulesInitializer::registerEventFactory()
30 { 41 {
31 CoreInitializer::registerEventFactory();
32 Document::registerEventFactory(EventModulesFactory::create()); 42 Document::registerEventFactory(EventModulesFactory::create());
33 } 43 }
abarth-chromium 2014/08/12 21:42:55 Can you inline these functions into their one call
cmumford 2014/08/12 22:26:35 Done. Also took the liberty of doing the same with
34 44
35 void ModulesInitializer::initBindings() 45 void ModulesInitializer::initBindings()
36 { 46 {
37 ModuleBindingsInitializer::init(); 47 ModuleBindingsInitializer::init();
38 } 48 }
39 49
40 } // namespace blink 50 } // namespace blink
OLDNEW
« Source/core/Init.h ('K') | « Source/modules/InitModules.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698