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/webdatabase/DatabaseManager.h" | 24 #include "modules/webdatabase/DatabaseManager.h" |
25 #include "modules/webgl/WebGL2RenderingContext.h" | 25 #include "modules/webgl/WebGL2RenderingContext.h" |
26 #include "modules/webgl/WebGLRenderingContext.h" | 26 #include "modules/webgl/WebGLRenderingContext.h" |
| 27 #include "wtf/PtrUtil.h" |
27 | 28 |
28 namespace blink { | 29 namespace blink { |
29 | 30 |
30 void ModulesInitializer::initialize() | 31 void ModulesInitializer::initialize() |
31 { | 32 { |
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 = EventNames::EventModulesNamesCoun
t | 36 const unsigned modulesStaticStringsCount = EventNames::EventModulesNamesCoun
t |
36 + EventTargetNames::EventTargetModulesNamesCount | 37 + EventTargetNames::EventTargetModulesNamesCount |
37 + IndexedDBNames::IndexedDBNamesCount; | 38 + IndexedDBNames::IndexedDBNamesCount; |
38 StringImpl::reserveStaticStringsCapacityForSize(modulesStaticStringsCount); | 39 StringImpl::reserveStaticStringsCapacityForSize(modulesStaticStringsCount); |
39 | 40 |
40 EventNames::initModules(); | 41 EventNames::initModules(); |
41 EventTargetNames::initModules(); | 42 EventTargetNames::initModules(); |
42 Document::registerEventFactory(EventModulesFactory::create()); | 43 Document::registerEventFactory(EventModulesFactory::create()); |
43 ModuleBindingsInitializer::init(); | 44 ModuleBindingsInitializer::init(); |
44 IndexedDBNames::init(); | 45 IndexedDBNames::init(); |
45 AXObjectCache::init(AXObjectCacheImpl::create); | 46 AXObjectCache::init(AXObjectCacheImpl::create); |
46 DraggedIsolatedFileSystem::init(DraggedIsolatedFileSystemImpl::prepareForDat
aObject); | 47 DraggedIsolatedFileSystem::init(DraggedIsolatedFileSystemImpl::prepareForDat
aObject); |
47 CSSPaintImageGenerator::init(CSSPaintImageGeneratorImpl::create); | 48 CSSPaintImageGenerator::init(CSSPaintImageGeneratorImpl::create); |
48 | 49 |
49 CoreInitializer::initialize(); | 50 CoreInitializer::initialize(); |
50 | 51 |
51 // Canvas context types must be registered with the HTMLCanvasElement. | 52 // Canvas context types must be registered with the HTMLCanvasElement. |
52 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new CanvasRender
ingContext2D::Factory())); | 53 HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new CanvasRend
eringContext2D::Factory())); |
53 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGLRenderi
ngContext::Factory())); | 54 HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new WebGLRende
ringContext::Factory())); |
54 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGL2Render
ingContext::Factory())); | 55 HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new WebGL2Rend
eringContext::Factory())); |
55 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new ImageBitmapR
enderingContext::Factory())); | 56 HTMLCanvasElement::registerRenderingContextFactory(wrapUnique(new ImageBitma
pRenderingContext::Factory())); |
56 | 57 |
57 // OffscreenCanvas context types must be registered with the OffscreenCanvas
. | 58 // OffscreenCanvas context types must be registered with the OffscreenCanvas
. |
58 OffscreenCanvas::registerRenderingContextFactory(adoptPtr(new OffscreenCanva
sRenderingContext2D::Factory())); | 59 OffscreenCanvas::registerRenderingContextFactory(wrapUnique(new OffscreenCan
vasRenderingContext2D::Factory())); |
59 OffscreenCanvas::registerRenderingContextFactory(adoptPtr(new WebGLRendering
Context::Factory())); | 60 OffscreenCanvas::registerRenderingContextFactory(wrapUnique(new WebGLRenderi
ngContext::Factory())); |
60 | 61 |
61 ASSERT(isInitialized()); | 62 ASSERT(isInitialized()); |
62 } | 63 } |
63 | 64 |
64 void ModulesInitializer::shutdown() | 65 void ModulesInitializer::shutdown() |
65 { | 66 { |
66 ASSERT(isInitialized()); | 67 ASSERT(isInitialized()); |
67 DatabaseManager::terminateDatabaseThread(); | 68 DatabaseManager::terminateDatabaseThread(); |
68 CoreInitializer::shutdown(); | 69 CoreInitializer::shutdown(); |
69 CompositorWorkerThread::clearSharedBackingThread(); | 70 CompositorWorkerThread::clearSharedBackingThread(); |
70 } | 71 } |
71 | 72 |
72 } // namespace blink | 73 } // namespace blink |
OLD | NEW |