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

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

Issue 305723002: Use method registration approach for creating events on core and modules. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebaseline Created 6 years, 6 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
« no previous file with comments | « Source/core/Init.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 28 matching lines...) Expand all
39 #include "HTMLNames.h" 39 #include "HTMLNames.h"
40 #include "HTMLTokenizerNames.h" 40 #include "HTMLTokenizerNames.h"
41 #include "InputTypeNames.h" 41 #include "InputTypeNames.h"
42 #include "MathMLNames.h" 42 #include "MathMLNames.h"
43 #include "MediaFeatureNames.h" 43 #include "MediaFeatureNames.h"
44 #include "MediaTypeNames.h" 44 #include "MediaTypeNames.h"
45 #include "SVGNames.h" 45 #include "SVGNames.h"
46 #include "XLinkNames.h" 46 #include "XLinkNames.h"
47 #include "XMLNSNames.h" 47 #include "XMLNSNames.h"
48 #include "XMLNames.h" 48 #include "XMLNames.h"
49 #include "core/dom/Document.h"
50 #include "core/events/EventFactory.h"
49 #include "core/html/parser/HTMLParserThread.h" 51 #include "core/html/parser/HTMLParserThread.h"
50 #include "platform/EventTracer.h" 52 #include "platform/EventTracer.h"
51 #include "platform/Partitions.h" 53 #include "platform/Partitions.h"
52 #include "platform/PlatformThreadData.h" 54 #include "platform/PlatformThreadData.h"
53 #include "platform/heap/Heap.h" 55 #include "platform/heap/Heap.h"
54 #include "wtf/text/StringStatics.h" 56 #include "wtf/text/StringStatics.h"
55 57
56 namespace WebCore { 58 namespace WebCore {
57 59
58 void CoreInitializer::initEventNames() 60 void CoreInitializer::initEventNames()
59 { 61 {
60 EventNames::init(); 62 EventNames::init();
61 } 63 }
62 64
63 void CoreInitializer::initEventTargetNames() 65 void CoreInitializer::initEventTargetNames()
64 { 66 {
65 EventTargetNames::init(); 67 EventTargetNames::init();
66 } 68 }
67 69
70 void CoreInitializer::registerEventFactory()
71 {
72 static bool isRegistered = false;
73 if (isRegistered)
74 return;
75 isRegistered = true;
76
77 Document::registerEventFactory(new EventFactory());
78 }
79
68 void CoreInitializer::init() 80 void CoreInitializer::init()
69 { 81 {
70 if (m_isInited) 82 if (m_isInited)
71 return; 83 return;
72 m_isInited = true; 84 m_isInited = true;
73 85
74 // It would make logical sense to do this and WTF::StringStatics::init() in 86 // It would make logical sense to do this and WTF::StringStatics::init() in
75 // WTF::initialize() but there are ordering dependencies. 87 // WTF::initialize() but there are ordering dependencies.
76 AtomicString::init(); 88 AtomicString::init();
77 HTMLNames::init(); 89 HTMLNames::init();
(...skipping 11 matching lines...) Expand all
89 HTMLTokenizerNames::init(); 101 HTMLTokenizerNames::init();
90 InputTypeNames::init(); 102 InputTypeNames::init();
91 MediaFeatureNames::init(); 103 MediaFeatureNames::init();
92 MediaTypeNames::init(); 104 MediaTypeNames::init();
93 105
94 WTF::StringStatics::init(); 106 WTF::StringStatics::init();
95 QualifiedName::init(); 107 QualifiedName::init();
96 Partitions::init(); 108 Partitions::init();
97 EventTracer::initialize(); 109 EventTracer::initialize();
98 110
111 registerEventFactory();
112
99 // Ensure that the main thread's thread-local data is initialized before 113 // Ensure that the main thread's thread-local data is initialized before
100 // starting any worker threads. 114 // starting any worker threads.
101 PlatformThreadData::current(); 115 PlatformThreadData::current();
102 116
103 StringImpl::freezeStaticStrings(); 117 StringImpl::freezeStaticStrings();
104 118
105 // Creates HTMLParserThread::shared, but does not start the thread. 119 // Creates HTMLParserThread::shared, but does not start the thread.
106 HTMLParserThread::init(); 120 HTMLParserThread::init();
107 } 121 }
108 122
109 void shutdown() 123 void shutdown()
110 { 124 {
111 // Make sure we stop the HTMLParserThread before Platform::current() is clea red. 125 // Make sure we stop the HTMLParserThread before Platform::current() is clea red.
112 HTMLParserThread::shutdown(); 126 HTMLParserThread::shutdown();
113 127
114 Partitions::shutdown(); 128 Partitions::shutdown();
115 } 129 }
116 130
117 } // namespace WebCore 131 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/Init.h ('k') | Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698