Changeset 76611 in webkit for trunk/Source/JavaScriptCore/parser/SourceProvider.h
- Timestamp:
- Jan 25, 2011, 10:44:11 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/parser/SourceProvider.h
r76177 r76611 30 30 #define SourceProvider_h 31 31 32 #include "SourceProviderCache.h" 32 33 #include "UString.h" 33 #include <wtf/HashMap.h>34 34 #include <wtf/PassOwnPtr.h> 35 35 #include <wtf/RefCounted.h> … … 37 37 #include <wtf/text/TextPosition.h> 38 38 39 40 39 namespace JSC { 41 42 class SourceProviderCache {43 public:44 struct Item {};45 46 SourceProviderCache() : m_contentByteSize(0) {}47 ~SourceProviderCache() { deleteAllValues(m_map); }48 49 unsigned byteSize() const { return m_contentByteSize + sizeof(*this) + m_map.capacity() * sizeof(Item*); }50 void add(int sourcePosition, PassOwnPtr<Item> item, unsigned size) { m_map.add(sourcePosition, item.leakPtr()); m_contentByteSize += size; }51 const Item* get(int sourcePosition) const { return m_map.get(sourcePosition); }52 53 private:54 HashMap<int, Item*> m_map;55 unsigned m_contentByteSize;56 };57 40 58 41 class SourceProvider : public RefCounted<SourceProvider> {
Note:
See TracChangeset
for help on using the changeset viewer.