Commit 5ab43290 authored by jorlow@chromium.org's avatar jorlow@chromium.org
Browse files

2009-09-30 Jeremy Orlow <jorlow@chromium.org>

        Reviewed by Darin Adler.

        Clean up use of const and mutable in StorageMap
        https://bugs.webkit.org/show_bug.cgi?id=29933

        What's the point of having every single member variable be mutable and nearly
        every method be const?  Let's clean it up.

        * storage/StorageMap.cpp:
        (WebCore::StorageMap::setIteratorToIndex):
        (WebCore::StorageMap::key):
        (WebCore::StorageMap::importItem):
        * storage/StorageMap.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48992 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 409426a4
2009-09-30 Jeremy Orlow <jorlow@chromium.org>
Reviewed by Darin Adler.
Clean up use of const and mutable in StorageMap
https://bugs.webkit.org/show_bug.cgi?id=29933
What's the point of having every single member variable be mutable and nearly
every method be const? Let's clean it up.
* storage/StorageMap.cpp:
(WebCore::StorageMap::setIteratorToIndex):
(WebCore::StorageMap::key):
(WebCore::StorageMap::importItem):
* storage/StorageMap.h:
2009-10-01 Beth Dakin <bdakin@apple.com>
 
Reviewed by Dave Hyatt.
......@@ -54,7 +54,7 @@ void StorageMap::invalidateIterator()
m_iteratorIndex = UINT_MAX;
}
void StorageMap::setIteratorToIndex(unsigned index) const
void StorageMap::setIteratorToIndex(unsigned index)
{
// FIXME: Once we have bidirectional iterators for HashMap we can be more intelligent about this.
// The requested index will be closest to begin(), our current iterator, or end(), and we
......@@ -82,7 +82,7 @@ unsigned StorageMap::length() const
return m_map.size();
}
String StorageMap::key(unsigned index) const
String StorageMap::key(unsigned index)
{
if (index >= length())
return String();
......@@ -145,7 +145,7 @@ bool StorageMap::contains(const String& key) const
return m_map.contains(key);
}
void StorageMap::importItem(const String& key, const String& value) const
void StorageMap::importItem(const String& key, const String& value)
{
// Be sure to copy the keys/values as items imported on a background thread are destined
// to cross a thread boundary
......
......@@ -42,24 +42,24 @@ namespace WebCore {
static PassRefPtr<StorageMap> create();
unsigned length() const;
String key(unsigned index) const;
String key(unsigned index);
String getItem(const String&) const;
PassRefPtr<StorageMap> setItem(const String& key, const String& value, String& oldValue);
PassRefPtr<StorageMap> removeItem(const String&, String& oldValue);
bool contains(const String& key) const;
void importItem(const String& key, const String& value) const;
void importItem(const String& key, const String& value);
private:
StorageMap();
PassRefPtr<StorageMap> copy();
void invalidateIterator();
void setIteratorToIndex(unsigned) const;
void setIteratorToIndex(unsigned);
mutable HashMap<String, String> m_map;
mutable HashMap<String, String>::iterator m_iterator;
mutable unsigned m_iteratorIndex;
HashMap<String, String> m_map;
HashMap<String, String>::iterator m_iterator;
unsigned m_iteratorIndex;
};
} // namespace WebCore
......
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