2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
5 * Copyright (C) 2009 Google, Inc. All rights reserved.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef DOMObjectHashTableMap_h
23 #define DOMObjectHashTableMap_h
25 #include <runtime/Lookup.h>
26 #include <wtf/HashMap.h>
34 // Map from static HashTable instances to per-GlobalData ones.
35 class DOMObjectHashTableMap {
37 static DOMObjectHashTableMap& mapFor(JSC::JSGlobalData&);
39 ~DOMObjectHashTableMap()
41 for (HashMap<const JSC::HashTable*, JSC::HashTable>::iterator iter = m_map.begin(); iter != m_map.end(); ++iter)
42 iter->second.deleteTable();
45 const JSC::HashTable* get(const JSC::HashTable* staticTable)
47 HashMap<const JSC::HashTable*, JSC::HashTable>::iterator iter = m_map.find(staticTable);
48 if (iter != m_map.end())
50 return &m_map.set(staticTable, JSC::HashTable(*staticTable)).first->second;
54 HashMap<const JSC::HashTable*, JSC::HashTable> m_map;
57 } // namespace WebCore
59 #endif // DOMObjectHashTableMap_h