| Index: content/browser/dom_storage/dom_storage_host.cc
|
| diff --git a/webkit/browser/dom_storage/dom_storage_host.cc b/content/browser/dom_storage/dom_storage_host.cc
|
| similarity index 62%
|
| rename from webkit/browser/dom_storage/dom_storage_host.cc
|
| rename to content/browser/dom_storage/dom_storage_host.cc
|
| index 18c480e384058ac70009a94ba8867df82f74da4d..bd92995f5aa886fc82837235a35b1ed917929f56 100644
|
| --- a/webkit/browser/dom_storage/dom_storage_host.cc
|
| +++ b/content/browser/dom_storage/dom_storage_host.cc
|
| @@ -2,28 +2,28 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "webkit/browser/dom_storage/dom_storage_host.h"
|
| +#include "content/browser/dom_storage/dom_storage_host.h"
|
|
|
| +#include "content/browser/dom_storage/dom_storage_area.h"
|
| +#include "content/browser/dom_storage/dom_storage_context_impl.h"
|
| +#include "content/browser/dom_storage/dom_storage_namespace.h"
|
| +#include "content/common/dom_storage/dom_storage_types.h"
|
| #include "url/gurl.h"
|
| -#include "webkit/browser/dom_storage/dom_storage_area.h"
|
| -#include "webkit/browser/dom_storage/dom_storage_context.h"
|
| -#include "webkit/browser/dom_storage/dom_storage_namespace.h"
|
| -#include "webkit/common/dom_storage/dom_storage_types.h"
|
|
|
| -namespace dom_storage {
|
| +namespace content {
|
|
|
| -DomStorageHost::DomStorageHost(DomStorageContext* context)
|
| +DOMStorageHost::DOMStorageHost(DOMStorageContextImpl* context)
|
| : context_(context) {
|
| }
|
|
|
| -DomStorageHost::~DomStorageHost() {
|
| +DOMStorageHost::~DOMStorageHost() {
|
| AreaMap::const_iterator it = connections_.begin();
|
| for (; it != connections_.end(); ++it)
|
| it->second.namespace_->CloseStorageArea(it->second.area_.get());
|
| connections_.clear(); // Clear prior to releasing the context_
|
| }
|
|
|
| -bool DomStorageHost::OpenStorageArea(int connection_id, int namespace_id,
|
| +bool DOMStorageHost::OpenStorageArea(int connection_id, int namespace_id,
|
| const GURL& origin) {
|
| DCHECK(!GetOpenArea(connection_id));
|
| if (GetOpenArea(connection_id))
|
| @@ -38,7 +38,7 @@ bool DomStorageHost::OpenStorageArea(int connection_id, int namespace_id,
|
| return true;
|
| }
|
|
|
| -void DomStorageHost::CloseStorageArea(int connection_id) {
|
| +void DOMStorageHost::CloseStorageArea(int connection_id) {
|
| AreaMap::iterator found = connections_.find(connection_id);
|
| if (found == connections_.end())
|
| return;
|
| @@ -46,53 +46,53 @@ void DomStorageHost::CloseStorageArea(int connection_id) {
|
| connections_.erase(found);
|
| }
|
|
|
| -bool DomStorageHost::ExtractAreaValues(
|
| - int connection_id, ValuesMap* map) {
|
| +bool DOMStorageHost::ExtractAreaValues(
|
| + int connection_id, DOMStorageValuesMap* map) {
|
| map->clear();
|
| - DomStorageArea* area = GetOpenArea(connection_id);
|
| + DOMStorageArea* area = GetOpenArea(connection_id);
|
| if (!area)
|
| return false;
|
| if (!area->IsLoadedInMemory()) {
|
| - DomStorageNamespace* ns = GetNamespace(connection_id);
|
| + DOMStorageNamespace* ns = GetNamespace(connection_id);
|
| DCHECK(ns);
|
| - if (ns->CountInMemoryAreas() > kMaxInMemoryAreas) {
|
| - ns->PurgeMemory(DomStorageNamespace::PURGE_UNOPENED);
|
| - if (ns->CountInMemoryAreas() > kMaxInMemoryAreas)
|
| - ns->PurgeMemory(DomStorageNamespace::PURGE_AGGRESSIVE);
|
| + if (ns->CountInMemoryAreas() > kMaxInMemoryStorageAreas) {
|
| + ns->PurgeMemory(DOMStorageNamespace::PURGE_UNOPENED);
|
| + if (ns->CountInMemoryAreas() > kMaxInMemoryStorageAreas)
|
| + ns->PurgeMemory(DOMStorageNamespace::PURGE_AGGRESSIVE);
|
| }
|
| }
|
| area->ExtractValues(map);
|
| return true;
|
| }
|
|
|
| -unsigned DomStorageHost::GetAreaLength(int connection_id) {
|
| - DomStorageArea* area = GetOpenArea(connection_id);
|
| +unsigned DOMStorageHost::GetAreaLength(int connection_id) {
|
| + DOMStorageArea* area = GetOpenArea(connection_id);
|
| if (!area)
|
| return 0;
|
| return area->Length();
|
| }
|
|
|
| -base::NullableString16 DomStorageHost::GetAreaKey(int connection_id,
|
| +base::NullableString16 DOMStorageHost::GetAreaKey(int connection_id,
|
| unsigned index) {
|
| - DomStorageArea* area = GetOpenArea(connection_id);
|
| + DOMStorageArea* area = GetOpenArea(connection_id);
|
| if (!area)
|
| return base::NullableString16();
|
| return area->Key(index);
|
| }
|
|
|
| -base::NullableString16 DomStorageHost::GetAreaItem(int connection_id,
|
| +base::NullableString16 DOMStorageHost::GetAreaItem(int connection_id,
|
| const base::string16& key) {
|
| - DomStorageArea* area = GetOpenArea(connection_id);
|
| + DOMStorageArea* area = GetOpenArea(connection_id);
|
| if (!area)
|
| return base::NullableString16();
|
| return area->GetItem(key);
|
| }
|
|
|
| -bool DomStorageHost::SetAreaItem(
|
| +bool DOMStorageHost::SetAreaItem(
|
| int connection_id, const base::string16& key,
|
| const base::string16& value, const GURL& page_url,
|
| base::NullableString16* old_value) {
|
| - DomStorageArea* area = GetOpenArea(connection_id);
|
| + DOMStorageArea* area = GetOpenArea(connection_id);
|
| if (!area)
|
| return false;
|
| if (!area->SetItem(key, value, old_value))
|
| @@ -102,10 +102,10 @@ bool DomStorageHost::SetAreaItem(
|
| return true;
|
| }
|
|
|
| -bool DomStorageHost::RemoveAreaItem(
|
| +bool DOMStorageHost::RemoveAreaItem(
|
| int connection_id, const base::string16& key, const GURL& page_url,
|
| base::string16* old_value) {
|
| - DomStorageArea* area = GetOpenArea(connection_id);
|
| + DOMStorageArea* area = GetOpenArea(connection_id);
|
| if (!area)
|
| return false;
|
| if (!area->RemoveItem(key, old_value))
|
| @@ -114,8 +114,8 @@ bool DomStorageHost::RemoveAreaItem(
|
| return true;
|
| }
|
|
|
| -bool DomStorageHost::ClearArea(int connection_id, const GURL& page_url) {
|
| - DomStorageArea* area = GetOpenArea(connection_id);
|
| +bool DOMStorageHost::ClearArea(int connection_id, const GURL& page_url) {
|
| + DOMStorageArea* area = GetOpenArea(connection_id);
|
| if (!area)
|
| return false;
|
| if (!area->Clear())
|
| @@ -124,7 +124,7 @@ bool DomStorageHost::ClearArea(int connection_id, const GURL& page_url) {
|
| return true;
|
| }
|
|
|
| -bool DomStorageHost::HasAreaOpen(
|
| +bool DOMStorageHost::HasAreaOpen(
|
| int namespace_id, const GURL& origin) const {
|
| AreaMap::const_iterator it = connections_.begin();
|
| for (; it != connections_.end(); ++it) {
|
| @@ -136,14 +136,14 @@ bool DomStorageHost::HasAreaOpen(
|
| return false;
|
| }
|
|
|
| -DomStorageArea* DomStorageHost::GetOpenArea(int connection_id) {
|
| +DOMStorageArea* DOMStorageHost::GetOpenArea(int connection_id) {
|
| AreaMap::iterator found = connections_.find(connection_id);
|
| if (found == connections_.end())
|
| return NULL;
|
| return found->second.area_.get();
|
| }
|
|
|
| -DomStorageNamespace* DomStorageHost::GetNamespace(int connection_id) {
|
| +DOMStorageNamespace* DOMStorageHost::GetNamespace(int connection_id) {
|
| AreaMap::iterator found = connections_.find(connection_id);
|
| if (found == connections_.end())
|
| return NULL;
|
| @@ -152,7 +152,7 @@ DomStorageNamespace* DomStorageHost::GetNamespace(int connection_id) {
|
|
|
| // NamespaceAndArea
|
|
|
| -DomStorageHost::NamespaceAndArea::NamespaceAndArea() {}
|
| -DomStorageHost::NamespaceAndArea::~NamespaceAndArea() {}
|
| +DOMStorageHost::NamespaceAndArea::NamespaceAndArea() {}
|
| +DOMStorageHost::NamespaceAndArea::~NamespaceAndArea() {}
|
|
|
| -} // namespace dom_storage
|
| +} // namespace content
|
|
|