| 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 65%
|
| rename from webkit/browser/dom_storage/dom_storage_host.cc
|
| rename to content/browser/dom_storage/dom_storage_host.cc
|
| index 9b6da6703853e98cb7148194a97c7452ed693d6d..b47cbb47512c98c62464ef194ca106f1c76509ef 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))
|
| @@ -42,7 +42,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;
|
| @@ -50,10 +50,10 @@ 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) {
|
| // TODO(michaeln): Fix crbug/134003 and return false here.
|
| // Until then return true to avoid crashing the renderer
|
| @@ -61,46 +61,46 @@ bool DomStorageHost::ExtractAreaValues(
|
| return true;
|
| }
|
| 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) {
|
| // TODO(michaeln): Fix crbug/134003 and return false here.
|
| // Until then return true to allow the renderer to operate
|
| @@ -114,10 +114,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))
|
| @@ -126,8 +126,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())
|
| @@ -136,7 +136,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) {
|
| @@ -148,14 +148,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;
|
| @@ -164,7 +164,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
|
|
|