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

Side by Side Diff: third_party/WebKit/Source/modules/InitModules.cpp

Issue 1363653006: Reserve capacity for static strings HashMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the deduced string length (exclude NULL terminator) Created 5 years, 2 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
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "InitModules.h" 6 #include "InitModules.h"
7 7
8 #include "bindings/modules/v8/ModuleBindingsInitializer.h" 8 #include "bindings/modules/v8/ModuleBindingsInitializer.h"
9 #include "core/EventTypeNames.h" 9 #include "core/EventTypeNames.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 10 matching lines...) Expand all
21 #include "modules/webgl/WebGL2RenderingContext.h" 21 #include "modules/webgl/WebGL2RenderingContext.h"
22 #include "modules/webgl/WebGLRenderingContext.h" 22 #include "modules/webgl/WebGLRenderingContext.h"
23 23
24 namespace blink { 24 namespace blink {
25 25
26 void ModulesInitializer::init() 26 void ModulesInitializer::init()
27 { 27 {
28 ASSERT(!isInitialized()); 28 ASSERT(!isInitialized());
29 29
30 // Strings must be initialized before calling CoreInitializer::init(). 30 // Strings must be initialized before calling CoreInitializer::init().
31 const unsigned modulesStaticStringsCount = EventNames::EventModulesNamesCoun t
32 + EventTargetNames::EventTargetModulesNamesCount
33 + IndexedDBNames::IndexedDBNamesCount;
34 StringImpl::reserveStaticStringsCapacityForSize(modulesStaticStringsCount);
35
31 EventNames::initModules(); 36 EventNames::initModules();
32 EventTargetNames::initModules(); 37 EventTargetNames::initModules();
33 Document::registerEventFactory(EventModulesFactory::create()); 38 Document::registerEventFactory(EventModulesFactory::create());
34 ModuleBindingsInitializer::init(); 39 ModuleBindingsInitializer::init();
35 IndexedDBNames::init(); 40 IndexedDBNames::init();
36 AXObjectCache::init(AXObjectCacheImpl::create); 41 AXObjectCache::init(AXObjectCacheImpl::create);
37 DraggedIsolatedFileSystem::init(DraggedIsolatedFileSystemImpl::prepareForDat aObject); 42 DraggedIsolatedFileSystem::init(DraggedIsolatedFileSystemImpl::prepareForDat aObject);
38 43
39 CoreInitializer::init(); 44 CoreInitializer::init();
40 45
41 if (RuntimeEnabledFeatures::compositorWorkerEnabled()) 46 if (RuntimeEnabledFeatures::compositorWorkerEnabled())
42 CompositorWorkerManager::initialize(); 47 CompositorWorkerManager::initialize();
43 48
44 // Canvas context types must be registered with the HTMLCanvasElement. 49 // Canvas context types must be registered with the HTMLCanvasElement.
45 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new CanvasRender ingContext2D::Factory())); 50 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new CanvasRender ingContext2D::Factory()));
46 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGLRenderi ngContext::Factory())); 51 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGLRenderi ngContext::Factory()));
47 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGL2Render ingContext::Factory())); 52 HTMLCanvasElement::registerRenderingContextFactory(adoptPtr(new WebGL2Render ingContext::Factory()));
48 53
49 ASSERT(isInitialized()); 54 ASSERT(isInitialized());
50 } 55 }
51 56
52 void ModulesInitializer::terminateThreads() 57 void ModulesInitializer::terminateThreads()
53 { 58 {
54 if (RuntimeEnabledFeatures::compositorWorkerEnabled()) 59 if (RuntimeEnabledFeatures::compositorWorkerEnabled())
55 CompositorWorkerManager::shutdown(); 60 CompositorWorkerManager::shutdown();
56 DatabaseManager::terminateDatabaseThread(); 61 DatabaseManager::terminateDatabaseThread();
57 } 62 }
58 63
59 } // namespace blink 64 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/QualifiedName.cpp ('k') | third_party/WebKit/Source/wtf/HashMap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698