Skip to content

Commit

Permalink
Rubber-stamped by Dan Bernstein.
Browse files Browse the repository at this point in the history
Move DOMObjectHashTableMap, DOMWrapperWorld and WebCoreJSClientData into
their own files.

* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/DOMObjectHashTableMap.cpp: Copied from bindings/js/JSDOMBinding.cpp.
* bindings/js/DOMObjectHashTableMap.h: Copied from bindings/js/JSDOMBinding.h.
(WebCore::DOMObjectHashTableMap::~DOMObjectHashTableMap):
(WebCore::DOMObjectHashTableMap::get):
* bindings/js/DOMWrapperWorld.cpp: Copied from bindings/js/JSDOMBinding.cpp.
(WebCore::forgetWorldOfDOMNodesForDocument):
* bindings/js/DOMWrapperWorld.h: Copied from bindings/js/JSDOMBinding.h.
(WebCore::DOMWrapperWorld::create):
(WebCore::DOMWrapperWorld::rememberDocument):
(WebCore::DOMWrapperWorld::forgetDocument):
(WebCore::DOMWrapperWorld::isNormal):
(WebCore::debuggerWorld):
(WebCore::pluginWorld):
(WebCore::currentWorld):
(WebCore::Document::getWrapperCache):
* bindings/js/JSDOMBinding.cpp:
* bindings/js/JSDOMBinding.h:
* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/ScriptController.cpp:
* bindings/js/WebCoreJSClientData.h: Copied from bindings/js/JSDOMBinding.h.
(WebCore::WebCoreJSClientData::WebCoreJSClientData):
(WebCore::WebCoreJSClientData::~WebCoreJSClientData):
(WebCore::WebCoreJSClientData::normalWorld):
(WebCore::WebCoreJSClientData::getAllWorlds):
(WebCore::WebCoreJSClientData::rememberWorld):
(WebCore::WebCoreJSClientData::forgetWorld):
* bindings/js/WorkerScriptController.cpp:



Canonical link: https://commits.webkit.org/46928@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Sam Weinig committed Mar 7, 2010
1 parent 2d7f08d commit a641b0b
Show file tree
Hide file tree
Showing 16 changed files with 434 additions and 172 deletions.
40 changes: 40 additions & 0 deletions WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
2010-03-06 Sam Weinig <sam@webkit.org>

Rubber-stamped by Dan Bernstein.

Move DOMObjectHashTableMap, DOMWrapperWorld and WebCoreJSClientData into
their own files.

* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/DOMObjectHashTableMap.cpp: Copied from bindings/js/JSDOMBinding.cpp.
* bindings/js/DOMObjectHashTableMap.h: Copied from bindings/js/JSDOMBinding.h.
(WebCore::DOMObjectHashTableMap::~DOMObjectHashTableMap):
(WebCore::DOMObjectHashTableMap::get):
* bindings/js/DOMWrapperWorld.cpp: Copied from bindings/js/JSDOMBinding.cpp.
(WebCore::forgetWorldOfDOMNodesForDocument):
* bindings/js/DOMWrapperWorld.h: Copied from bindings/js/JSDOMBinding.h.
(WebCore::DOMWrapperWorld::create):
(WebCore::DOMWrapperWorld::rememberDocument):
(WebCore::DOMWrapperWorld::forgetDocument):
(WebCore::DOMWrapperWorld::isNormal):
(WebCore::debuggerWorld):
(WebCore::pluginWorld):
(WebCore::currentWorld):
(WebCore::Document::getWrapperCache):
* bindings/js/JSDOMBinding.cpp:
* bindings/js/JSDOMBinding.h:
* bindings/js/JSDOMWindowBase.cpp:
* bindings/js/ScriptController.cpp:
* bindings/js/WebCoreJSClientData.h: Copied from bindings/js/JSDOMBinding.h.
(WebCore::WebCoreJSClientData::WebCoreJSClientData):
(WebCore::WebCoreJSClientData::~WebCoreJSClientData):
(WebCore::WebCoreJSClientData::normalWorld):
(WebCore::WebCoreJSClientData::getAllWorlds):
(WebCore::WebCoreJSClientData::rememberWorld):
(WebCore::WebCoreJSClientData::forgetWorld):
* bindings/js/WorkerScriptController.cpp:

2010-03-06 Dan Bernstein <mitz@apple.com>

Rubber-stamped by Sam Weinig.
Expand Down
5 changes: 5 additions & 0 deletions WebCore/GNUmakefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ webcore_sources += \
WebCore/accessibility/AccessibilityTableRow.cpp \
WebCore/accessibility/AccessibilityTableRow.h \
WebCore/bindings/js/CachedScriptSourceProvider.h \
WebCore/bindings/js/DOMObjectHashTableMap.cpp \
WebCore/bindings/js/DOMObjectHashTableMap.h \
WebCore/bindings/js/DOMWrapperWorld.cpp \
WebCore/bindings/js/DOMWrapperWorld.h \
WebCore/bindings/js/GCController.cpp \
WebCore/bindings/js/GCController.h \
WebCore/bindings/js/JSAttrCustom.cpp \
Expand Down Expand Up @@ -507,6 +511,7 @@ webcore_sources += \
WebCore/bindings/js/SerializedScriptValue.cpp \
WebCore/bindings/js/SerializedScriptValue.h \
WebCore/bindings/js/StringSourceProvider.h \
WebCore/bindings/js/WebCoreJSClientData.h \
WebCore/bindings/ScriptControllerBase.cpp \
WebCore/bridge/Bridge.h \
WebCore/bridge/IdentifierRep.cpp \
Expand Down
5 changes: 5 additions & 0 deletions WebCore/WebCore.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@
'bindings/generic/RuntimeEnabledFeatures.h',
'bindings/js/CachedScriptSourceProvider.h',
'bindings/js/DOMObjectWithSVGContext.h',
'bindings/js/DOMObjectHashTableMap.cpp',
'bindings/js/DOMObjectHashTableMap.h',
'bindings/js/DOMWrapperWorld.cpp',
'bindings/js/DOMWrapperWorld.h',
'bindings/js/GCController.cpp',
'bindings/js/GCController.h',
'bindings/js/JSCallbackData.cpp',
Expand Down Expand Up @@ -659,6 +663,7 @@
'bindings/js/ScriptValue.h',
'bindings/js/ScriptWrappable.h',
'bindings/js/StringSourceProvider.h',
'bindings/js/WebCoreJSClientData.h',
'bindings/js/WorkerScriptController.cpp',
'bindings/js/WorkerScriptController.h',
'bindings/ScriptControllerBase.cpp',
Expand Down
5 changes: 5 additions & 0 deletions WebCore/WebCore.pro
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ SOURCES += \
accessibility/AccessibilityTableRow.cpp \
accessibility/AXObjectCache.cpp \
bindings/js/GCController.cpp \
bindings/js/DOMObjectHashTableMap.cpp \
bindings/js/DOMWrapperWorld.cpp \
bindings/js/JSCallbackData.cpp \
bindings/js/JSAttrCustom.cpp \
bindings/js/JSCDATASectionCustom.cpp \
Expand Down Expand Up @@ -1001,6 +1003,8 @@ HEADERS += \
accessibility/AXObjectCache.h \
bindings/js/CachedScriptSourceProvider.h \
bindings/js/GCController.h \
bindings/js/DOMObjectHashTableMap.h \
bindings/js/DOMWrapperWorld.h \
bindings/js/JSCallbackData.h \
bindings/js/JSAudioConstructor.h \
bindings/js/JSCSSStyleDeclarationCustom.h \
Expand Down Expand Up @@ -1063,6 +1067,7 @@ HEADERS += \
bindings/js/ScriptWrappable.h \
bindings/js/SerializedScriptValue.h \
bindings/js/StringSourceProvider.h \
bindings/js/WebCoreJSClientData.h \
bindings/js/WorkerScriptController.h \
bridge/Bridge.h \
bridge/c/CRuntimeObject.h \
Expand Down
20 changes: 20 additions & 0 deletions WebCore/WebCore.vcproj/WebCore.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -34207,10 +34207,26 @@
RelativePath="..\bindings\js\CachedScriptSourceProvider.h"
>
</File>
<File
RelativePath="..\bindings\js\DOMObjectHashTableMap.cpp"
>
</File>
<File
RelativePath="..\bindings\js\DOMObjectHashTableMap.h"
>
</File>
<File
RelativePath="..\bindings\js\DOMObjectWithSVGContext.h"
>
</File>
<File
RelativePath="..\bindings\js\DOMWrapperWorld.cpp"
>
</File>
<File
RelativePath="..\bindings\js\DOMWrapperWorld.h"
>
</File>
<File
RelativePath="..\bindings\js\GCController.cpp"
>
Expand Down Expand Up @@ -40631,6 +40647,10 @@
RelativePath="..\bindings\js\StringSourceProvider.h"
>
</File>
<File
RelativePath="..\bindings\js\WebCoreJSClientData.h"
>
</File>
<File
RelativePath="..\bindings\js\WorkerScriptController.cpp"
>
Expand Down
28 changes: 22 additions & 6 deletions WebCore/WebCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3200,7 +3200,6 @@
A8EA800C0A19516E00A8EF5F /* StyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA80040A19516E00A8EF5F /* StyleSheet.h */; };
A8EA800D0A19516E00A8EF5F /* StyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA80050A19516E00A8EF5F /* StyleSheet.cpp */; };
A8EA800E0A19516E00A8EF5F /* MediaList.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA80060A19516E00A8EF5F /* MediaList.h */; };
A8EDB03D1016849400FE8113 /* DOMObjectWithSVGContext.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EDB03C1016849400FE8113 /* DOMObjectWithSVGContext.h */; };
A8F46A840CB20A9D003A9670 /* DOMSVGClipPathElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 8503612C0ACE007B001F3D9E /* DOMSVGClipPathElement.h */; };
A8F46A880CB20A9D003A9670 /* DOMSVGGradientElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85C9A2EC0AD7E90300FBFF1E /* DOMSVGGradientElement.h */; };
A8F46A890CB20A9D003A9670 /* DOMSVGAnimateColorElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 850361280ACE007B001F3D9E /* DOMSVGAnimateColorElement.h */; };
Expand Down Expand Up @@ -4259,6 +4258,11 @@
BC53C6080DA56C570021EB5D /* Gradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC53C6070DA56C570021EB5D /* Gradient.cpp */; };
BC53C60B0DA56CF10021EB5D /* GradientCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC53C60A0DA56CF10021EB5D /* GradientCG.cpp */; };
BC53C6920DA591140021EB5D /* CSSGradientValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC53C6910DA591140021EB5D /* CSSGradientValue.h */; };
BC53D911114310CC000D817E /* WebCoreJSClientData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC53D910114310CC000D817E /* WebCoreJSClientData.h */; };
BC53DA2E1143121E000D817E /* DOMWrapperWorld.h in Headers */ = {isa = PBXBuildFile; fileRef = BC53DA2D1143121E000D817E /* DOMWrapperWorld.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC53DA481143134D000D817E /* DOMWrapperWorld.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC53DA471143134D000D817E /* DOMWrapperWorld.cpp */; };
BC53DA601143141A000D817E /* DOMObjectHashTableMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BC53DA5F1143141A000D817E /* DOMObjectHashTableMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC53DA62114314BD000D817E /* DOMObjectHashTableMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC53DA61114314BD000D817E /* DOMObjectHashTableMap.cpp */; };
BC56CB2110D5AC8000A77C64 /* GeolocationController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC56CB1C10D5AC8000A77C64 /* GeolocationController.cpp */; };
BC56CB2210D5AC8000A77C64 /* GeolocationController.h in Headers */ = {isa = PBXBuildFile; fileRef = BC56CB1D10D5AC8000A77C64 /* GeolocationController.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC56CB2310D5AC8000A77C64 /* GeolocationControllerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC56CB1E10D5AC8000A77C64 /* GeolocationControllerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -8439,7 +8443,6 @@
A8EA80040A19516E00A8EF5F /* StyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StyleSheet.h; sourceTree = "<group>"; };
A8EA80050A19516E00A8EF5F /* StyleSheet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSheet.cpp; sourceTree = "<group>"; };
A8EA80060A19516E00A8EF5F /* MediaList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaList.h; sourceTree = "<group>"; };
A8EDB03C1016849400FE8113 /* DOMObjectWithSVGContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMObjectWithSVGContext.h; sourceTree = "<group>"; };
A8F4FB930C169E7B002AFED5 /* SVGRenderSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRenderSupport.h; sourceTree = "<group>"; };
A8F4FB950C169E85002AFED5 /* SVGRenderSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGRenderSupport.cpp; sourceTree = "<group>"; };
A8F5C0B60F9285AC0098E06B /* RenderSVGModelObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGModelObject.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -9539,6 +9542,11 @@
BC53C6070DA56C570021EB5D /* Gradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Gradient.cpp; sourceTree = "<group>"; };
BC53C60A0DA56CF10021EB5D /* GradientCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GradientCG.cpp; sourceTree = "<group>"; };
BC53C6910DA591140021EB5D /* CSSGradientValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSGradientValue.h; sourceTree = "<group>"; };
BC53D910114310CC000D817E /* WebCoreJSClientData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreJSClientData.h; sourceTree = "<group>"; };
BC53DA2D1143121E000D817E /* DOMWrapperWorld.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWrapperWorld.h; sourceTree = "<group>"; };
BC53DA471143134D000D817E /* DOMWrapperWorld.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWrapperWorld.cpp; sourceTree = "<group>"; };
BC53DA5F1143141A000D817E /* DOMObjectHashTableMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMObjectHashTableMap.h; sourceTree = "<group>"; };
BC53DA61114314BD000D817E /* DOMObjectHashTableMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMObjectHashTableMap.cpp; sourceTree = "<group>"; };
BC56CB1C10D5AC8000A77C64 /* GeolocationController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationController.cpp; sourceTree = "<group>"; };
BC56CB1D10D5AC8000A77C64 /* GeolocationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationController.h; sourceTree = "<group>"; };
BC56CB1E10D5AC8000A77C64 /* GeolocationControllerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationControllerClient.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -14676,14 +14684,16 @@
BC1A3793097C6FB10019F3D8 /* js */ = {
isa = PBXGroup;
children = (
65E0E9431133C89F00B4CB10 /* JSDOMWrapper.h */,
BCCE58A71061E82F008FB35A /* Callback Objects */,
BCCE58B41061E925008FB35A /* Constructors */,
BC4EDEF70C08F414007EDD49 /* Custom */,
14DFB33F0A7DF7630018F769 /* Derived Sources */,
BCD533630ED6848900887468 /* CachedScriptSourceProvider.h */,
93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */,
A8EDB03C1016849400FE8113 /* DOMObjectWithSVGContext.h */,
BCD533630ED6848900887468 /* CachedScriptSourceProvider.h */,
BC53DA61114314BD000D817E /* DOMObjectHashTableMap.cpp */,
BC53DA5F1143141A000D817E /* DOMObjectHashTableMap.h */,
BC53DA471143134D000D817E /* DOMWrapperWorld.cpp */,
BC53DA2D1143121E000D817E /* DOMWrapperWorld.h */,
1432E8480C51493F00B1500F /* GCController.cpp */,
1432E8460C51493800B1500F /* GCController.h */,
B5D3601E112F8BA80048DEA8 /* JSDatabaseCallback.cpp */,
Expand All @@ -14696,6 +14706,7 @@
BC6932720D7E293900AE44D1 /* JSDOMWindowBase.h */,
BCBFB53A0DCD29CF0019B3E5 /* JSDOMWindowShell.cpp */,
BCBFB53B0DCD29CF0019B3E5 /* JSDOMWindowShell.h */,
65E0E9431133C89F00B4CB10 /* JSDOMWrapper.h */,
BC60901E0E91B8EC000C68B5 /* JSEventTarget.cpp */,
BC60901D0E91B8EC000C68B5 /* JSEventTarget.h */,
3314ACE910892086000F0E56 /* JSExceptionBase.cpp */,
Expand Down Expand Up @@ -14748,6 +14759,7 @@
A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */,
A75E497410752ACB00C9B896 /* SerializedScriptValue.h */,
65488D6A0DD5A83D009D83B2 /* StringSourceProvider.h */,
BC53D910114310CC000D817E /* WebCoreJSClientData.h */,
E1A643FC0EC097A000779668 /* WorkerScriptController.cpp */,
E1A643F10EC0972500779668 /* WorkerScriptController.h */,
);
Expand Down Expand Up @@ -16636,7 +16648,6 @@
85CA96EA0A9624E900690CCF /* DOMNotation.h in Headers */,
85E711D40AC5D5350053270F /* DOMNotationInternal.h in Headers */,
856C8AE40A912649005C687B /* DOMObject.h in Headers */,
A8EDB03D1016849400FE8113 /* DOMObjectWithSVGContext.h in Headers */,
85C7F5D00AAFB8D9004014DD /* DOMOverflowEvent.h in Headers */,
85989DCF0ACC8BBD00A0BC51 /* DOMOverflowEventInternal.h in Headers */,
E1284BD61044A01E00EAEB52 /* DOMPageTransitionEvent.h in Headers */,
Expand Down Expand Up @@ -18648,6 +18659,9 @@
626CDE0F1140424C001E5A68 /* SpatialNavigation.h in Headers */,
B5D3601A112F8B560048DEA8 /* DatabaseCallback.h in Headers */,
B5D3601D112F8BA00048DEA8 /* JSDatabaseCallback.h in Headers */,
BC53D911114310CC000D817E /* WebCoreJSClientData.h in Headers */,
BC53DA2E1143121E000D817E /* DOMWrapperWorld.h in Headers */,
BC53DA601143141A000D817E /* DOMObjectHashTableMap.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -20843,6 +20857,8 @@
7637C541112E7B74003D6CDC /* WebSocketHandshakeRequest.cpp in Sources */,
626CDE0E1140424C001E5A68 /* SpatialNavigation.cpp in Sources */,
B5D3601F112F8BA80048DEA8 /* JSDatabaseCallback.cpp in Sources */,
BC53DA481143134D000D817E /* DOMWrapperWorld.cpp in Sources */,
BC53DA62114314BD000D817E /* DOMObjectHashTableMap.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
37 changes: 37 additions & 0 deletions WebCore/bindings/js/DOMObjectHashTableMap.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "config.h"
#include "DOMObjectHashTableMap.h"

#include "WebCoreJSClientData.h"

using namespace JSC;

namespace WebCore{

DOMObjectHashTableMap& DOMObjectHashTableMap::mapFor(JSGlobalData& globalData)
{
JSGlobalData::ClientData* clientData = globalData.clientData;
ASSERT(clientData);
return static_cast<WebCoreJSClientData*>(clientData)->hashTableMap;
}

} // namespace WebCore
60 changes: 60 additions & 0 deletions WebCore/bindings/js/DOMObjectHashTableMap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
* Copyright (C) 2009 Google, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef DOMObjectHashTableMap_h
#define DOMObjectHashTableMap_h

#include <runtime/Lookup.h>
#include <wtf/HashMap.h>

namespace JSC {
class JSGlobalData;
}

namespace WebCore {

// Map from static HashTable instances to per-GlobalData ones.
class DOMObjectHashTableMap {
public:
static DOMObjectHashTableMap& mapFor(JSC::JSGlobalData&);

~DOMObjectHashTableMap()
{
HashMap<const JSC::HashTable*, JSC::HashTable>::iterator mapEnd = m_map.end();
for (HashMap<const JSC::HashTable*, JSC::HashTable>::iterator iter = m_map.begin(); iter != m_map.end(); ++iter)
iter->second.deleteTable();
}

const JSC::HashTable* get(const JSC::HashTable* staticTable)
{
HashMap<const JSC::HashTable*, JSC::HashTable>::iterator iter = m_map.find(staticTable);
if (iter != m_map.end())
return &iter->second;
return &m_map.set(staticTable, JSC::HashTable(*staticTable)).first->second;
}

private:
HashMap<const JSC::HashTable*, JSC::HashTable> m_map;
};

} // namespace WebCore

#endif // DOMObjectHashTableMap_h
Loading

0 comments on commit a641b0b

Please sign in to comment.