Use HashMap<OwnPtr> for SourceProviderCache items

https://bugs.webkit.org/show_bug.cgi?id=75346

Reviewed by Daniel Bates.

* parser/Parser.cpp:
* parser/SourceProviderCache.cpp:
(JSC::SourceProviderCache::clear):
(JSC::SourceProviderCache::add):
* parser/SourceProviderCache.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104318 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8b923b0d
2012-01-06 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
Use HashMap<OwnPtr> for SourceProviderCache items
https://bugs.webkit.org/show_bug.cgi?id=75346
Reviewed by Daniel Bates.
* parser/Parser.cpp:
* parser/SourceProviderCache.cpp:
(JSC::SourceProviderCache::clear):
(JSC::SourceProviderCache::add):
* parser/SourceProviderCache.h:
2012-01-06 Sam Weinig <sam@webkit.org>
Remove unused OwnFastMallocPtr class.
......@@ -30,7 +30,6 @@
#include "Lexer.h"
#include "NodeInfo.h"
#include "SourceProvider.h"
#include "SourceProviderCacheItem.h"
#include <utility>
#include <wtf/HashFunctions.h>
#include <wtf/OwnPtr.h>
......
......@@ -26,8 +26,6 @@
#include "config.h"
#include "SourceProviderCache.h"
#include "SourceProviderCacheItem.h"
namespace JSC {
SourceProviderCache::~SourceProviderCache()
......@@ -37,7 +35,6 @@ SourceProviderCache::~SourceProviderCache()
void SourceProviderCache::clear()
{
deleteAllValues(m_map);
m_map.clear();
m_contentByteSize = 0;
}
......@@ -49,7 +46,7 @@ unsigned SourceProviderCache::byteSize() const
void SourceProviderCache::add(int sourcePosition, PassOwnPtr<SourceProviderCacheItem> item, unsigned size)
{
m_map.add(sourcePosition, item.leakPtr());
m_map.add(sourcePosition, item);
m_contentByteSize += size;
}
......
......@@ -26,13 +26,13 @@
#ifndef SourceProviderCache_h
#define SourceProviderCache_h
#include "SourceProviderCacheItem.h"
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
namespace JSC {
class SourceProviderCacheItem;
class SourceProviderCache {
public:
SourceProviderCache() : m_contentByteSize(0) {}
......@@ -44,7 +44,7 @@ public:
const SourceProviderCacheItem* get(int sourcePosition) const { return m_map.get(sourcePosition); }
private:
HashMap<int, SourceProviderCacheItem*> m_map;
HashMap<int, OwnPtr<SourceProviderCacheItem> > m_map;
unsigned m_contentByteSize;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment