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