Reviewed and landed by Brady Eidson.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Mar 2011 23:24:54 +0000 (23:24 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 Mar 2011 23:24:54 +0000 (23:24 +0000)
commitd83c87f85f924f6c8db8b3711c921cfed1d3fb81
treee997d4acc859c969601fd5a29bd5246f41b1c04e
parentc1bc4e74c66fdd95ae947f28dfea1c5754dc7441
Reviewed and landed by Brady Eidson.

Source/WebCore:

Patch by Anton D'Auria <adauria@apple.com> on 2011-03-11
Add WebKit1 API to view and delete local storage
https://bugs.webkit.org/show_bug.cgi?id=51878

Created StorageTracker as a central point for tracking and deleting LocalStorage per origin.
StorageTracker maintains its own database of origin identifiers and backing db paths,
and this allows it to contain more relational data in the future, like variable quotas per origin.

On initialization, StorageTracker syncs its database with LocalStorage files on disk. It adds
an origin entry when StorageAreaSync performs a first sync for an origin.

All StorageTracker file operations are performed on one background thread with a task queue.

Tests: storage/domstorage/localstorage/storagetracker/storage-tracker-1-prepare.html
       storage/domstorage/localstorage/storagetracker/storage-tracker-2-create.html
       storage/domstorage/localstorage/storagetracker/storage-tracker-3-delete-all.html
       storage/domstorage/localstorage/storagetracker/storage-tracker-4-create.html
       storage/domstorage/localstorage/storagetracker/storage-tracker-5-delete-one.html

* GNUmakefile.am:
* WebCore.exp.in:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* page/PageGroup.cpp:
(WebCore::PageGroup::clearLocalStorageForAllOrigins):
(WebCore::PageGroup::clearLocalStorageForOrigin):
(WebCore::PageGroup::syncLocalStorage):
(WebCore::PageGroup::numberOfPageGroups):
* page/PageGroup.h:
* platform/chromium/FileSystemChromium.cpp:
(WebCore::listDirectory):
* platform/posix/FileSystemPOSIX.cpp:
(WebCore::listDirectory):
* storage/LocalStorageTask.cpp:
(WebCore::LocalStorageTask::LocalStorageTask):
(WebCore::LocalStorageTask::performTask):
* storage/LocalStorageTask.h:
(WebCore::LocalStorageTask::createOriginIdentifiersImport):
(WebCore::LocalStorageTask::createSetOriginDetails):
(WebCore::LocalStorageTask::createDeleteOrigin):
(WebCore::LocalStorageTask::createDeleteAllOrigins):
* storage/StorageAreaImpl.cpp:
(WebCore::StorageAreaImpl::clearForOriginDeletion):
(WebCore::StorageAreaImpl::sync):
* storage/StorageAreaImpl.h:
* storage/StorageAreaSync.cpp:
(WebCore::StorageAreaSync::scheduleCloseDatabase):
(WebCore::StorageAreaSync::openDatabase):
(WebCore::StorageAreaSync::sync):
(WebCore::StorageAreaSync::deleteEmptyDatabase):
(WebCore::StorageAreaSync::scheduleSync):
* storage/StorageAreaSync.h:
* storage/StorageNamespace.h:
* storage/StorageNamespaceImpl.cpp:
(WebCore::StorageNamespaceImpl::clearOriginForDeletion):
(WebCore::StorageNamespaceImpl::clearAllOriginsForDeletion):
(WebCore::StorageNamespaceImpl::sync):
* storage/StorageNamespaceImpl.h:
* storage/StorageTracker.cpp: Added.
(WebCore::StorageTracker::initializeTracker):
(WebCore::StorageTracker::tracker):
(WebCore::StorageTracker::StorageTracker):
(WebCore::StorageTracker::setStorageDirectoryPath):
(WebCore::StorageTracker::trackerDatabasePath):
(WebCore::StorageTracker::openTrackerDatabase):
(WebCore::StorageTracker::importOriginIdentifiers):
(WebCore::StorageTracker::syncImportOriginIdentifiers):
(WebCore::StorageTracker::syncFileSystemAndTrackerDatabase):
(WebCore::StorageTracker::setOriginDetails):
(WebCore::StorageTracker::scheduleTask):
(WebCore::StorageTracker::syncSetOriginDetails):
(WebCore::StorageTracker::origins):
(WebCore::StorageTracker::deleteAllOrigins):
(WebCore::StorageTracker::syncDeleteAllOrigins):
(WebCore::StorageTracker::deleteOrigin):
(WebCore::StorageTracker::syncDeleteOrigin):
(WebCore::StorageTracker::willDeleteAllOrigins):
(WebCore::StorageTracker::willDeleteOrigin):
(WebCore::StorageTracker::canDeleteOrigin):
(WebCore::StorageTracker::cancelDeletingOrigin):
(WebCore::StorageTracker::setClient):
(WebCore::StorageTracker::syncLocalStorage):
* storage/StorageTracker.h: Added.
* storage/StorageTrackerClient.h: Added.
(WebCore::StorageTrackerClient::~StorageTrackerClient):

Source/WebKit:

Patch by Anton D'Auria <adauria@apple.com> on 2011-03-11
Add WebKit1 API to view and delete local storage
https://bugs.webkit.org/show_bug.cgi?id=51878

* WebKit.xcodeproj/project.pbxproj:

Source/WebKit/chromium:

Patch by Anton D'Auria <adauria@apple.com> on 2011-03-11
Add WebKit1 API to view and delete local storage
https://bugs.webkit.org/show_bug.cgi?id=51878

* src/StorageNamespaceProxy.cpp:
(WebCore::StorageNamespaceProxy::clearOriginForDeletion):
(WebCore::StorageNamespaceProxy::clearAllOriginsForDeletion):
(WebCore::StorageNamespaceProxy::sync):
* src/StorageNamespaceProxy.h:

Source/WebKit/mac:

Patch by Anton D'Auria <adauria@apple.com> on 2011-03-11
https://bugs.webkit.org/show_bug.cgi?id=51878
Add WebKit1 API to view and delete local storage

* Storage/WebStorageManager.mm: Added.
(+[WebStorageManager sharedWebStorageManager]):
(-[WebStorageManager origins]):
(-[WebStorageManager deleteAllOrigins]):
(-[WebStorageManager deleteOrigin:]):
(-[WebStorageManager syncLocalStorage]):
(-[WebStorageManager syncFileSystemAndTrackerDatabase]):
(storageDirectoryPath):
(WebKitInitializeStorageIfNecessary):
* Storage/WebStorageManagerInternal.h: Added.
* Storage/WebStorageManagerPrivate.h: Added.
* Storage/WebStorageTrackerClient.h: Added.
* Storage/WebStorageTrackerClient.mm: Added.
(WebStorageTrackerClient::sharedWebStorageTrackerClient):
(WebStorageTrackerClient::WebStorageTrackerClient):
(WebStorageTrackerClient::~WebStorageTrackerClient):
(WebStorageTrackerClient::dispatchDidModifyOriginOnMainThread):
(WebStorageTrackerClient::dispatchDidModifyOrigin):
* WebCoreSupport/WebSecurityOrigin.mm:
(-[WebSecurityOrigin protocol]):
(-[WebSecurityOrigin host]):
(-[WebSecurityOrigin databaseIdentifier]):
(-[WebSecurityOrigin domain]):
(-[WebSecurityOrigin _initWithWebCoreSecurityOrigin:]):
* WebCoreSupport/WebSecurityOriginPrivate.h:
* WebKit.exp:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):

Tools:

Patch by Anton D'Auria <adauria@apple.com> on 2011-03-11
https://bugs.webkit.org/show_bug.cgi?id=51878
Add WebKit1 API to view and delete local storage

Added tests that write to LocalStorage, delete one origin, get list of origins with local storage, delete all origins.

* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* DumpRenderTree/LayoutTestController.cpp:
(syncLocalStorageCallback):
(observeStorageTrackerNotificationsCallback):
(deleteAllLocalStorageCallback):
(deleteLocalStorageForOriginCallback):
(originsWithLocalStorageCallback):
(LayoutTestController::staticFunctions):
* DumpRenderTree/LayoutTestController.h:
* DumpRenderTree/StorageTrackerDelegate.h: Added.
* DumpRenderTree/StorageTrackerDelegate.mm: Added.
(-[StorageTrackerDelegate init]):
(-[StorageTrackerDelegate logNotifications:controller:]):
(-[StorageTrackerDelegate originModified:]):
(-[StorageTrackerDelegate dealloc]):
(-[StorageTrackerDelegate setControllerToNotifyDone:]):
* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::LayoutTestController):
(LayoutTestController::deleteAllLocalStorage):
(LayoutTestController::originsWithLocalStorage):
(LayoutTestController::deleteLocalStorageForOrigin):
(observeStorageTrackerNotifications):
(syncLocalStorage):
* DumpRenderTree/chromium/LayoutTestController.h:
* DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
(LayoutTestController::originsWithLocalStorage):
(LayoutTestController::deleteAllLocalStorage):
(LayoutTestController::deleteLocalStorageForOrigin):
(LayoutTestController::observeStorageTrackerNotifications):
(LayoutTestController::syncLocalStorage):
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetDefaultsToConsistentValues):
(allocateGlobalControllers):
(releaseGlobalControllers):
* DumpRenderTree/mac/DumpRenderTreeMac.h:
* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::syncLocalStorage):
(LayoutTestController::observeStorageTrackerNotifications):
(LayoutTestController::deleteAllLocalStorage):
(LayoutTestController::originsWithLocalStorage):
(LayoutTestController::deleteLocalStorageForOrigin):
* DumpRenderTree/qt/LayoutTestControllerQt.cpp:
(LayoutTestController::originsWithLocalStorage):
(LayoutTestController::deleteAllLocalStorage):
(LayoutTestController::deleteLocalStorageForOrigin):
(LayoutTestController::observeStorageTrackerNotifications):
(LayoutTestController::syncLocalStorage):
* DumpRenderTree/qt/LayoutTestControllerQt.h:
* DumpRenderTree/win/LayoutTestControllerWin.cpp:
(LayoutTestController::clearAllApplicationCaches):
(LayoutTestController::syncLocalStorage):
(LayoutTestController::observeStorageTrackerNotifications):
(LayoutTestController::clearAllDatabases):
(LayoutTestController::deleteAllLocalStorage):
(LayoutTestController::originsWithLocalStorage):
(LayoutTestController::deleteLocalStorageForOrigin):
* DumpRenderTree/wx/LayoutTestControllerWx.cpp:
(LayoutTestController::syncLocalStorage):
(LayoutTestController::observeStorageTrackerNotifications):
(LayoutTestController::clearAllDatabases):
(LayoutTestController::deleteAllLocalStorage):
(LayoutTestController::originsWithLocalStorage):
(LayoutTestController::deleteLocalStorageForOrigin):

LayoutTests:

Patch by Anton D'Auria <adauria@apple.com> on 2011-03-11
Add WebKit1 API to view and delete local storage
https://bugs.webkit.org/show_bug.cgi?id=51878

* platform/chromium/test_expectations.txt:
* storage/domstorage/localstorage/storagetracker: Added.
* storage/domstorage/localstorage/storagetracker/storage-tracker-1-prepare-expected.txt: Added.
* storage/domstorage/localstorage/storagetracker/storage-tracker-1-prepare.html: Added.
* storage/domstorage/localstorage/storagetracker/storage-tracker-2-create-expected.txt: Added.
* storage/domstorage/localstorage/storagetracker/storage-tracker-2-create.html: Added.
* storage/domstorage/localstorage/storagetracker/storage-tracker-3-delete-all-expected.txt: Added.
* storage/domstorage/localstorage/storagetracker/storage-tracker-3-delete-all.html: Added.
* storage/domstorage/localstorage/storagetracker/storage-tracker-4-create-expected.txt: Added.
* storage/domstorage/localstorage/storagetracker/storage-tracker-4-create.html: Added.
* storage/domstorage/localstorage/storagetracker/storage-tracker-5-delete-one-expected.txt: Added.
* storage/domstorage/localstorage/storagetracker/storage-tracker-5-delete-one.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80892 268f45cc-cd09-0410-ab3c-d52691b4dbfc
66 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/storage/domstorage/localstorage/storagetracker/storage-tracker-1-prepare-expected.txt [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/storagetracker/storage-tracker-1-prepare.html [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/storagetracker/storage-tracker-2-create-expected.txt [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/storagetracker/storage-tracker-2-create.html [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/storagetracker/storage-tracker-3-delete-all-expected.txt [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/storagetracker/storage-tracker-3-delete-all.html [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/storagetracker/storage-tracker-4-create-expected.txt [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/storagetracker/storage-tracker-4-create.html [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/storagetracker/storage-tracker-5-delete-one-expected.txt [new file with mode: 0644]
LayoutTests/storage/domstorage/localstorage/storagetracker/storage-tracker-5-delete-one.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.am
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.pro
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/PageGroup.cpp
Source/WebCore/page/PageGroup.h
Source/WebCore/platform/chromium/FileSystemChromium.cpp
Source/WebCore/platform/posix/FileSystemPOSIX.cpp
Source/WebCore/storage/LocalStorageTask.cpp
Source/WebCore/storage/LocalStorageTask.h
Source/WebCore/storage/StorageAreaImpl.cpp
Source/WebCore/storage/StorageAreaImpl.h
Source/WebCore/storage/StorageAreaSync.cpp
Source/WebCore/storage/StorageAreaSync.h
Source/WebCore/storage/StorageNamespace.h
Source/WebCore/storage/StorageNamespaceImpl.cpp
Source/WebCore/storage/StorageNamespaceImpl.h
Source/WebCore/storage/StorageTracker.cpp [new file with mode: 0644]
Source/WebCore/storage/StorageTracker.h [new file with mode: 0644]
Source/WebCore/storage/StorageTrackerClient.h [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/StorageNamespaceProxy.cpp
Source/WebKit/chromium/src/StorageNamespaceProxy.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Storage/WebStorageManager.mm [new file with mode: 0644]
Source/WebKit/mac/Storage/WebStorageManagerInternal.h [new file with mode: 0644]
Source/WebKit/mac/Storage/WebStorageManagerPrivate.h [new file with mode: 0644]
Source/WebKit/mac/Storage/WebStorageTrackerClient.h [new file with mode: 0644]
Source/WebKit/mac/Storage/WebStorageTrackerClient.mm [new file with mode: 0644]
Source/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
Source/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
Source/WebKit/mac/WebKit.exp
Source/WebKit/mac/WebView/WebView.mm
Tools/ChangeLog
Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
Tools/DumpRenderTree/LayoutTestController.cpp
Tools/DumpRenderTree/LayoutTestController.h
Tools/DumpRenderTree/StorageTrackerDelegate.h [new file with mode: 0644]
Tools/DumpRenderTree/StorageTrackerDelegate.mm [new file with mode: 0644]
Tools/DumpRenderTree/chromium/LayoutTestController.cpp
Tools/DumpRenderTree/chromium/LayoutTestController.h
Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/mac/DumpRenderTreeMac.h
Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm
Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp
Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp