diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-22 04:20:04 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-22 04:20:04 +0000 |
commit | 941b4c5b6303aad0b3426440cabdf7cb8a90be46 (patch) | |
tree | 220355a1e2688d841cc15b399e5929294f745b2f /chrome/browser/in_process_webkit | |
parent | d3e4400cfa37614dea465f711bb3ba7cef6b1bb8 (diff) | |
download | chromium_src-941b4c5b6303aad0b3426440cabdf7cb8a90be46.zip chromium_src-941b4c5b6303aad0b3426440cabdf7cb8a90be46.tar.gz chromium_src-941b4c5b6303aad0b3426440cabdf7cb8a90be46.tar.bz2 |
Create an enum for local storage vs. session storage rather than using
a boolean.
TEST=It still works.
BUG=21070
Review URL: http://codereview.chromium.org/212033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26793 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/in_process_webkit')
4 files changed, 15 insertions, 13 deletions
diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc index 49fdfda..ba3df60 100644 --- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc @@ -98,20 +98,20 @@ void DOMStorageDispatcherHost::Send(IPC::Message* message) { &DOMStorageDispatcherHost::Send, message)); } -void DOMStorageDispatcherHost::OnNamespaceId(bool is_local_storage, +void DOMStorageDispatcherHost::OnNamespaceId(DOMStorageType storage_type, IPC::Message* reply_msg) { DCHECK(!shutdown_); if (ChromeThread::CurrentlyOn(ChromeThread::IO)) { MessageLoop* webkit_loop = webkit_thread_->GetMessageLoop(); webkit_loop->PostTask(FROM_HERE, NewRunnableMethod(this, &DOMStorageDispatcherHost::OnNamespaceId, - is_local_storage, reply_msg)); + storage_type, reply_msg)); return; } DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); StorageNamespace* new_namespace; - if (is_local_storage) + if (storage_type == DOM_STORAGE_LOCAL) new_namespace = Context()->LocalStorage(); else new_namespace = Context()->NewSessionStorage(); diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h index 8f5c94d..d4a1d2a 100644 --- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h +++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h @@ -9,6 +9,7 @@ #include "base/ref_counted.h" #include "chrome/browser/in_process_webkit/storage_area.h" #include "chrome/browser/in_process_webkit/webkit_context.h" +#include "chrome/common/dom_storage_type.h" #include "ipc/ipc_message.h" class DOMStorageContext; @@ -37,7 +38,7 @@ class DOMStorageDispatcherHost : ~DOMStorageDispatcherHost(); // Message Handlers. - void OnNamespaceId(bool is_local_storage, IPC::Message* reply_msg); + void OnNamespaceId(DOMStorageType storage_type, IPC::Message* reply_msg); void OnCloneNamespaceId(int64 namespace_id, IPC::Message* reply_msg); void OnStorageAreaId(int64 namespace_id, const string16& origin, IPC::Message* reply_msg); diff --git a/chrome/browser/in_process_webkit/storage_namespace.cc b/chrome/browser/in_process_webkit/storage_namespace.cc index 25548c3..fa2c74a 100644 --- a/chrome/browser/in_process_webkit/storage_namespace.cc +++ b/chrome/browser/in_process_webkit/storage_namespace.cc @@ -26,7 +26,7 @@ StorageNamespace* StorageNamespace::CreateLocalStorageNamespace( WebStorageNamespace* web_storage_namespace = WebStorageNamespace::createLocalStorageNamespace(path); return new StorageNamespace(dom_storage_context, web_storage_namespace, id, - true); + DOM_STORAGE_LOCAL); } /* static */ @@ -37,16 +37,16 @@ StorageNamespace* StorageNamespace::CreateSessionStorageNamespace( WebStorageNamespace* web_storage_namespace = WebStorageNamespace::createSessionStorageNamespace(); return new StorageNamespace(dom_storage_context, web_storage_namespace, id, - false); + DOM_STORAGE_SESSION); } StorageNamespace::StorageNamespace(DOMStorageContext* dom_storage_context, WebStorageNamespace* storage_namespace, - int64 id, bool is_local_storage) + int64 id, DOMStorageType storage_type) : dom_storage_context_(dom_storage_context), storage_namespace_(storage_namespace), id_(id), - is_local_storage_(is_local_storage) { + storage_type_(storage_type) { DCHECK(dom_storage_context_); DCHECK(storage_namespace_); dom_storage_context_->RegisterStorageNamespace(this); @@ -82,12 +82,12 @@ StorageArea* StorageNamespace::GetStorageArea(const string16& origin) { } StorageNamespace* StorageNamespace::Copy() { - DCHECK(!is_local_storage_); + DCHECK(storage_type_ == DOM_STORAGE_SESSION); int64 id = dom_storage_context_->AllocateStorageNamespaceId(); DCHECK(!dom_storage_context_->GetStorageNamespace(id)); WebStorageNamespace* new_storage_namespace = storage_namespace_->copy(); return new StorageNamespace(dom_storage_context_, new_storage_namespace, id, - is_local_storage_); + storage_type_); } void StorageNamespace::Close() { diff --git a/chrome/browser/in_process_webkit/storage_namespace.h b/chrome/browser/in_process_webkit/storage_namespace.h index 4018f8f..91e0ae6 100644 --- a/chrome/browser/in_process_webkit/storage_namespace.h +++ b/chrome/browser/in_process_webkit/storage_namespace.h @@ -7,6 +7,7 @@ #include "base/string16.h" #include "base/hash_tables.h" +#include "chrome/common/dom_storage_type.h" class DOMStorageContext; class FilePath; @@ -36,7 +37,7 @@ class StorageNamespace { // Called by the static factory methods above. StorageNamespace(DOMStorageContext* dom_storage_context, WebKit::WebStorageNamespace* web_storage_namespace, - int64 id, bool is_local_storage); + int64 id, DOMStorageType storage_type); // All the storage areas we own. typedef base::hash_map<string16, StorageArea*> OriginToStorageAreaMap; @@ -51,8 +52,8 @@ class StorageNamespace { // Our id. Unique to our parent WebKitContext class. int64 id_; - // Is this a local storage namespace. - bool is_local_storage_; + // SessionStorage vs. LocalStorage. + const DOMStorageType storage_type_; DISALLOW_IMPLICIT_CONSTRUCTORS(StorageNamespace); }; |