Changeset 144103 in webkit
- Timestamp:
- Feb 26, 2013, 1:54:50 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r144101 r144103 1 2013-02-26 Anders Carlsson <andersca@apple.com> 2 3 StorageMap can just import an entire map of items at once 4 https://bugs.webkit.org/show_bug.cgi?id=110904 5 6 Reviewed by Beth Dakin. 7 8 Instead of iterating over the map inside StorageAreaSync, just pass it directly 9 (through StorageAreaImpl) to StorageMap and iterate over it there. 10 11 * storage/StorageAreaImpl.cpp: 12 (WebCore::StorageAreaImpl::importItems): 13 * storage/StorageAreaImpl.h: 14 (StorageAreaImpl): 15 * storage/StorageAreaSync.cpp: 16 (WebCore::StorageAreaSync::performImport): 17 * storage/StorageMap.cpp: 18 (WebCore::StorageMap::importItems): 19 * storage/StorageMap.h: 20 (StorageMap): 21 1 22 2013-02-26 CHAUDHARY VINEET <rgf748@motorola.com> 2 23 -
trunk/Source/WebCore/storage/StorageAreaImpl.cpp
r143031 r144103 271 271 } 272 272 273 void StorageAreaImpl::importItem(const String& key, const String& value) 274 { 275 ASSERT(!m_isShutdown); 276 m_storageMap->importItem(key, value); 273 void StorageAreaImpl::importItems(const HashMap<String, String>& items) 274 { 275 ASSERT(!m_isShutdown); 276 277 m_storageMap->importItems(items); 277 278 } 278 279 -
trunk/Source/WebCore/storage/StorageAreaImpl.h
r143031 r144103 30 30 #include "Timer.h" 31 31 32 #include <wtf/HashMap.h> 32 33 #include <wtf/PassRefPtr.h> 33 34 #include <wtf/RefPtr.h> … … 65 66 66 67 // Only called from a background thread. 67 void importItem (const String& key, const String& value);68 void importItems(const HashMap<String, String>& items); 68 69 69 70 // Used to clear a StorageArea and close db before backing db file is deleted. -
trunk/Source/WebCore/storage/StorageAreaSync.cpp
r130612 r144103 342 342 } 343 343 344 HashMap<String, String>::iterator it = itemMap.begin(); 345 HashMap<String, String>::iterator end = itemMap.end(); 346 347 for (; it != end; ++it) 348 m_storageArea->importItem(it->key, it->value); 344 m_storageArea->importItems(itemMap); 349 345 350 346 markImported(); -
trunk/Source/WebCore/storage/StorageMap.cpp
r130612 r144103 168 168 } 169 169 170 void StorageMap::importItem (const String& key, const String& value)170 void StorageMap::importItems(const HashMap<String, String>& items) 171 171 { 172 // Be sure to copy the keys/values as items imported on a background thread are destined 173 // to cross a thread boundary 174 HashMap<String, String>::AddResult result = m_map.add(key.isolatedCopy(), value.isolatedCopy()); 175 ASSERT_UNUSED(result, result.isNewEntry); // True if the key didn't exist previously. 172 for (HashMap<String, String>::const_iterator it = items.begin(), end = items.end(); it != end; ++it) { 173 const String& key = it->key; 174 const String& value = it->value; 176 175 177 ASSERT(m_currentLength + key.length() >= m_currentLength); 178 m_currentLength += key.length(); 179 ASSERT(m_currentLength + value.length() >= m_currentLength); 180 m_currentLength += value.length(); 176 HashMap<String, String>::AddResult result = m_map.add(key, value); 177 ASSERT_UNUSED(result, result.isNewEntry); // True if the key didn't exist previously. 178 179 ASSERT(m_currentLength + key.length() >= m_currentLength); 180 m_currentLength += key.length(); 181 ASSERT(m_currentLength + value.length() >= m_currentLength); 182 m_currentLength += value.length(); 183 } 181 184 } 182 185 -
trunk/Source/WebCore/storage/StorageMap.h
r127757 r144103 48 48 bool contains(const String& key) const; 49 49 50 void importItem (const String& key, const String& value);50 void importItems(const HashMap<String, String>&); 51 51 52 52 unsigned quota() const { return m_quotaSize; }
Note:
See TracChangeset
for help on using the changeset viewer.