Changeset 45162 in webkit
- Timestamp:
- Jun 25, 2009 1:19:46 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r45144 r45162 1 2009-06-25 Eric Seidel <eric@webkit.org> 2 3 No review, reverting r45144 only. 4 5 Roll out r45144 after 18 test failures appeared on the bots. 6 https://bugs.webkit.org/show_bug.cgi?id=26698 7 8 * GNUmakefile.am: 9 * WebCore.vcproj/WebCore.vcproj: 10 * WebCore.xcodeproj/project.pbxproj: 11 * WebCoreSources.bkl: 12 * storage/LocalStorage.cpp: 13 (WebCore::LocalStorage::storageArea): 14 * storage/LocalStorage.h: 15 * storage/SessionStorage.cpp: 16 (WebCore::SessionStorage::copy): 17 (WebCore::SessionStorage::storageArea): 18 * storage/SessionStorage.h: 19 * storage/StorageArea.cpp: 20 (WebCore::StorageArea::StorageArea): 21 (WebCore::StorageArea::~StorageArea): 22 (WebCore::StorageArea::setItem): 23 (WebCore::StorageArea::removeItem): 24 (WebCore::StorageArea::clear): 25 * storage/StorageArea.h: 26 * storage/StorageAreaSync.cpp: 27 (WebCore::StorageAreaSync::StorageAreaSync): 28 (WebCore::StorageAreaSync::scheduleFinalSync): 29 (WebCore::StorageAreaSync::syncTimerFired): 30 (WebCore::StorageAreaSync::performImport): 31 * storage/StorageAreaSync.h: 32 * storage/StorageSyncManager.h: 33 1 34 2009-06-24 Jeremy Orlow <jorlow@chromium.org> 2 35 -
trunk/WebCore/GNUmakefile.am
r45144 r45162 2088 2088 WebCore/storage/LocalStorage.cpp \ 2089 2089 WebCore/storage/LocalStorage.h \ 2090 WebCore/storage/LocalStorageArea.cpp \ 2091 WebCore/storage/LocalStorageArea.h \ 2090 2092 WebCore/storage/LocalStorageTask.cpp \ 2091 2093 WebCore/storage/LocalStorageTask.h \ … … 2094 2096 WebCore/storage/SessionStorage.cpp \ 2095 2097 WebCore/storage/SessionStorage.h \ 2098 WebCore/storage/SessionStorageArea.cpp \ 2099 WebCore/storage/SessionStorageArea.h \ 2096 2100 WebCore/storage/Storage.cpp \ 2097 2101 WebCore/storage/Storage.h \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r45144 r45162 29996 29996 </File> 29997 29997 <File 29998 RelativePath="..\storage\LocalStorageArea.cpp" 29999 > 30000 </File> 30001 <File 30002 RelativePath="..\storage\LocalStorageArea.h" 30003 > 30004 </File> 30005 <File 29998 30006 RelativePath="..\storage\LocalStorageTask.cpp" 29999 30007 > … … 30033 30041 <File 30034 30042 RelativePath="..\storage\SessionStorage.h" 30043 > 30044 </File> 30045 <File 30046 RelativePath="..\storage\SessionStorageArea.cpp" 30047 > 30048 </File> 30049 <File 30050 RelativePath="..\storage\SessionStorageArea.h" 30035 30051 > 30036 30052 </File> -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r45144 r45162 777 777 514B3F730C722047000530DF /* FileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 514B3F720C722047000530DF /* FileSystem.h */; }; 778 778 514B3F760C722055000530DF /* FileSystemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514B3F750C722055000530DF /* FileSystemMac.mm */; }; 779 514B49DB0DB6D6AD001C3770 /* LocalStorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 514B49D90DB6D6AD001C3770 /* LocalStorageArea.h */; }; 780 514B49DC0DB6D6AD001C3770 /* LocalStorageArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514B49DA0DB6D6AD001C3770 /* LocalStorageArea.cpp */; }; 781 514B49DF0DB6D6B6001C3770 /* SessionStorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 514B49DD0DB6D6B6001C3770 /* SessionStorageArea.h */; }; 782 514B49E00DB6D6B6001C3770 /* SessionStorageArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514B49DE0DB6D6B6001C3770 /* SessionStorageArea.cpp */; }; 779 783 514C76370CE9225E007EF3CD /* JSSQLError.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76350CE9225E007EF3CD /* JSSQLError.cpp */; }; 780 784 514C76380CE9225E007EF3CD /* JSSQLTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76360CE9225E007EF3CD /* JSSQLTransaction.cpp */; }; … … 5733 5737 514B3F720C722047000530DF /* FileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystem.h; sourceTree = "<group>"; }; 5734 5738 514B3F750C722055000530DF /* FileSystemMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileSystemMac.mm; sourceTree = "<group>"; }; 5739 514B49D90DB6D6AD001C3770 /* LocalStorageArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalStorageArea.h; sourceTree = "<group>"; }; 5740 514B49DA0DB6D6AD001C3770 /* LocalStorageArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalStorageArea.cpp; sourceTree = "<group>"; }; 5741 514B49DD0DB6D6B6001C3770 /* SessionStorageArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionStorageArea.h; sourceTree = "<group>"; }; 5742 514B49DE0DB6D6B6001C3770 /* SessionStorageArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SessionStorageArea.cpp; sourceTree = "<group>"; }; 5735 5743 514C76350CE9225E007EF3CD /* JSSQLError.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLError.cpp; sourceTree = "<group>"; }; 5736 5744 514C76360CE9225E007EF3CD /* JSSQLTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransaction.cpp; sourceTree = "<group>"; }; … … 9675 9683 51BE38260DAEF7DA001085FC /* LocalStorage.cpp */, 9676 9684 51BE38270DAEF7DA001085FC /* LocalStorage.h */, 9685 514B49DA0DB6D6AD001C3770 /* LocalStorageArea.cpp */, 9686 514B49D90DB6D6AD001C3770 /* LocalStorageArea.h */, 9677 9687 511F23130DC160DA004F0032 /* LocalStorageTask.cpp */, 9678 9688 511F23140DC160DA004F0032 /* LocalStorageTask.h */, … … 9702 9712 51E0BB220DA572A600A9E417 /* SessionStorage.cpp */, 9703 9713 51E0BB210DA572A600A9E417 /* SessionStorage.h */, 9714 514B49DE0DB6D6B6001C3770 /* SessionStorageArea.cpp */, 9715 514B49DD0DB6D6B6001C3770 /* SessionStorageArea.h */, 9704 9716 51E3F9C50DA059DC00250911 /* Storage.cpp */, 9705 9717 51E3F9C40DA059DC00250911 /* Storage.h */, … … 16173 16185 06E81ED70AB5D5E900C87837 /* LocalCurrentGraphicsContext.h in Headers */, 16174 16186 51BE38290DAEF7DA001085FC /* LocalStorage.h in Headers */, 16187 514B49DB0DB6D6AD001C3770 /* LocalStorageArea.h in Headers */, 16175 16188 511F23180DC160DA004F0032 /* LocalStorageTask.h in Headers */, 16176 16189 511F231A0DC160DA004F0032 /* LocalStorageThread.h in Headers */, … … 16612 16625 BC7FA6810D1F167900DB22A9 /* SelectorNodeList.h in Headers */, 16613 16626 51E0BB230DA572A600A9E417 /* SessionStorage.h in Headers */, 16627 514B49DF0DB6D6B6001C3770 /* SessionStorageArea.h in Headers */, 16614 16628 93309E10099E64920056E581 /* SetNodeAttributeCommand.h in Headers */, 16615 16629 93F1994F08245E59001E9ABC /* Settings.h in Headers */, … … 18256 18270 06E81EEC0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm in Sources */, 18257 18271 51BE38280DAEF7DA001085FC /* LocalStorage.cpp in Sources */, 18272 514B49DC0DB6D6AD001C3770 /* LocalStorageArea.cpp in Sources */, 18258 18273 511F23170DC160DA004F0032 /* LocalStorageTask.cpp in Sources */, 18259 18274 511F23190DC160DA004F0032 /* LocalStorageThread.cpp in Sources */, … … 18656 18671 BC7FA6820D1F167900DB22A9 /* SelectorNodeList.cpp in Sources */, 18657 18672 51E0BB240DA572A600A9E417 /* SessionStorage.cpp in Sources */, 18673 514B49E00DB6D6B6001C3770 /* SessionStorageArea.cpp in Sources */, 18658 18674 93309E0F099E64920056E581 /* SetNodeAttributeCommand.cpp in Sources */, 18659 18675 14C9A5EA0B3D105F005A0232 /* Settings.cpp in Sources */, -
trunk/WebCore/WebCoreSources.bkl
r45144 r45162 1012 1012 storage/DatabaseTracker.cpp 1013 1013 storage/LocalStorage.cpp 1014 storage/LocalStorageArea.cpp 1014 1015 storage/LocalStorageTask.cpp 1015 1016 storage/LocalStorageThread.cpp … … 1025 1026 storage/StorageMap.cpp 1026 1027 storage/SessionStorage.cpp 1028 storage/SessionStorageArea.cpp 1027 1029 storage/StorageAreaSync.cpp 1028 1030 storage/StorageSyncManager.cpp -
trunk/WebCore/storage/LocalStorage.cpp
r45144 r45162 34 34 #include "Frame.h" 35 35 #include "FrameTree.h" 36 #include "LocalStorageArea.h" 36 37 #include "Page.h" 37 38 #include "PageGroup.h" … … 90 91 // sync its existance and quota out to disk via an task of type AreaSync 91 92 92 RefPtr< StorageArea> storageArea;93 RefPtr<LocalStorageArea> storageArea; 93 94 if (storageArea = m_storageAreaMap.get(origin)) 94 95 return storageArea.release(); 95 96 96 storageArea = StorageArea::createLocalStorage(origin, m_syncManager);97 storageArea = LocalStorageArea::create(origin, m_syncManager); 97 98 m_storageAreaMap.set(origin, storageArea); 98 99 return storageArea.release(); -
trunk/WebCore/storage/LocalStorage.h
r45144 r45162 29 29 #if ENABLE(DOM_STORAGE) 30 30 31 #include "LocalStorageArea.h" 31 32 #include "SecurityOriginHash.h" 32 33 … … 52 53 LocalStorage(const String& path); 53 54 54 typedef HashMap<RefPtr<SecurityOrigin>, RefPtr< StorageArea>, SecurityOriginHash> LocalStorageAreaMap;55 typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<LocalStorageArea>, SecurityOriginHash> LocalStorageAreaMap; 55 56 LocalStorageAreaMap m_storageAreaMap; 56 57 -
trunk/WebCore/storage/SessionStorage.cpp
r45144 r45162 57 57 SessionStorageAreaMap::iterator end = m_storageAreaMap.end(); 58 58 for (SessionStorageAreaMap::iterator i = m_storageAreaMap.begin(); i != end; ++i) { 59 RefPtr<S torageArea> areaCopy = i->second->copy(i->first.get(), newPage);59 RefPtr<SessionStorageArea> areaCopy = i->second->copy(i->first.get(), newPage); 60 60 newSession->m_storageAreaMap.set(i->first, areaCopy.release()); 61 61 } … … 66 66 PassRefPtr<StorageArea> SessionStorage::storageArea(SecurityOrigin* origin) 67 67 { 68 RefPtr<S torageArea> storageArea;68 RefPtr<SessionStorageArea> storageArea; 69 69 if (storageArea = m_storageAreaMap.get(origin)) 70 70 return storageArea.release(); 71 71 72 storageArea = S torageArea::createSessionStorage(origin, m_page);72 storageArea = SessionStorageArea::create(origin, m_page); 73 73 m_storageAreaMap.set(origin, storageArea); 74 74 return storageArea.release(); -
trunk/WebCore/storage/SessionStorage.h
r45144 r45162 30 30 31 31 #include "SecurityOriginHash.h" 32 #include "S torageArea.h"32 #include "SessionStorageArea.h" 33 33 34 34 #include <wtf/HashMap.h> … … 57 57 Page* m_page; 58 58 59 typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<S torageArea>, SecurityOriginHash> SessionStorageAreaMap;59 typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<SessionStorageArea>, SecurityOriginHash> SessionStorageAreaMap; 60 60 SessionStorageAreaMap m_storageAreaMap; 61 61 }; -
trunk/WebCore/storage/StorageArea.cpp
r45144 r45162 29 29 #if ENABLE(DOM_STORAGE) 30 30 31 #include " EventNames.h"31 #include "CString.h" 32 32 #include "ExceptionCode.h" 33 33 #include "Frame.h" 34 34 #include "Page.h" 35 #include "PageGroup.h"36 35 #include "SecurityOrigin.h" 37 36 #include "Settings.h" 38 #include "StorageEvent.h"39 #include "StorageAreaSync.h"40 37 #include "StorageMap.h" 41 #include "StorageSyncManager.h"42 38 43 39 namespace WebCore { 44 40 45 PassRefPtr<StorageArea> StorageArea::createLocalStorage(SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager) 41 StorageArea::StorageArea(SecurityOrigin* origin) 42 : m_securityOrigin(origin) 43 , m_storageMap(StorageMap::create()) 46 44 { 47 return adoptRef(new StorageArea(origin, syncManager));48 45 } 49 46 50 StorageArea::StorageArea(SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager)47 StorageArea::StorageArea(SecurityOrigin* origin, StorageArea* area) 51 48 : m_securityOrigin(origin) 52 , m_storageMap(StorageMap::create()) 53 , m_storageSyncManager(syncManager) 54 , m_sessionStoragePage(0) 49 , m_storageMap(area->m_storageMap) 55 50 { 56 ASSERT(m_securityOrigin);57 ASSERT(m_storageMap);58 59 // FIXME: If there's no backing storage for LocalStorage, the default WebKit behavior should be that of private browsing,60 // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=2589461 if (m_storageSyncManager) {62 m_storageAreaSync = StorageAreaSync::create(m_storageSyncManager, this);63 ASSERT(m_storageAreaSync);64 }65 51 } 66 52 67 PassRefPtr<StorageArea> StorageArea::createSessionStorage(SecurityOrigin* origin, Page* page)53 StorageArea::~StorageArea() 68 54 { 69 return adoptRef(new StorageArea(origin, page, 0));70 }71 72 PassRefPtr<StorageArea> StorageArea::copy(SecurityOrigin* origin, Page* page)73 {74 return adoptRef(new StorageArea(origin, page, this));75 }76 77 StorageArea::StorageArea(SecurityOrigin* origin, Page* page, StorageArea* area)78 : m_securityOrigin(origin)79 , m_storageMap(area->m_storageMap)80 , m_sessionStoragePage(page)81 {82 ASSERT(m_securityOrigin);83 ASSERT(m_sessionStoragePage);84 85 if (!m_storageMap) {86 m_storageMap = StorageMap::create();87 ASSERT(m_storageMap);88 }89 55 } 90 56 … … 139 105 140 106 // Only notify the client if an item was actually changed 141 if (oldValue != value) { 142 if (m_storageAreaSync) 143 m_storageAreaSync->scheduleItemForSync(key, value); 144 dispatchStorageEvent(key, oldValue, value, frame); 145 } 107 if (oldValue != value) 108 itemChanged(key, oldValue, value, frame); 146 109 } 147 110 … … 159 122 160 123 // Only notify the client if an item was actually removed 161 if (!oldValue.isNull()) { 162 if (m_storageAreaSync) 163 m_storageAreaSync->scheduleItemForSync(key, String()); 164 dispatchStorageEvent(key, oldValue, String(), frame); 165 } 124 if (!oldValue.isNull()) 125 itemRemoved(key, oldValue, frame); 166 126 } 167 127 … … 175 135 m_storageMap = StorageMap::create(); 176 136 177 if (m_storageAreaSync) 178 m_storageAreaSync->scheduleClear(); 179 dispatchStorageEvent(String(), String(), String(), frame); 137 areaCleared(frame); 180 138 } 181 139 … … 192 150 } 193 151 194 void StorageArea::scheduleFinalSync()195 {196 if (m_storageAreaSync)197 m_storageAreaSync->scheduleFinalSync();198 }199 200 void StorageArea::blockUntilImportComplete() const201 {202 if (m_storageAreaSync)203 m_storageAreaSync->blockUntilImportComplete();204 }205 206 void StorageArea::dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame)207 {208 // We need to copy all relevant frames from every page to a vector since sending the event to one frame might mutate the frame tree209 // of any given page in the group or mutate the page group itself.210 Vector<RefPtr<Frame> > frames;211 212 if (m_sessionStoragePage) {213 // Send events only to our page.214 for (Frame* frame = m_sessionStoragePage->mainFrame(); frame; frame = frame->tree()->traverseNext()) {215 if (frame->document()->securityOrigin()->equal(securityOrigin()))216 frames.append(frame);217 }218 219 for (unsigned i = 0; i < frames.size(); ++i)220 frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), sourceFrame->domWindow(), frames[i]->domWindow()->sessionStorage()));221 } else {222 // FIXME: When can this occur?223 Page* page = sourceFrame->page();224 if (!page)225 return;226 227 // Send events to every page.228 const HashSet<Page*>& pages = page->group().pages();229 HashSet<Page*>::const_iterator end = pages.end();230 for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) {231 for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) {232 if (frame->document()->securityOrigin()->equal(securityOrigin()))233 frames.append(frame);234 }235 }236 237 for (unsigned i = 0; i < frames.size(); ++i)238 frames[i]->document()->dispatchWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->documentURI(), sourceFrame->domWindow(), frames[i]->domWindow()->localStorage()));239 }240 }241 242 152 } 243 153 -
trunk/WebCore/storage/StorageArea.h
r45144 r45162 30 30 31 31 #include "PlatformString.h" 32 #include "SecurityOrigin.h"33 #include "StorageAreaSync.h"34 #include "StorageMap.h"35 #include "StorageSyncManager.h"36 32 37 33 #include <wtf/Forward.h> … … 43 39 44 40 class Frame; 45 class Page;46 41 class SecurityOrigin; 47 class StorageAreaSync;48 42 class StorageMap; 49 class StorageSyncManager;50 43 typedef int ExceptionCode; 51 44 52 45 class StorageArea : public ThreadSafeShared<StorageArea> { 53 46 public: 54 static PassRefPtr<StorageArea> createLocalStorage(SecurityOrigin* origin, PassRefPtr<StorageSyncManager> syncManager); 55 static PassRefPtr<StorageArea> createSessionStorage(SecurityOrigin* origin, Page* page); 56 PassRefPtr<StorageArea> copy(SecurityOrigin*, Page*); 57 47 virtual ~StorageArea(); 48 58 49 // The HTML5 DOM Storage API 59 50 unsigned length() const; … … 65 56 66 57 bool contains(const String& key) const; 67 void scheduleFinalSync();68 58 69 59 // Could be called from a background thread. … … 72 62 73 63 protected: 74 StorageArea(SecurityOrigin*, PassRefPtr<StorageSyncManager>); 75 StorageArea(SecurityOrigin*, Page*); 76 StorageArea(SecurityOrigin*, Page*, StorageArea*); 64 StorageArea(SecurityOrigin*); 65 StorageArea(SecurityOrigin*, StorageArea*); 77 66 78 67 private: 79 void blockUntilImportComplete() const; 80 81 void dispatchStorageEvent(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame); 68 virtual void itemChanged(const String& key, const String& oldValue, const String& newValue, Frame* sourceFrame) = 0; 69 virtual void itemRemoved(const String& key, const String& oldValue, Frame* sourceFrame) = 0; 70 virtual void areaCleared(Frame* sourceFrame) = 0; 71 virtual void blockUntilImportComplete() const = 0; 82 72 83 73 RefPtr<SecurityOrigin> m_securityOrigin; 84 74 RefPtr<StorageMap> m_storageMap; 85 86 RefPtr<StorageAreaSync> m_storageAreaSync;87 RefPtr<StorageSyncManager> m_storageSyncManager;88 Page* m_sessionStoragePage; // NULL iff it's LocalStorage89 75 }; 90 76 -
trunk/WebCore/storage/StorageAreaSync.cpp
r45144 r45162 58 58 { 59 59 ASSERT(m_storageArea); 60 ASSERT(m_syncManager); 61 62 // FIXME: If it can't import, then the default WebKit behavior should be that of private browsing, 63 // not silently ignoring it. https://bugs.webkit.org/show_bug.cgi?id=25894 64 if (!m_syncManager->scheduleImport(this)) 60 if (!m_syncManager || !m_syncManager->scheduleImport(this)) 65 61 m_importComplete = true; 66 62 } … … 76 72 { 77 73 ASSERT(isMainThread()); 74 if (!m_syncManager) 75 return; 78 76 79 77 if (m_syncTimer.isActive()) … … 124 122 { 125 123 ASSERT(isMainThread()); 124 if (!m_syncManager) 125 return; 126 126 127 127 HashMap<String, String>::iterator it = m_changedItems.begin(); … … 162 162 ASSERT(!isMainThread()); 163 163 ASSERT(!m_database.isOpen()); 164 if (!m_syncManager) 165 return; 164 166 165 167 String databaseFilename = m_syncManager->fullDatabaseFilename(m_storageArea->securityOrigin()); -
trunk/WebCore/storage/StorageAreaSync.h
r45144 r45162 37 37 namespace WebCore { 38 38 39 class Frame;40 39 class StorageArea; 41 40 class StorageSyncManager; -
trunk/WebCore/storage/StorageSyncManager.h
r45144 r45162 29 29 #if ENABLE(DOM_STORAGE) 30 30 31 #include "LocalStorageArea.h" 31 32 #include "LocalStorageTask.h" 32 33 #include "LocalStorageThread.h" 33 #include "StorageArea.h"34 34 #include "StorageAreaSync.h" 35 35
Note: See TracChangeset
for help on using the changeset viewer.