diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-24 00:22:52 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-24 00:22:52 +0000 |
commit | 0bdcc45f1f5a7895f506394ba80e7b2cea2105a4 (patch) | |
tree | b260aa44444d608fe39ba4a43c8baf84bea209b3 /webkit/dom_storage | |
parent | 206249b1ba6a490871ed72eeac9493c39678b105 (diff) | |
download | chromium_src-0bdcc45f1f5a7895f506394ba80e7b2cea2105a4.zip chromium_src-0bdcc45f1f5a7895f506394ba80e7b2cea2105a4.tar.gz chromium_src-0bdcc45f1f5a7895f506394ba80e7b2cea2105a4.tar.bz2 |
DomStorage async IPC message definitions and browser-side handlers. These messages aren't called yet by the renderer-side.
Review URL: https://chromiumcodereview.appspot.com/10160003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133576 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/dom_storage')
-rw-r--r-- | webkit/dom_storage/dom_storage_area.cc | 7 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_area.h | 3 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_host.cc | 10 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_host.h | 3 | ||||
-rw-r--r-- | webkit/dom_storage/dom_storage_map.h | 3 |
5 files changed, 25 insertions, 1 deletions
diff --git a/webkit/dom_storage/dom_storage_area.cc b/webkit/dom_storage/dom_storage_area.cc index ed4885b..f589d88 100644 --- a/webkit/dom_storage/dom_storage_area.cc +++ b/webkit/dom_storage/dom_storage_area.cc @@ -71,6 +71,13 @@ DomStorageArea::DomStorageArea( DomStorageArea::~DomStorageArea() { } +void DomStorageArea::ExtractValues(ValuesMap* map) { + if (is_shutdown_) + return; + InitialImportIfNeeded(); + map_->ExtractValues(map); +} + unsigned DomStorageArea::Length() { if (is_shutdown_) return 0; diff --git a/webkit/dom_storage/dom_storage_area.h b/webkit/dom_storage/dom_storage_area.h index 0bad246..b08ff1e 100644 --- a/webkit/dom_storage/dom_storage_area.h +++ b/webkit/dom_storage/dom_storage_area.h @@ -39,6 +39,9 @@ class DomStorageArea const GURL& origin() const { return origin_; } int64 namespace_id() const { return namespace_id_; } + // Writes a copy of the current set of values in the area to the |map|. + void ExtractValues(ValuesMap* map); + unsigned Length(); NullableString16 Key(unsigned index); NullableString16 GetItem(const string16& key); diff --git a/webkit/dom_storage/dom_storage_host.cc b/webkit/dom_storage/dom_storage_host.cc index 2e4ee56..1b468c8 100644 --- a/webkit/dom_storage/dom_storage_host.cc +++ b/webkit/dom_storage/dom_storage_host.cc @@ -47,6 +47,16 @@ void DomStorageHost::CloseStorageArea(int connection_id) { connections_.erase(found); } +bool DomStorageHost::ExtractAreaValues( + int connection_id, ValuesMap* map) { + map->clear(); + AreaMap::iterator found = connections_.find(connection_id); + if (found == connections_.end()) + return false; // Indicates the renderer gave us very bad data. + found->second.area_->ExtractValues(map); + return true; +} + unsigned DomStorageHost::GetAreaLength(int connection_id) { DomStorageArea* area = GetOpenArea(connection_id); if (!area) diff --git a/webkit/dom_storage/dom_storage_host.h b/webkit/dom_storage/dom_storage_host.h index 49efb7d..d6c74f3 100644 --- a/webkit/dom_storage/dom_storage_host.h +++ b/webkit/dom_storage/dom_storage_host.h @@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "base/nullable_string16.h" #include "base/string16.h" +#include "webkit/dom_storage/dom_storage_types.h" class GURL; @@ -34,7 +35,7 @@ class DomStorageHost { bool OpenStorageArea(int connection_id, int namespace_id, const GURL& origin); void CloseStorageArea(int connection_id); - + bool ExtractAreaValues(int connection_id, ValuesMap* map); unsigned GetAreaLength(int connection_id); NullableString16 GetAreaKey(int connection_id, unsigned index); NullableString16 GetAreaItem(int connection_id, const string16& key); diff --git a/webkit/dom_storage/dom_storage_map.h b/webkit/dom_storage/dom_storage_map.h index ed1ae89..5a4b682 100644 --- a/webkit/dom_storage/dom_storage_map.h +++ b/webkit/dom_storage/dom_storage_map.h @@ -35,6 +35,9 @@ class DomStorageMap // this method does not do quota checking. void SwapValues(ValuesMap* map); + // Writes a copy of the current set of values_ to the |map|. + void ExtractValues(ValuesMap* map) const { *map = values_; } + // Creates a new instance of DomStorageMap containing // a deep copy of values_. DomStorageMap* DeepCopy() const; |