Changeset 147354 in webkit
- Timestamp:
- Apr 1, 2013 1:05:25 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147353 r147354 1 2013-03-05 Anders Carlsson <andersca@apple.com> 2 3 Apply changes from storage events locally 4 https://bugs.webkit.org/show_bug.cgi?id=111502 5 6 Reviewed by Sam Weinig. 7 8 Add and export a helper function for setting an item without taking 9 into account the quota for the map. Also, reindent StorageMap.h 10 11 * WebCore.exp.in: 12 * storage/StorageMap.cpp: 13 (WebCore::StorageMap::setItemIgnoringQuota): 14 (WebCore): 15 * storage/StorageMap.h: 16 (StorageMap): 17 (WebCore::StorageMap::quota): 18 1 19 2013-04-01 Benjamin Poulain <benjamin@webkit.org> 2 20 -
trunk/Source/WebCore/WebCore.exp.in
r147039 r147354 86 86 __ZN7WebCore10ScrollView8addChildEN3WTF10PassRefPtrINS_6WidgetEEE 87 87 __ZN7WebCore10StorageMap11importItemsERKN3WTF7HashMapINS1_6StringES3_NS1_10StringHashENS1_10HashTraitsIS3_EES6_EE 88 __ZN7WebCore10StorageMap20setItemIgnoringQuotaERKN3WTF6StringES4_ 88 89 __ZN7WebCore10StorageMap3keyEj 89 90 __ZN7WebCore10StorageMap6createEj -
trunk/Source/WebCore/storage/StorageMap.cpp
r144103 r147354 27 27 #include "StorageMap.h" 28 28 29 #include <wtf/TemporaryChange.h> 30 29 31 namespace WebCore { 30 32 … … 141 143 } 142 144 145 PassRefPtr<StorageMap> StorageMap::setItemIgnoringQuota(const String& key, const String& value) 146 { 147 TemporaryChange<unsigned> quotaSizeChange(m_quotaSize, noQuota); 148 149 String oldValue; 150 bool quotaException; 151 152 RefPtr<StorageMap> map = setItem(key, value, oldValue, quotaException); 153 ASSERT(!quotaException); 154 155 return map.release(); 156 } 157 143 158 PassRefPtr<StorageMap> StorageMap::removeItem(const String& key, String& oldValue) 144 159 { -
trunk/Source/WebCore/storage/StorageMap.h
r144103 r147354 35 35 namespace WebCore { 36 36 37 38 39 40 37 class StorageMap : public RefCounted<StorageMap> { 38 public: 39 // Quota size measured in bytes. 40 static PassRefPtr<StorageMap> create(unsigned quotaSize); 41 41 42 unsigned length() const; 43 String key(unsigned index); 44 String getItem(const String&) const; 45 PassRefPtr<StorageMap> setItem(const String& key, const String& value, String& oldValue, bool& quota_exception); 46 PassRefPtr<StorageMap> removeItem(const String&, String& oldValue); 42 unsigned length() const; 43 String key(unsigned index); 44 String getItem(const String&) const; 45 PassRefPtr<StorageMap> setItem(const String& key, const String& value, String& oldValue, bool& quotaException); 46 PassRefPtr<StorageMap> setItemIgnoringQuota(const String& key, const String& value); 47 PassRefPtr<StorageMap> removeItem(const String&, String& oldValue); 47 48 48 49 bool contains(const String& key) const; 49 50 50 51 void importItems(const HashMap<String, String>&); 51 52 52 53 unsigned quota() const { return m_quotaSize; } 53 54 54 55 static const unsigned noQuota = UINT_MAX; 55 56 56 57 58 59 60 57 private: 58 explicit StorageMap(unsigned quota); 59 PassRefPtr<StorageMap> copy(); 60 void invalidateIterator(); 61 void setIteratorToIndex(unsigned); 61 62 62 63 64 63 HashMap<String, String> m_map; 64 HashMap<String, String>::iterator m_iterator; 65 unsigned m_iteratorIndex; 65 66 66 unsigned m_quotaSize;// Measured in bytes.67 unsigned m_currentLength;// Measured in UChars.68 67 unsigned m_quotaSize; // Measured in bytes. 68 unsigned m_currentLength; // Measured in UChars. 69 }; 69 70 70 71 } // namespace WebCore -
trunk/Source/WebKit2/ChangeLog
r147344 r147354 1 2013-03-05 Anders Carlsson <andersca@apple.com> 2 3 Apply changes from storage events locally 4 https://bugs.webkit.org/show_bug.cgi?id=111502 5 6 Reviewed by Sam Weinig. 7 8 * WebProcess/Storage/StorageAreaProxy.cpp: 9 (WebKit::StorageAreaProxy::StorageAreaProxy): 10 Store the security origin as a member variable. 11 12 (WebKit::StorageAreaProxy::dispatchStorageEvent): 13 Set the item and call the appropriate event dispatch function. 14 15 (WebKit::StorageAreaProxy::dispatchSessionStorageEvent): 16 (WebKit::StorageAreaProxy::dispatchLocalStorageEvent): 17 Add stubs. 18 19 * WebProcess/Storage/StorageAreaProxy.h: 20 1 21 2013-04-01 Alexey Proskuryakov <ap@apple.com> 2 22 -
trunk/Source/WebKit2/WebProcess/Storage/StorageAreaProxy.cpp
r144851 r147354 58 58 , m_quotaInBytes(storageNamespaceProxy->quotaInBytes()) 59 59 , m_storageAreaID(generateStorageAreaID()) 60 { 61 WebProcess::shared().connection()->send(Messages::StorageManager::CreateStorageArea(m_storageAreaID, storageNamespaceProxy->storageNamespaceID(), SecurityOriginData::fromSecurityOrigin(securityOrigin.get())), 0); 60 , m_securityOrigin(securityOrigin) 61 { 62 WebProcess::shared().connection()->send(Messages::StorageManager::CreateStorageArea(m_storageAreaID, storageNamespaceProxy->storageNamespaceID(), SecurityOriginData::fromSecurityOrigin(m_securityOrigin.get())), 0); 62 63 WebProcess::shared().addMessageReceiver(Messages::StorageAreaProxy::messageReceiverName(), m_storageAreaID, this); 63 64 } … … 217 218 return; 218 219 219 // FIXME: Implement this. 220 ASSERT(!key.isNull()); 221 ASSERT(!newValue.isNull()); 222 223 ASSERT(m_storageMap->hasOneRef()); 224 m_storageMap->setItemIgnoringQuota(key, newValue); 225 226 if (storageType() == SessionStorage) 227 dispatchSessionStorageEvent(key, oldValue, newValue, urlString); 228 else 229 dispatchLocalStorageEvent(key, oldValue, newValue, urlString); 220 230 } 221 231 … … 275 285 } 276 286 287 void StorageAreaProxy::dispatchSessionStorageEvent(const String& key, const String& oldValue, const String& newValue, const String& urlString) 288 { 289 ASSERT(storageType() == SessionStorage); 290 291 // FIXME: Implement. 292 } 293 294 void StorageAreaProxy::dispatchLocalStorageEvent(const String& key, const String& oldValue, const String& newValue, const String& urlString) 295 { 296 ASSERT(storageType() == LocalStorage); 297 298 // FIXME: Implement. 299 } 300 277 301 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/Storage/StorageAreaProxy.h
r144851 r147354 75 75 void resetValues(); 76 76 77 void dispatchSessionStorageEvent(const String& key, const String& oldValue, const String& newValue, const String& urlString); 78 void dispatchLocalStorageEvent(const String& key, const String& oldValue, const String& newValue, const String& urlString); 79 77 80 uint64_t m_storageNamespaceID; 78 81 unsigned m_quotaInBytes; 79 82 uint64_t m_storageAreaID; 83 84 RefPtr<WebCore::SecurityOrigin> m_securityOrigin; 80 85 RefPtr<WebCore::StorageMap> m_storageMap; 81 86 -
trunk/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.cpp
r144829 r147354 53 53 PassRefPtr<StorageArea> StorageNamespaceProxy::storageArea(PassRefPtr<SecurityOrigin> securityOrigin) 54 54 { 55 return StorageAreaProxy::create(this, securityOrigin); 55 printf("%p - looking for storage area in %s\n", this, securityOrigin->toString().utf8().data()); 56 HashMap<RefPtr<WebCore::SecurityOrigin>, RefPtr<StorageAreaProxy> >::AddResult result = m_storageAreaMap.add(securityOrigin.get(), 0); 57 if (result.isNewEntry) { 58 result.iterator->value = StorageAreaProxy::create(this, securityOrigin); 59 printf("new entry!!\n"); 60 } else { 61 printf("reusing!!\n"); 62 } 63 64 printf("returning %p\n", result.iterator->value.get()); 65 return result.iterator->value; 56 66 } 57 67 -
trunk/Source/WebKit2/WebProcess/Storage/StorageNamespaceProxy.h
r144829 r147354 27 27 #define StorageNamespaceProxy_h 28 28 29 #include <WebCore/SecurityOriginHash.h> 29 30 #include <WebCore/StorageArea.h> 30 31 #include <WebCore/StorageNamespace.h> 32 #include <wtf/HashMap.h> 31 33 32 34 namespace WebKit { 33 35 36 class StorageAreaProxy; 34 37 class WebPage; 35 38 … … 55 58 uint64_t m_storageNamespaceID; 56 59 unsigned m_quotaInBytes; 60 61 HashMap<RefPtr<WebCore::SecurityOrigin>, RefPtr<StorageAreaProxy> > m_storageAreaMap; 57 62 }; 58 63 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
r144499 r147354 61 61 62 62 // FIXME: Remove this once it works well enough to be the default. 63 #define ENABLE_UI_PROCESS_STORAGE 063 #define ENABLE_UI_PROCESS_STORAGE 1 64 64 65 65 using namespace WebCore;
Note: See TracChangeset
for help on using the changeset viewer.