Commit 2cfbe4c4 authored by beidson@apple.com's avatar beidson@apple.com

2008-05-05 Brady Eidson <beidson@apple.com>

        Reviewed by Mitz Pettel RTL

        Preparation for upcoming work making LocalStorage persistent.

        StorageMaps normally have copy-on-write semantics to help support SessionStorage.
        For LocalStorage, we never want this behavior.  When we forcefully import items into 
        a StorageMap from the LocalStorage background thread, this new import method will be used.

        * storage/StorageMap.cpp:
        (WebCore::StorageMap::importItem): Add a deep-copy of the item to the map without worrying
          about copy-on-write.
        * storage/StorageMap.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32897 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent eb9e605a
2008-05-05 Brady Eidson <beidson@apple.com>
Reviewed by Mitz Pettel RTL
Preparation for upcoming work making LocalStorage persistent.
StorageMaps normally have copy-on-write semantics to help support SessionStorage.
For LocalStorage, we never want this behavior. When we forcefully import items into
a StorageMap from the LocalStorage background thread, this new import method will be used.
* storage/StorageMap.cpp:
(WebCore::StorageMap::importItem): Add a deep-copy of the item to the map without worrying
about copy-on-write.
* storage/StorageMap.h:
2008-05-05 Kevin McCullough <kmccullough@apple.com>
Reviewed by Tim.
......@@ -145,4 +145,14 @@ bool StorageMap::contains(const String& key) const
return m_map.contains(key);
}
void StorageMap::importItem(const String& key, const String& value) const
{
// Be sure to copy the keys/values as items imported on a background thread are destined
// to cross a thread boundary
pair<HashMap<String, String>::iterator, bool> result = m_map.add(key.copy(), String());
if (result.second)
result.first->second = value.copy();
}
}
......@@ -47,6 +47,8 @@ namespace WebCore {
bool contains(const String& key) const;
void importItem(const String& key, const String& value) const;
private:
StorageMap();
PassRefPtr<StorageMap> copy();
......
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