OLD | NEW |
---|---|
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 "ModulesInitializer.h" | 5 #include "ModulesInitializer.h" |
6 | 6 |
7 #include "bindings/modules/v8/ModuleBindingsInitializer.h" | 7 #include "bindings/modules/v8/ModuleBindingsInitializer.h" |
8 #include "core/EventTypeNames.h" | 8 #include "core/EventTypeNames.h" |
9 #include "core/css/CSSPaintImageGenerator.h" | 9 #include "core/css/CSSPaintImageGenerator.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
11 #include "core/html/HTMLCanvasElement.h" | 11 #include "core/html/HTMLCanvasElement.h" |
12 #include "core/offscreencanvas/OffscreenCanvas.h" | 12 #include "core/offscreencanvas/OffscreenCanvas.h" |
13 #include "modules/EventModulesFactory.h" | 13 #include "modules/EventModulesFactory.h" |
14 #include "modules/EventModulesNames.h" | 14 #include "modules/EventModulesNames.h" |
15 #include "modules/EventTargetModulesNames.h" | 15 #include "modules/EventTargetModulesNames.h" |
16 #include "modules/IndexedDBNames.h" | 16 #include "modules/IndexedDBNames.h" |
17 #include "modules/accessibility/AXObjectCacheImpl.h" | 17 #include "modules/accessibility/AXObjectCacheImpl.h" |
18 #include "modules/canvas2d/CanvasRenderingContext2D.h" | 18 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
19 #include "modules/compositorworker/CompositorWorkerThread.h" | 19 #include "modules/compositorworker/CompositorWorkerThread.h" |
20 #include "modules/csspaint/CSSPaintImageGeneratorImpl.h" | 20 #include "modules/csspaint/CSSPaintImageGeneratorImpl.h" |
21 #include "modules/filesystem/DraggedIsolatedFileSystemImpl.h" | 21 #include "modules/filesystem/DraggedIsolatedFileSystemImpl.h" |
22 #include "modules/imagebitmap/ImageBitmapRenderingContext.h" | 22 #include "modules/imagebitmap/ImageBitmapRenderingContext.h" |
23 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" | 23 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" |
24 #include "modules/time_zone_monitor/TimeZoneMonitorClient.h" | |
24 #include "modules/webdatabase/DatabaseManager.h" | 25 #include "modules/webdatabase/DatabaseManager.h" |
25 #include "modules/webgl/WebGL2RenderingContext.h" | 26 #include "modules/webgl/WebGL2RenderingContext.h" |
26 #include "modules/webgl/WebGLRenderingContext.h" | 27 #include "modules/webgl/WebGLRenderingContext.h" |
27 #include "wtf/PtrUtil.h" | 28 #include "wtf/PtrUtil.h" |
28 | 29 |
29 namespace blink { | 30 namespace blink { |
30 | 31 |
31 void ModulesInitializer::initialize() { | 32 void ModulesInitializer::initialize() { |
32 ASSERT(!isInitialized()); | 33 ASSERT(!isInitialized()); |
33 | 34 |
34 // Strings must be initialized before calling CoreInitializer::init(). | 35 // Strings must be initialized before calling CoreInitializer::init(). |
35 const unsigned modulesStaticStringsCount = | 36 const unsigned modulesStaticStringsCount = |
36 EventNames::EventModulesNamesCount + | 37 EventNames::EventModulesNamesCount + |
37 EventTargetNames::EventTargetModulesNamesCount + | 38 EventTargetNames::EventTargetModulesNamesCount + |
38 IndexedDBNames::IndexedDBNamesCount; | 39 IndexedDBNames::IndexedDBNamesCount; |
39 StringImpl::reserveStaticStringsCapacityForSize(modulesStaticStringsCount); | 40 StringImpl::reserveStaticStringsCapacityForSize(modulesStaticStringsCount); |
40 | 41 |
41 EventNames::initModules(); | 42 EventNames::initModules(); |
42 EventTargetNames::initModules(); | 43 EventTargetNames::initModules(); |
43 Document::registerEventFactory(EventModulesFactory::create()); | 44 Document::registerEventFactory(EventModulesFactory::create()); |
44 ModuleBindingsInitializer::init(); | 45 ModuleBindingsInitializer::init(); |
45 IndexedDBNames::init(); | 46 IndexedDBNames::init(); |
46 AXObjectCache::init(AXObjectCacheImpl::create); | 47 AXObjectCache::init(AXObjectCacheImpl::create); |
47 DraggedIsolatedFileSystem::init( | 48 DraggedIsolatedFileSystem::init( |
48 DraggedIsolatedFileSystemImpl::prepareForDataObject); | 49 DraggedIsolatedFileSystemImpl::prepareForDataObject); |
49 CSSPaintImageGenerator::init(CSSPaintImageGeneratorImpl::create); | 50 CSSPaintImageGenerator::init(CSSPaintImageGeneratorImpl::create); |
51 // Some unit tests may have no message loop ready, so we can't initialize the | |
52 // mojo stuff here. They can initialize those mojo stuff they're interested in | |
53 // later after they got a message loop ready. | |
54 if (Platform::isMessageLoopReady()) | |
kinuko
2016/11/08 03:22:56
Huh this is sad :( (and read all the threads about
| |
55 TimeZoneMonitorClient::Init(); | |
50 | 56 |
51 CoreInitializer::initialize(); | 57 CoreInitializer::initialize(); |
52 | 58 |
53 // Canvas context types must be registered with the HTMLCanvasElement. | 59 // Canvas context types must be registered with the HTMLCanvasElement. |
54 HTMLCanvasElement::registerRenderingContextFactory( | 60 HTMLCanvasElement::registerRenderingContextFactory( |
55 wrapUnique(new CanvasRenderingContext2D::Factory())); | 61 wrapUnique(new CanvasRenderingContext2D::Factory())); |
56 HTMLCanvasElement::registerRenderingContextFactory( | 62 HTMLCanvasElement::registerRenderingContextFactory( |
57 wrapUnique(new WebGLRenderingContext::Factory())); | 63 wrapUnique(new WebGLRenderingContext::Factory())); |
58 HTMLCanvasElement::registerRenderingContextFactory( | 64 HTMLCanvasElement::registerRenderingContextFactory( |
59 wrapUnique(new WebGL2RenderingContext::Factory())); | 65 wrapUnique(new WebGL2RenderingContext::Factory())); |
(...skipping 10 matching lines...) Expand all Loading... | |
70 } | 76 } |
71 | 77 |
72 void ModulesInitializer::shutdown() { | 78 void ModulesInitializer::shutdown() { |
73 ASSERT(isInitialized()); | 79 ASSERT(isInitialized()); |
74 DatabaseManager::terminateDatabaseThread(); | 80 DatabaseManager::terminateDatabaseThread(); |
75 CoreInitializer::shutdown(); | 81 CoreInitializer::shutdown(); |
76 CompositorWorkerThread::clearSharedBackingThread(); | 82 CompositorWorkerThread::clearSharedBackingThread(); |
77 } | 83 } |
78 | 84 |
79 } // namespace blink | 85 } // namespace blink |
OLD | NEW |