• beidson@apple.com's avatar
    Reviewed and landed by Brady Eidson. · c763e4c4
    beidson@apple.com authored
    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: http://svn.webkit.org/repository/webkit/trunk@80892 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    c763e4c4
PageGroup.cpp 11.8 KB