| 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/dom/Document.h" | 10 #include "core/dom/Document.h" |
| 10 #include "core/html/HTMLCanvasElement.h" | 11 #include "core/html/HTMLCanvasElement.h" |
| 11 #include "core/offscreencanvas/OffscreenCanvas.h" | 12 #include "core/offscreencanvas/OffscreenCanvas.h" |
| 12 #include "modules/EventModulesFactory.h" | 13 #include "modules/EventModulesFactory.h" |
| 13 #include "modules/EventModulesNames.h" | 14 #include "modules/EventModulesNames.h" |
| 14 #include "modules/EventTargetModulesNames.h" | 15 #include "modules/EventTargetModulesNames.h" |
| 15 #include "modules/IndexedDBNames.h" | 16 #include "modules/IndexedDBNames.h" |
| 16 #include "modules/accessibility/AXObjectCacheImpl.h" | 17 #include "modules/accessibility/AXObjectCacheImpl.h" |
| 17 #include "modules/canvas2d/CanvasRenderingContext2D.h" | 18 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
| 18 #include "modules/compositorworker/CompositorWorkerThread.h" | 19 #include "modules/compositorworker/CompositorWorkerThread.h" |
| 20 #include "modules/csspaint/CSSPaintImageGeneratorImpl.h" |
| 19 #include "modules/filesystem/DraggedIsolatedFileSystemImpl.h" | 21 #include "modules/filesystem/DraggedIsolatedFileSystemImpl.h" |
| 20 #include "modules/imagebitmap/ImageBitmapRenderingContext.h" | 22 #include "modules/imagebitmap/ImageBitmapRenderingContext.h" |
| 21 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" | 23 #include "modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h" |
| 22 #include "modules/webdatabase/DatabaseManager.h" | 24 #include "modules/webdatabase/DatabaseManager.h" |
| 23 #include "modules/webgl/WebGL2RenderingContext.h" | 25 #include "modules/webgl/WebGL2RenderingContext.h" |
| 24 #include "modules/webgl/WebGLRenderingContext.h" | 26 #include "modules/webgl/WebGLRenderingContext.h" |
| 25 | 27 |
| 26 namespace blink { | 28 namespace blink { |
| 27 | 29 |
| 28 void ModulesInitializer::initialize() | 30 void ModulesInitializer::initialize() |
| 29 { | 31 { |
| 30 ASSERT(!isInitialized()); | 32 ASSERT(!isInitialized()); |
| 31 | 33 |
| 32 // Strings must be initialized before calling CoreInitializer::init(). | 34 // Strings must be initialized before calling CoreInitializer::init(). |
| 33 const unsigned modulesStaticStringsCount = EventNames::EventModulesNamesCoun
t | 35 const unsigned modulesStaticStringsCount = EventNames::EventModulesNamesCoun
t |
| 34 + EventTargetNames::EventTargetModulesNamesCount | 36 + EventTargetNames::EventTargetModulesNamesCount |
| 35 + IndexedDBNames::IndexedDBNamesCount; | 37 + IndexedDBNames::IndexedDBNamesCount; |
| 36 StringImpl::reserveStaticStringsCapacityForSize(modulesStaticStringsCount); | 38 StringImpl::reserveStaticStringsCapacityForSize(modulesStaticStringsCount); |
| 37 | 39 |
| 38 EventNames::initModules(); | 40 EventNames::initModules(); |
| 39 EventTargetNames::initModules(); | 41 EventTargetNames::initModules(); |
| 40 Document::registerEventFactory(EventModulesFactory::create()); | 42 Document::registerEventFactory(EventModulesFactory::create()); |
| 41 ModuleBindingsInitializer::init(); | 43 ModuleBindingsInitializer::init(); |
| 42 IndexedDBNames::init(); | 44 IndexedDBNames::init(); |
| 43 AXObjectCache::init(AXObjectCacheImpl::create); | 45 AXObjectCache::init(AXObjectCacheImpl::create); |
| 44 DraggedIsolatedFileSystem::init(DraggedIsolatedFileSystemImpl::prepareForDat
aObject); | 46 DraggedIsolatedFileSystem::init(DraggedIsolatedFileSystemImpl::prepareForDat
aObject); |
| 47 CSSPaintImageGenerator::init(CSSPaintImageGeneratorImpl::create); |
| 45 | 48 |
| 46 CoreInitializer::initialize(); | 49 CoreInitializer::initialize(); |
| 47 | 50 |
| 48 // Canvas context types must be registered with the HTMLCanvasElement. | 51 // Canvas context types must be registered with the HTMLCanvasElement. |
| 49 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new CanvasRender
ingContext2D::Factory())); | 52 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new CanvasRender
ingContext2D::Factory())); |
| 50 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGLRenderi
ngContext::Factory())); | 53 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGLRenderi
ngContext::Factory())); |
| 51 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGL2Render
ingContext::Factory())); | 54 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGL2Render
ingContext::Factory())); |
| 52 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new ImageBitmapR
enderingContext::Factory())); | 55 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new ImageBitmapR
enderingContext::Factory())); |
| 53 | 56 |
| 54 // OffscreenCanvas context types must be registered with the OffscreenCanvas
. | 57 // OffscreenCanvas context types must be registered with the OffscreenCanvas
. |
| 55 OffscreenCanvas::registerRenderingContextFactory(adoptPtr(new OffscreenCanva
sRenderingContext2D::Factory())); | 58 OffscreenCanvas::registerRenderingContextFactory(adoptPtr(new OffscreenCanva
sRenderingContext2D::Factory())); |
| 56 | 59 |
| 57 ASSERT(isInitialized()); | 60 ASSERT(isInitialized()); |
| 58 } | 61 } |
| 59 | 62 |
| 60 void ModulesInitializer::shutdown() | 63 void ModulesInitializer::shutdown() |
| 61 { | 64 { |
| 62 ASSERT(isInitialized()); | 65 ASSERT(isInitialized()); |
| 63 DatabaseManager::terminateDatabaseThread(); | 66 DatabaseManager::terminateDatabaseThread(); |
| 64 CompositorWorkerThread::clearSharedBackingThread(); | 67 CompositorWorkerThread::clearSharedBackingThread(); |
| 65 CoreInitializer::shutdown(); | 68 CoreInitializer::shutdown(); |
| 66 } | 69 } |
| 67 | 70 |
| 68 } // namespace blink | 71 } // namespace blink |
| OLD | NEW |