| Index: webkit/browser/dom_storage/dom_storage_context.cc
|
| ===================================================================
|
| --- webkit/browser/dom_storage/dom_storage_context.cc (revision 0)
|
| +++ webkit/browser/dom_storage/dom_storage_context.cc (working copy)
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "webkit/dom_storage/dom_storage_context.h"
|
| +#include "webkit/browser/dom_storage/dom_storage_context.h"
|
|
|
| #include "base/bind.h"
|
| #include "base/bind_helpers.h"
|
| @@ -10,13 +10,13 @@
|
| #include "base/guid.h"
|
| #include "base/location.h"
|
| #include "base/time.h"
|
| -#include "webkit/dom_storage/dom_storage_area.h"
|
| -#include "webkit/dom_storage/dom_storage_database.h"
|
| -#include "webkit/dom_storage/dom_storage_namespace.h"
|
| -#include "webkit/dom_storage/dom_storage_task_runner.h"
|
| -#include "webkit/dom_storage/dom_storage_types.h"
|
| -#include "webkit/dom_storage/session_storage_database.h"
|
| -#include "webkit/quota/special_storage_policy.h"
|
| +#include "webkit/browser/dom_storage/dom_storage_area.h"
|
| +#include "webkit/browser/dom_storage/dom_storage_database.h"
|
| +#include "webkit/browser/dom_storage/dom_storage_namespace.h"
|
| +#include "webkit/browser/dom_storage/dom_storage_task_runner.h"
|
| +#include "webkit/browser/dom_storage/session_storage_database.h"
|
| +#include "webkit/browser/quota/special_storage_policy.h"
|
| +#include "webkit/common/dom_storage/dom_storage_types.h"
|
|
|
| using file_util::FileEnumerator;
|
|
|
| @@ -43,7 +43,7 @@
|
| }
|
|
|
| DomStorageContext::~DomStorageContext() {
|
| - if (session_storage_database_) {
|
| + if (session_storage_database_.get()) {
|
| // SessionStorageDatabase shouldn't be deleted right away: deleting it will
|
| // potentially involve waiting in leveldb::DBImpl::~DBImpl, and waiting
|
| // shouldn't happen on this thread.
|
| @@ -73,13 +73,13 @@
|
| }
|
| }
|
| DomStorageNamespace* local =
|
| - new DomStorageNamespace(localstorage_directory_, task_runner_);
|
| + new DomStorageNamespace(localstorage_directory_, task_runner_.get());
|
| namespaces_[kLocalStorageNamespaceId] = local;
|
| return local;
|
| }
|
| return NULL;
|
| }
|
| - return found->second;
|
| + return found->second.get();
|
| }
|
|
|
| void DomStorageContext::GetLocalStorageUsage(
|
| @@ -107,7 +107,7 @@
|
|
|
| void DomStorageContext::GetSessionStorageUsage(
|
| std::vector<SessionStorageUsageInfo>* infos) {
|
| - if (!session_storage_database_)
|
| + if (!session_storage_database_.get())
|
| return;
|
| std::map<std::string, std::vector<GURL> > namespaces_and_origins;
|
| session_storage_database_->ReadNamespacesAndOrigins(
|
| @@ -176,7 +176,7 @@
|
| for (; it != namespaces_.end(); ++it)
|
| it->second->Shutdown();
|
|
|
| - if (localstorage_directory_.empty() && !session_storage_database_)
|
| + if (localstorage_directory_.empty() && !session_storage_database_.get())
|
| return;
|
|
|
| // Respect the content policy settings about what to
|
| @@ -252,7 +252,7 @@
|
| DCHECK(namespaces_.find(namespace_id) == namespaces_.end());
|
| namespaces_[namespace_id] = new DomStorageNamespace(
|
| namespace_id, persistent_namespace_id, session_storage_database_.get(),
|
| - task_runner_);
|
| + task_runner_.get());
|
| persistent_namespace_id_to_namespace_id_[persistent_namespace_id] =
|
| namespace_id;
|
| }
|
| @@ -264,7 +264,7 @@
|
| if (it == namespaces_.end())
|
| return;
|
| std::string persistent_namespace_id = it->second->persistent_namespace_id();
|
| - if (session_storage_database_) {
|
| + if (session_storage_database_.get()) {
|
| if (!should_persist_data) {
|
| task_runner_->PostShutdownBlockingTask(
|
| FROM_HERE,
|
| @@ -321,7 +321,7 @@
|
| kNotRecursive);
|
| }
|
| }
|
| - if (session_storage_database_) {
|
| + if (session_storage_database_.get()) {
|
| std::vector<SessionStorageUsageInfo> infos;
|
| GetSessionStorageUsage(&infos);
|
| for (size_t i = 0; i < infos.size(); ++i) {
|
| @@ -345,7 +345,7 @@
|
| }
|
|
|
| void DomStorageContext::StartScavengingUnusedSessionStorage() {
|
| - if (session_storage_database_) {
|
| + if (session_storage_database_.get()) {
|
| task_runner_->PostDelayedTask(
|
| FROM_HERE, base::Bind(&DomStorageContext::FindUnusedNamespaces, this),
|
| base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds));
|
|
|