From fc8857f2f7f664e515e6e792c0d3f27ec4efaf9e Mon Sep 17 00:00:00 2001 From: "michaeln@google.com" Date: Fri, 7 Sep 2012 00:25:42 +0000 Subject: DomStorage: Clear the renderer side cache too when the user clears browsing data. Review URL: https://chromiumcodereview.appspot.com/10910045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155284 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/dom_storage/OWNERS | 1 + webkit/dom_storage/dom_storage_context.cc | 5 +++++ webkit/dom_storage/dom_storage_namespace.cc | 7 +++++++ webkit/dom_storage/dom_storage_namespace.h | 3 +++ 4 files changed, 16 insertions(+) (limited to 'webkit/dom_storage') diff --git a/webkit/dom_storage/OWNERS b/webkit/dom_storage/OWNERS index 3723f40..e765c6f 100644 --- a/webkit/dom_storage/OWNERS +++ b/webkit/dom_storage/OWNERS @@ -1 +1,2 @@ michaeln@chromium.org +marja@chromium.org diff --git a/webkit/dom_storage/dom_storage_context.cc b/webkit/dom_storage/dom_storage_context.cc index 9b4b7cb..667de83 100644 --- a/webkit/dom_storage/dom_storage_context.cc +++ b/webkit/dom_storage/dom_storage_context.cc @@ -111,6 +111,11 @@ void DomStorageContext::DeleteOrigin(const GURL& origin) { DCHECK(!is_shutdown_); DomStorageNamespace* local = GetStorageNamespace(kLocalStorageNamespaceId); local->DeleteOrigin(origin); + // Synthesize a 'cleared' event if the area is open so CachedAreas in + // renderers get emptied out too. + DomStorageArea* area = local->GetOpenStorageArea(origin); + if (area) + NotifyAreaCleared(area, origin); } void DomStorageContext::PurgeMemory() { diff --git a/webkit/dom_storage/dom_storage_namespace.cc b/webkit/dom_storage/dom_storage_namespace.cc index 693954c..e620fa6 100644 --- a/webkit/dom_storage/dom_storage_namespace.cc +++ b/webkit/dom_storage/dom_storage_namespace.cc @@ -63,6 +63,13 @@ void DomStorageNamespace::CloseStorageArea(DomStorageArea* area) { // The in-process-webkit based impl didn't do this either, but would be nice. } +DomStorageArea* DomStorageNamespace::GetOpenStorageArea(const GURL& origin) { + AreaHolder* holder = GetAreaHolder(origin); + if (holder && holder->open_count_) + return holder->area_; + return NULL; +} + DomStorageNamespace* DomStorageNamespace::Clone( int64 clone_namespace_id, const std::string& clone_persistent_namespace_id) { diff --git a/webkit/dom_storage/dom_storage_namespace.h b/webkit/dom_storage/dom_storage_namespace.h index ecc0f92..f1c0c07 100644 --- a/webkit/dom_storage/dom_storage_namespace.h +++ b/webkit/dom_storage/dom_storage_namespace.h @@ -47,6 +47,9 @@ class DomStorageNamespace DomStorageArea* OpenStorageArea(const GURL& origin); void CloseStorageArea(DomStorageArea* area); + // Returns the area for |origin| if it's open, otherwise NULL. + DomStorageArea* GetOpenStorageArea(const GURL& origin); + // Creates a clone of |this| namespace including // shallow copies of all contained areas. // Should only be called for session storage namespaces. -- cgit v1.1