diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-05 21:44:37 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-05 21:44:37 +0000 |
commit | 61e7dec52a02c54b06505162fc75e5086fc1c16a (patch) | |
tree | 4574d46b05872f1ffff289e1b9df58c0e8a80afa | |
parent | 395c5b5f942d8b49ded3f89decdd38598f97b49d (diff) | |
download | chromium_src-61e7dec52a02c54b06505162fc75e5086fc1c16a.zip chromium_src-61e7dec52a02c54b06505162fc75e5086fc1c16a.tar.gz chromium_src-61e7dec52a02c54b06505162fc75e5086fc1c16a.tar.bz2 |
Rename StorageNamespace and StorageArea to DOMStorageNamespace and DOMStorageArea.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/488014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35559 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/in_process_webkit/dom_storage_area.cc (renamed from chrome/browser/in_process_webkit/storage_area.cc) | 30 | ||||
-rw-r--r-- | chrome/browser/in_process_webkit/dom_storage_area.h (renamed from chrome/browser/in_process_webkit/storage_area.h) | 26 | ||||
-rw-r--r-- | chrome/browser/in_process_webkit/dom_storage_context.cc | 28 | ||||
-rw-r--r-- | chrome/browser/in_process_webkit/dom_storage_context.h | 24 | ||||
-rw-r--r-- | chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc | 26 | ||||
-rw-r--r-- | chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h | 2 | ||||
-rw-r--r-- | chrome/browser/in_process_webkit/dom_storage_namespace.cc (renamed from chrome/browser/in_process_webkit/storage_namespace.cc) | 39 | ||||
-rw-r--r-- | chrome/browser/in_process_webkit/dom_storage_namespace.h (renamed from chrome/browser/in_process_webkit/storage_namespace.h) | 34 | ||||
-rwxr-xr-x | chrome/chrome_browser.gypi | 8 |
9 files changed, 109 insertions, 108 deletions
diff --git a/chrome/browser/in_process_webkit/storage_area.cc b/chrome/browser/in_process_webkit/dom_storage_area.cc index 1b8ea59..d55adb9 100644 --- a/chrome/browser/in_process_webkit/storage_area.cc +++ b/chrome/browser/in_process_webkit/dom_storage_area.cc @@ -2,10 +2,10 @@ // source code is governed by a BSD-style license that can be found in the // LICENSE file. -#include "chrome/browser/in_process_webkit/storage_area.h" +#include "chrome/browser/in_process_webkit/dom_storage_area.h" #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" -#include "chrome/browser/in_process_webkit/storage_namespace.h" +#include "chrome/browser/in_process_webkit/dom_storage_namespace.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" @@ -13,54 +13,54 @@ using WebKit::WebStorageArea; using WebKit::WebURL; -StorageArea::StorageArea(const string16& origin, - int64 id, - StorageNamespace* owner) +DOMStorageArea::DOMStorageArea(const string16& origin, + int64 id, + DOMStorageNamespace* owner) : origin_(origin), id_(id), owner_(owner) { DCHECK(owner_); } -StorageArea::~StorageArea() { +DOMStorageArea::~DOMStorageArea() { } -unsigned StorageArea::Length() { +unsigned DOMStorageArea::Length() { CreateWebStorageAreaIfNecessary(); return storage_area_->length(); } -NullableString16 StorageArea::Key(unsigned index) { +NullableString16 DOMStorageArea::Key(unsigned index) { CreateWebStorageAreaIfNecessary(); return storage_area_->key(index); } -NullableString16 StorageArea::GetItem(const string16& key) { +NullableString16 DOMStorageArea::GetItem(const string16& key) { CreateWebStorageAreaIfNecessary(); return storage_area_->getItem(key); } -void StorageArea::SetItem(const string16& key, const string16& value, - bool* quota_exception) { +void DOMStorageArea::SetItem(const string16& key, const string16& value, + bool* quota_exception) { CreateWebStorageAreaIfNecessary(); storage_area_->setItem(key, value, WebURL(), *quota_exception); } -void StorageArea::RemoveItem(const string16& key) { +void DOMStorageArea::RemoveItem(const string16& key) { CreateWebStorageAreaIfNecessary(); storage_area_->removeItem(key, WebURL()); } -void StorageArea::Clear() { +void DOMStorageArea::Clear() { CreateWebStorageAreaIfNecessary(); storage_area_->clear(WebURL()); } -void StorageArea::PurgeMemory() { +void DOMStorageArea::PurgeMemory() { storage_area_.reset(); } -void StorageArea::CreateWebStorageAreaIfNecessary() { +void DOMStorageArea::CreateWebStorageAreaIfNecessary() { if (!storage_area_.get()) storage_area_.reset(owner_->CreateWebStorageArea(origin_)); } diff --git a/chrome/browser/in_process_webkit/storage_area.h b/chrome/browser/in_process_webkit/dom_storage_area.h index 7875137..218aaf4 100644 --- a/chrome/browser/in_process_webkit/storage_area.h +++ b/chrome/browser/in_process_webkit/dom_storage_area.h @@ -2,25 +2,25 @@ // source code is governed by a BSD-style license that can be found in the // LICENSE file. -#ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_STORAGE_AREA_H_ -#define CHROME_BROWSER_IN_PROCESS_WEBKIT_STORAGE_AREA_H_ +#ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_AREA_H_ +#define CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_AREA_H_ #include "base/hash_tables.h" #include "base/nullable_string16.h" #include "base/scoped_ptr.h" -class StorageNamespace; +class DOMStorageNamespace; namespace WebKit { class WebStorageArea; } -// Only use on the WebKit thread. StorageNamespace manages our registration +// Only use on the WebKit thread. DOMStorageNamespace manages our registration // with DOMStorageContext. -class StorageArea { +class DOMStorageArea { public: - StorageArea(const string16& origin, int64 id, StorageNamespace* owner); - ~StorageArea(); + DOMStorageArea(const string16& origin, int64 id, DOMStorageNamespace* owner); + ~DOMStorageArea(); unsigned Length(); NullableString16 Key(unsigned index); @@ -46,18 +46,18 @@ class StorageArea { // Our storage area id. Unique to our parent WebKitContext. int64 id_; - // The StorageNamespace that owns us. - StorageNamespace* owner_; + // The DOMStorageNamespace that owns us. + DOMStorageNamespace* owner_; - DISALLOW_IMPLICIT_CONSTRUCTORS(StorageArea); + DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageArea); }; #if defined(COMPILER_GCC) namespace __gnu_cxx { template<> -struct hash<StorageArea*> { - std::size_t operator()(StorageArea* const& p) const { +struct hash<DOMStorageArea*> { + std::size_t operator()(DOMStorageArea* const& p) const { return reinterpret_cast<std::size_t>(p); } }; @@ -65,4 +65,4 @@ struct hash<StorageArea*> { } // namespace __gnu_cxx #endif -#endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_STORAGE_AREA_H_ +#endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_AREA_H_ diff --git a/chrome/browser/in_process_webkit/dom_storage_context.cc b/chrome/browser/in_process_webkit/dom_storage_context.cc index 36804f8..b695f9f 100644 --- a/chrome/browser/in_process_webkit/dom_storage_context.cc +++ b/chrome/browser/in_process_webkit/dom_storage_context.cc @@ -7,8 +7,8 @@ #include "base/file_path.h" #include "base/file_util.h" #include "chrome/browser/chrome_thread.h" -#include "chrome/browser/in_process_webkit/storage_area.h" -#include "chrome/browser/in_process_webkit/storage_namespace.h" +#include "chrome/browser/in_process_webkit/dom_storage_area.h" +#include "chrome/browser/in_process_webkit/dom_storage_namespace.h" #include "chrome/browser/in_process_webkit/webkit_context.h" static const char* kLocalStorageDirectory = "Local Storage"; @@ -46,9 +46,9 @@ DOMStorageContext::~DOMStorageContext() { delete storage_namespace_map_.begin()->second; } -StorageNamespace* DOMStorageContext::LocalStorage() { +DOMStorageNamespace* DOMStorageContext::LocalStorage() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - StorageNamespace* storage_namespace = GetStorageNamespace( + DOMStorageNamespace* storage_namespace = GetStorageNamespace( kLocalStorageNamespaceId); if (storage_namespace) return storage_namespace; @@ -59,29 +59,29 @@ StorageNamespace* DOMStorageContext::LocalStorage() { MigrateLocalStorageDirectory(data_path); dir_path = data_path.AppendASCII(kLocalStorageDirectory); } - return StorageNamespace::CreateLocalStorageNamespace(this, dir_path); + return DOMStorageNamespace::CreateLocalStorageNamespace(this, dir_path); } -StorageNamespace* DOMStorageContext::NewSessionStorage() { +DOMStorageNamespace* DOMStorageContext::NewSessionStorage() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - return StorageNamespace::CreateSessionStorageNamespace(this); + return DOMStorageNamespace::CreateSessionStorageNamespace(this); } -void DOMStorageContext::RegisterStorageArea(StorageArea* storage_area) { +void DOMStorageContext::RegisterStorageArea(DOMStorageArea* storage_area) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); int64 id = storage_area->id(); DCHECK(!GetStorageArea(id)); storage_area_map_[id] = storage_area; } -void DOMStorageContext::UnregisterStorageArea(StorageArea* storage_area) { +void DOMStorageContext::UnregisterStorageArea(DOMStorageArea* storage_area) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); int64 id = storage_area->id(); DCHECK(GetStorageArea(id)); storage_area_map_.erase(id); } -StorageArea* DOMStorageContext::GetStorageArea(int64 id) { +DOMStorageArea* DOMStorageContext::GetStorageArea(int64 id) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); StorageAreaMap::iterator iter = storage_area_map_.find(id); if (iter == storage_area_map_.end()) @@ -90,7 +90,7 @@ StorageArea* DOMStorageContext::GetStorageArea(int64 id) { } void DOMStorageContext::RegisterStorageNamespace( - StorageNamespace* storage_namespace) { + DOMStorageNamespace* storage_namespace) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); int64 id = storage_namespace->id(); DCHECK(!GetStorageNamespace(id)); @@ -98,14 +98,14 @@ void DOMStorageContext::RegisterStorageNamespace( } void DOMStorageContext::UnregisterStorageNamespace( - StorageNamespace* storage_namespace) { + DOMStorageNamespace* storage_namespace) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); int64 id = storage_namespace->id(); DCHECK(GetStorageNamespace(id)); storage_namespace_map_.erase(id); } -StorageNamespace* DOMStorageContext::GetStorageNamespace(int64 id) { +DOMStorageNamespace* DOMStorageContext::GetStorageNamespace(int64 id) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); StorageNamespaceMap::iterator iter = storage_namespace_map_.find(id); if (iter == storage_namespace_map_.end()) @@ -140,7 +140,7 @@ void DOMStorageContext::PurgeMemory() { // because it is backed by disk and can be reloaded later. If we purge a // SessionStorage namespace, its data will be gone forever, because it isn't // currently backed by disk. - StorageNamespace* local_storage = + DOMStorageNamespace* local_storage = GetStorageNamespace(kLocalStorageNamespaceId); if (local_storage) local_storage->PurgeMemory(); diff --git a/chrome/browser/in_process_webkit/dom_storage_context.h b/chrome/browser/in_process_webkit/dom_storage_context.h index 2d79117..9838930 100644 --- a/chrome/browser/in_process_webkit/dom_storage_context.h +++ b/chrome/browser/in_process_webkit/dom_storage_context.h @@ -11,9 +11,9 @@ #include "base/file_path.h" #include "base/time.h" +class DOMStorageArea; class DOMStorageDispatcherHost; -class StorageArea; -class StorageNamespace; +class DOMStorageNamespace; class WebKitContext; // This is owned by WebKitContext and is all the dom storage information that's @@ -29,10 +29,10 @@ class DOMStorageContext { virtual ~DOMStorageContext(); // Get the local storage instance. The pointer is owned by this class. - StorageNamespace* LocalStorage(); + DOMStorageNamespace* LocalStorage(); // Get a new session storage namespace (but it's still owned by this class). - StorageNamespace* NewSessionStorage(); + DOMStorageNamespace* NewSessionStorage(); // Allocate a new storage ___ id. int64 AllocateStorageAreaId() { return ++last_storage_area_id_; } @@ -40,16 +40,16 @@ class DOMStorageContext { // Various storage area methods. The storage area is owned by one of the // namespaces that's owned by this class. - void RegisterStorageArea(StorageArea* storage_area); - void UnregisterStorageArea(StorageArea* storage_area); - StorageArea* GetStorageArea(int64 id); + void RegisterStorageArea(DOMStorageArea* storage_area); + void UnregisterStorageArea(DOMStorageArea* storage_area); + DOMStorageArea* GetStorageArea(int64 id); // Get a namespace from an id. What's returned is owned by this class. The // caller of GetStorageNamespace must immediately register itself with the // returned StorageNamespace. - void RegisterStorageNamespace(StorageNamespace* storage_namespace); - void UnregisterStorageNamespace(StorageNamespace* storage_namespace); - StorageNamespace* GetStorageNamespace(int64 id); + void RegisterStorageNamespace(DOMStorageNamespace* storage_namespace); + void UnregisterStorageNamespace(DOMStorageNamespace* storage_namespace); + DOMStorageNamespace* GetStorageNamespace(int64 id); // Sometimes an event from one DOM storage dispatcher host requires // communication to all of them. @@ -84,11 +84,11 @@ class DOMStorageContext { // Maps ids to StorageAreas. We do NOT own these objects. StorageNamespace // (which does own them) will notify us when we should remove the entries. - typedef std::map<int64, StorageArea*> StorageAreaMap; + typedef std::map<int64, DOMStorageArea*> StorageAreaMap; StorageAreaMap storage_area_map_; // Maps ids to StorageNamespaces. We own these objects. - typedef std::map<int64, StorageNamespace*> StorageNamespaceMap; + typedef std::map<int64, DOMStorageNamespace*> StorageNamespaceMap; StorageNamespaceMap storage_namespace_map_; DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContext); 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 d295ce1..28005b4 100644 --- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc @@ -6,9 +6,9 @@ #include "base/nullable_string16.h" #include "chrome/browser/chrome_thread.h" +#include "chrome/browser/in_process_webkit/dom_storage_area.h" #include "chrome/browser/in_process_webkit/dom_storage_context.h" -#include "chrome/browser/in_process_webkit/storage_area.h" -#include "chrome/browser/in_process_webkit/storage_namespace.h" +#include "chrome/browser/in_process_webkit/dom_storage_namespace.h" #include "chrome/browser/in_process_webkit/webkit_thread.h" #include "chrome/browser/renderer_host/browser_render_process_host.h" #include "chrome/common/render_messages.h" @@ -157,7 +157,7 @@ void DOMStorageDispatcherHost::OnNamespaceId(DOMStorageType storage_type, } DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - StorageNamespace* new_namespace; + DOMStorageNamespace* new_namespace; if (storage_type == DOM_STORAGE_LOCAL) new_namespace = Context()->LocalStorage(); else @@ -177,7 +177,7 @@ void DOMStorageDispatcherHost::OnCloneNamespaceId(int64 namespace_id, } DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - StorageNamespace* existing_namespace = + DOMStorageNamespace* existing_namespace = Context()->GetStorageNamespace(namespace_id); if (!existing_namespace) { BrowserRenderProcessHost::BadMessageTerminateProcess( @@ -185,7 +185,7 @@ void DOMStorageDispatcherHost::OnCloneNamespaceId(int64 namespace_id, delete reply_msg; return; } - StorageNamespace* new_namespace = existing_namespace->Copy(); + DOMStorageNamespace* new_namespace = existing_namespace->Copy(); ViewHostMsg_DOMStorageCloneNamespaceId::WriteReplyParams(reply_msg, new_namespace->id()); Send(reply_msg); @@ -202,7 +202,7 @@ void DOMStorageDispatcherHost::OnStorageAreaId(int64 namespace_id, } DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - StorageNamespace* storage_namespace = + DOMStorageNamespace* storage_namespace = Context()->GetStorageNamespace(namespace_id); if (!storage_namespace) { BrowserRenderProcessHost::BadMessageTerminateProcess( @@ -210,7 +210,7 @@ void DOMStorageDispatcherHost::OnStorageAreaId(int64 namespace_id, delete reply_msg; return; } - StorageArea* storage_area = storage_namespace->GetStorageArea(origin); + DOMStorageArea* storage_area = storage_namespace->GetStorageArea(origin); ViewHostMsg_DOMStorageCloneNamespaceId::WriteReplyParams(reply_msg, storage_area->id()); Send(reply_msg); @@ -225,7 +225,7 @@ void DOMStorageDispatcherHost::OnLength(int64 storage_area_id, } DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - StorageArea* storage_area = Context()->GetStorageArea(storage_area_id); + DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id); if (!storage_area) { BrowserRenderProcessHost::BadMessageTerminateProcess( ViewHostMsg_DOMStorageLength::ID, process_handle_); @@ -247,7 +247,7 @@ void DOMStorageDispatcherHost::OnKey(int64 storage_area_id, unsigned index, } DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - StorageArea* storage_area = Context()->GetStorageArea(storage_area_id); + DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id); if (!storage_area) { BrowserRenderProcessHost::BadMessageTerminateProcess( ViewHostMsg_DOMStorageKey::ID, process_handle_); @@ -270,7 +270,7 @@ void DOMStorageDispatcherHost::OnGetItem(int64 storage_area_id, } DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - StorageArea* storage_area = Context()->GetStorageArea(storage_area_id); + DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id); if (!storage_area) { BrowserRenderProcessHost::BadMessageTerminateProcess( ViewHostMsg_DOMStorageGetItem::ID, process_handle_); @@ -294,7 +294,7 @@ void DOMStorageDispatcherHost::OnSetItem( DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); bool quota_exception = false; - StorageArea* storage_area = Context()->GetStorageArea(storage_area_id); + DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id); if (!storage_area) { BrowserRenderProcessHost::BadMessageTerminateProcess( ViewHostMsg_DOMStorageSetItem::ID, process_handle_); @@ -317,7 +317,7 @@ void DOMStorageDispatcherHost::OnRemoveItem( } DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - StorageArea* storage_area = Context()->GetStorageArea(storage_area_id); + DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id); if (!storage_area) { BrowserRenderProcessHost::BadMessageTerminateProcess( ViewHostMsg_DOMStorageRemoveItem::ID, process_handle_); @@ -336,7 +336,7 @@ void DOMStorageDispatcherHost::OnClear(int64 storage_area_id, const GURL& url) { } DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - StorageArea* storage_area = Context()->GetStorageArea(storage_area_id); + DOMStorageArea* storage_area = Context()->GetStorageArea(storage_area_id); if (!storage_area) { BrowserRenderProcessHost::BadMessageTerminateProcess( ViewHostMsg_DOMStorageClear::ID, process_handle_); 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 6ca2d62..029a122 100644 --- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h +++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h @@ -8,7 +8,7 @@ #include "base/process.h" #include "base/ref_counted.h" #include "base/tracked.h" -#include "chrome/browser/in_process_webkit/storage_area.h" +#include "chrome/browser/in_process_webkit/dom_storage_area.h" #include "chrome/browser/in_process_webkit/webkit_context.h" #include "chrome/common/dom_storage_type.h" #include "ipc/ipc_message.h" diff --git a/chrome/browser/in_process_webkit/storage_namespace.cc b/chrome/browser/in_process_webkit/dom_storage_namespace.cc index b38303b..f6e9ae5 100644 --- a/chrome/browser/in_process_webkit/storage_namespace.cc +++ b/chrome/browser/in_process_webkit/dom_storage_namespace.cc @@ -2,12 +2,12 @@ // source code is governed by a BSD-style license that can be found in the // LICENSE file. -#include "chrome/browser/in_process_webkit/storage_namespace.h" +#include "chrome/browser/in_process_webkit/dom_storage_namespace.h" #include "base/file_path.h" +#include "chrome/browser/in_process_webkit/dom_storage_area.h" #include "chrome/browser/in_process_webkit/dom_storage_context.h" #include "chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h" -#include "chrome/browser/in_process_webkit/storage_area.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h" #include "webkit/glue/webkit_glue.h" @@ -17,27 +17,27 @@ using WebKit::WebStorageNamespace; using WebKit::WebString; /* static */ -StorageNamespace* StorageNamespace::CreateLocalStorageNamespace( +DOMStorageNamespace* DOMStorageNamespace::CreateLocalStorageNamespace( DOMStorageContext* dom_storage_context, const FilePath& data_dir_path) { int64 id = dom_storage_context->kLocalStorageNamespaceId; DCHECK(!dom_storage_context->GetStorageNamespace(id)); - return new StorageNamespace(dom_storage_context, id, + return new DOMStorageNamespace(dom_storage_context, id, webkit_glue::FilePathToWebString(data_dir_path), DOM_STORAGE_LOCAL); } /* static */ -StorageNamespace* StorageNamespace::CreateSessionStorageNamespace( +DOMStorageNamespace* DOMStorageNamespace::CreateSessionStorageNamespace( DOMStorageContext* dom_storage_context) { int64 id = dom_storage_context->AllocateStorageNamespaceId(); DCHECK(!dom_storage_context->GetStorageNamespace(id)); - return new StorageNamespace(dom_storage_context, id, WebString(), - DOM_STORAGE_SESSION); + return new DOMStorageNamespace(dom_storage_context, id, WebString(), + DOM_STORAGE_SESSION); } -StorageNamespace::StorageNamespace(DOMStorageContext* dom_storage_context, - int64 id, - const WebString& data_dir_path, - DOMStorageType dom_storage_type) +DOMStorageNamespace::DOMStorageNamespace(DOMStorageContext* dom_storage_context, + int64 id, + const WebString& data_dir_path, + DOMStorageType dom_storage_type) : dom_storage_context_(dom_storage_context), id_(id), data_dir_path_(data_dir_path), @@ -46,7 +46,7 @@ StorageNamespace::StorageNamespace(DOMStorageContext* dom_storage_context, dom_storage_context_->RegisterStorageNamespace(this); } -StorageNamespace::~StorageNamespace() { +DOMStorageNamespace::~DOMStorageNamespace() { dom_storage_context_->UnregisterStorageNamespace(this); for (OriginToStorageAreaMap::iterator iter(origin_to_storage_area_.begin()); @@ -56,7 +56,7 @@ StorageNamespace::~StorageNamespace() { } } -StorageArea* StorageNamespace::GetStorageArea(const string16& origin) { +DOMStorageArea* DOMStorageNamespace::GetStorageArea(const string16& origin) { // We may have already created it for another dispatcher host. OriginToStorageAreaMap::iterator iter = origin_to_storage_area_.find(origin); if (iter != origin_to_storage_area_.end()) @@ -65,36 +65,37 @@ StorageArea* StorageNamespace::GetStorageArea(const string16& origin) { // We need to create a new one. int64 id = dom_storage_context_->AllocateStorageAreaId(); DCHECK(!dom_storage_context_->GetStorageArea(id)); - StorageArea* storage_area = new StorageArea(origin, id, this); + DOMStorageArea* storage_area = new DOMStorageArea(origin, id, this); origin_to_storage_area_[origin] = storage_area; dom_storage_context_->RegisterStorageArea(storage_area); return storage_area; } -StorageNamespace* StorageNamespace::Copy() { +DOMStorageNamespace* DOMStorageNamespace::Copy() { DCHECK(dom_storage_type_ == DOM_STORAGE_SESSION); int64 id = dom_storage_context_->AllocateStorageNamespaceId(); DCHECK(!dom_storage_context_->GetStorageNamespace(id)); - StorageNamespace* new_storage_namespace = new StorageNamespace( + DOMStorageNamespace* new_storage_namespace = new DOMStorageNamespace( dom_storage_context_, id, data_dir_path_, dom_storage_type_); CreateWebStorageNamespaceIfNecessary(); new_storage_namespace->storage_namespace_.reset(storage_namespace_->copy()); return new_storage_namespace; } -void StorageNamespace::PurgeMemory() { +void DOMStorageNamespace::PurgeMemory() { for (OriginToStorageAreaMap::iterator iter(origin_to_storage_area_.begin()); iter != origin_to_storage_area_.end(); ++iter) iter->second->PurgeMemory(); storage_namespace_.reset(); } -WebStorageArea* StorageNamespace::CreateWebStorageArea(const string16& origin) { +WebStorageArea* DOMStorageNamespace::CreateWebStorageArea( + const string16& origin) { CreateWebStorageNamespaceIfNecessary(); return storage_namespace_->createStorageArea(origin); } -void StorageNamespace::CreateWebStorageNamespaceIfNecessary() { +void DOMStorageNamespace::CreateWebStorageNamespaceIfNecessary() { if (storage_namespace_.get()) return; diff --git a/chrome/browser/in_process_webkit/storage_namespace.h b/chrome/browser/in_process_webkit/dom_storage_namespace.h index f6d045a..a41dcd7 100644 --- a/chrome/browser/in_process_webkit/storage_namespace.h +++ b/chrome/browser/in_process_webkit/dom_storage_namespace.h @@ -2,8 +2,8 @@ // source code is governed by a BSD-style license that can be found in the // LICENSE file. -#ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_STORAGE_NAMESPACE_H_ -#define CHROME_BROWSER_IN_PROCESS_WEBKIT_STORAGE_NAMESPACE_H_ +#ifndef CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_ +#define CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_ #include "base/string16.h" #include "base/hash_tables.h" @@ -11,9 +11,9 @@ #include "chrome/common/dom_storage_type.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" +class DOMStorageArea; class DOMStorageContext; class FilePath; -class StorageArea; namespace WebKit { class WebStorageArea; @@ -21,17 +21,17 @@ class WebStorageNamespace; } // Only to be used on the WebKit thread. -class StorageNamespace { +class DOMStorageNamespace { public: - static StorageNamespace* CreateLocalStorageNamespace( + static DOMStorageNamespace* CreateLocalStorageNamespace( DOMStorageContext* dom_storage_context, const FilePath& data_dir_path); - static StorageNamespace* CreateSessionStorageNamespace( + static DOMStorageNamespace* CreateSessionStorageNamespace( DOMStorageContext* dom_storage_context); - ~StorageNamespace(); + ~DOMStorageNamespace(); - StorageArea* GetStorageArea(const string16& origin); - StorageNamespace* Copy(); + DOMStorageArea* GetStorageArea(const string16& origin); + DOMStorageNamespace* Copy(); void PurgeMemory(); const DOMStorageContext* dom_storage_context() const { @@ -41,21 +41,21 @@ class StorageNamespace { DOMStorageType dom_storage_type() const { return dom_storage_type_; } // Creates a WebStorageArea for the given origin. This should only be called - // by an owned StorageArea. + // by an owned DOMStorageArea. WebKit::WebStorageArea* CreateWebStorageArea(const string16& origin); private: // Called by the static factory methods above. - StorageNamespace(DOMStorageContext* dom_storage_context, - int64 id, - const WebKit::WebString& data_dir_path, - DOMStorageType storage_type); + DOMStorageNamespace(DOMStorageContext* dom_storage_context, + int64 id, + const WebKit::WebString& data_dir_path, + DOMStorageType storage_type); // Creates the underlying WebStorageNamespace on demand. void CreateWebStorageNamespaceIfNecessary(); // All the storage areas we own. - typedef base::hash_map<string16, StorageArea*> OriginToStorageAreaMap; + typedef base::hash_map<string16, DOMStorageArea*> OriginToStorageAreaMap; OriginToStorageAreaMap origin_to_storage_area_; // The DOMStorageContext that owns us. @@ -77,7 +77,7 @@ class StorageNamespace { // The quota for each storage area. Suggested by the spec. static const unsigned kLocalStorageQuota = 5 * 1024 * 1024; - DISALLOW_IMPLICIT_CONSTRUCTORS(StorageNamespace); + DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageNamespace); }; -#endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_STORAGE_NAMESPACE_H_ +#endif // CHROME_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_ diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 9ee667f..810a25f 100755 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1072,14 +1072,14 @@ 'browser/importer/toolbar_importer.h', 'browser/in_process_webkit/browser_webkitclient_impl.cc', 'browser/in_process_webkit/browser_webkitclient_impl.h', + 'browser/in_process_webkit/dom_storage_area.cc', + 'browser/in_process_webkit/dom_storage_area.h', 'browser/in_process_webkit/dom_storage_context.cc', 'browser/in_process_webkit/dom_storage_context.h', 'browser/in_process_webkit/dom_storage_dispatcher_host.cc', 'browser/in_process_webkit/dom_storage_dispatcher_host.h', - 'browser/in_process_webkit/storage_area.cc', - 'browser/in_process_webkit/storage_area.h', - 'browser/in_process_webkit/storage_namespace.cc', - 'browser/in_process_webkit/storage_namespace.h', + 'browser/in_process_webkit/dom_storage_namespace.cc', + 'browser/in_process_webkit/dom_storage_namespace.h', 'browser/in_process_webkit/webkit_context.cc', 'browser/in_process_webkit/webkit_context.h', 'browser/in_process_webkit/webkit_thread.cc', |