summaryrefslogtreecommitdiffstats
path: root/webkit/dom_storage
diff options
context:
space:
mode:
authordgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-19 23:47:52 +0000
committerdgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-19 23:47:52 +0000
commit9a6b1a245808597f34c3b62fcf247d531a10e38c (patch)
tree2769f084554e51eccb791bc27cd95a224bd738a5 /webkit/dom_storage
parent57066aaae2904ddcfd7ea08cb26f984f7fc3d59f (diff)
downloadchromium_src-9a6b1a245808597f34c3b62fcf247d531a10e38c.zip
chromium_src-9a6b1a245808597f34c3b62fcf247d531a10e38c.tar.gz
chromium_src-9a6b1a245808597f34c3b62fcf247d531a10e38c.tar.bz2
Revert 127573 - DOMStorageContextImpl that's implemented in terms of the new dom_storage classes. Also compile out existing tests that no longer apply when ENABLE_NEW_DOM_STORAGE_BACKEND is defined.
BUG=106763 Review URL: https://chromiumcodereview.appspot.com/9695013 TBR=michaeln@google.com Review URL: https://chromiumcodereview.appspot.com/9726022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/dom_storage')
-rw-r--r--webkit/dom_storage/dom_storage_area.cc21
-rw-r--r--webkit/dom_storage/dom_storage_area.h5
-rw-r--r--webkit/dom_storage/dom_storage_context.cc54
-rw-r--r--webkit/dom_storage/dom_storage_context.h38
4 files changed, 12 insertions, 106 deletions
diff --git a/webkit/dom_storage/dom_storage_area.cc b/webkit/dom_storage/dom_storage_area.cc
index 41325f7..79de209 100644
--- a/webkit/dom_storage/dom_storage_area.cc
+++ b/webkit/dom_storage/dom_storage_area.cc
@@ -16,20 +16,6 @@
namespace dom_storage {
-// static
-const FilePath::CharType DomStorageArea::kDatabaseFileExtension[] =
- FILE_PATH_LITERAL(".localstorage");
-
-// static
-FilePath DomStorageArea::DatabaseFileNameFromOrigin(const GURL& origin) {
- std::string filename = fileapi::GetOriginIdentifierFromURL(origin);
- // There is no FilePath.AppendExtension() method, so start with just the
- // extension as the filename, and then InsertBeforeExtension the desired
- // name.
- return FilePath().Append(kDatabaseFileExtension).
- InsertBeforeExtensionASCII(filename);
-}
-
DomStorageArea::DomStorageArea(
int64 namespace_id, const GURL& origin,
const FilePath& directory, DomStorageTaskRunner* task_runner)
@@ -178,4 +164,11 @@ void DomStorageArea::CommitChanges() {
commit_in_flight_ = false;
}
+// static
+FilePath DomStorageArea::DatabaseFileNameFromOrigin(const GURL& origin) {
+ std::string filename = fileapi::GetOriginIdentifierFromURL(origin)
+ + ".localstorage";
+ return FilePath().AppendASCII(filename);
+}
+
} // namespace dom_storage
diff --git a/webkit/dom_storage/dom_storage_area.h b/webkit/dom_storage/dom_storage_area.h
index fba1a7f..ba26d60 100644
--- a/webkit/dom_storage/dom_storage_area.h
+++ b/webkit/dom_storage/dom_storage_area.h
@@ -27,9 +27,6 @@ class DomStorageArea
: public base::RefCountedThreadSafe<DomStorageArea> {
public:
- static const FilePath::CharType kDatabaseFileExtension[];
- static FilePath DatabaseFileNameFromOrigin(const GURL& origin);
-
DomStorageArea(int64 namespace_id,
const GURL& origin,
const FilePath& directory,
@@ -63,6 +60,8 @@ class DomStorageArea
void ScheduleCommitChanges();
void CommitChanges();
+ static FilePath DatabaseFileNameFromOrigin(const GURL& origin);
+
~DomStorageArea();
int64 namespace_id_;
diff --git a/webkit/dom_storage/dom_storage_context.cc b/webkit/dom_storage/dom_storage_context.cc
index 698f37b..21d2f8c 100644
--- a/webkit/dom_storage/dom_storage_context.cc
+++ b/webkit/dom_storage/dom_storage_context.cc
@@ -6,33 +6,20 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/file_util.h"
#include "base/time.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
-#include "webkit/dom_storage/dom_storage_area.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/glue/webkit_glue.h"
#include "webkit/quota/special_storage_policy.h"
-using file_util::FileEnumerator;
-
namespace dom_storage {
-DomStorageContext::UsageInfo::UsageInfo() {}
-DomStorageContext::UsageInfo::~UsageInfo() {}
-
DomStorageContext::DomStorageContext(
const FilePath& directory,
quota::SpecialStoragePolicy* special_storage_policy,
DomStorageTaskRunner* task_runner)
: directory_(directory),
- task_runner_(task_runner),
- clear_local_state_(false),
- save_session_state_(false),
- special_storage_policy_(special_storage_policy) {
+ task_runner_(task_runner) {
// AtomicSequenceNum starts at 0 but we want to start session
// namespace ids at one since zero is reserved for the
// kLocalStorageNamespaceId.
@@ -57,45 +44,6 @@ DomStorageNamespace* DomStorageContext::GetStorageNamespace(
return found->second;
}
-void DomStorageContext::GetUsageInfo(std::vector<UsageInfo>* infos) {
- FileEnumerator enumerator(directory_, false, FileEnumerator::FILES);
- for (FilePath path = enumerator.Next(); !path.empty();
- path = enumerator.Next()) {
- if (path.MatchesExtension(DomStorageArea::kDatabaseFileExtension)) {
- UsageInfo info;
-
- // Extract origin id from the path and construct a GURL.
- WebKit::WebString origin_id = webkit_glue::FilePathToWebString(
- path.BaseName().RemoveExtension());
- info.origin = GURL(WebKit::WebSecurityOrigin::
- createFromDatabaseIdentifier(origin_id).toString());
-
- FileEnumerator::FindInfo find_info;
- enumerator.GetFindInfo(&find_info);
- info.data_size = FileEnumerator::GetFilesize(find_info);
- info.last_modified = FileEnumerator::GetLastModifiedTime(find_info);
-
- infos->push_back(info);
- }
- }
-}
-
-void DomStorageContext::DeleteOrigin(const GURL& origin) {
- // TODO(michaeln): write me
-}
-
-void DomStorageContext::DeleteDataModifiedSince(const base::Time& cutoff) {
- // TODO(michaeln): write me
-}
-
-void DomStorageContext::PurgeMemory() {
- // TODO(michaeln): write me
-}
-
-void DomStorageContext::Shutdown() {
- // TODO(michaeln): write me
-}
-
void DomStorageContext::AddEventObserver(EventObserver* observer) {
event_observers_.AddObserver(observer);
}
diff --git a/webkit/dom_storage/dom_storage_context.h b/webkit/dom_storage/dom_storage_context.h
index 484d8ac..fe17eec 100644
--- a/webkit/dom_storage/dom_storage_context.h
+++ b/webkit/dom_storage/dom_storage_context.h
@@ -7,16 +7,15 @@
#pragma once
#include <map>
-#include <vector>
#include "base/atomic_sequence_num.h"
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
-#include "googleurl/src/gurl.h"
class FilePath;
+class GURL;
class NullableString16;
namespace base {
@@ -56,15 +55,6 @@ class DomStorageTaskRunner;
class DomStorageContext
: public base::RefCountedThreadSafe<DomStorageContext> {
public:
- struct UsageInfo {
- GURL origin;
- size_t data_size;
- base::Time last_modified;
-
- UsageInfo();
- ~UsageInfo();
- };
-
// An interface for observing LocalStorage events on the
// background thread.
class EventObserver {
@@ -89,29 +79,9 @@ class DomStorageContext
DomStorageContext(const FilePath& directory, // empty for incognito profiles
quota::SpecialStoragePolicy* special_storage_policy,
DomStorageTaskRunner* task_runner);
- const FilePath& directory() const { return directory_; }
DomStorageTaskRunner* task_runner() const { return task_runner_; }
DomStorageNamespace* GetStorageNamespace(int64 namespace_id);
- void GetUsageInfo(std::vector<UsageInfo>* info);
- void DeleteOrigin(const GURL& origin);
- void DeleteDataModifiedSince(const base::Time& cutoff);
- void PurgeMemory();
-
- // Used by content settings to alter the behavior around
- // what data to keep and what data to discard at shutdown.
- // The policy is not so straight forward to describe, see
- // the implementation for details.
- void SetClearLocalState(bool clear_local_state) {
- clear_local_state_ = clear_local_state;
- }
- void SaveSessionState() {
- save_session_state_ = true;
- }
-
- // Called when the BrowserContext/Profile is going away.
- void Shutdown();
-
// Methods to add, remove, and notify EventObservers.
void AddEventObserver(EventObserver* observer);
void RemoveEventObserver(EventObserver* observer);
@@ -151,7 +121,7 @@ class DomStorageContext
StorageNamespaceMap namespaces_;
// Where localstorage data is stored, maybe empty for the incognito use case.
- const FilePath directory_;
+ FilePath directory_;
// Used to schedule sequenced background tasks.
scoped_refptr<DomStorageTaskRunner> task_runner_;
@@ -162,10 +132,6 @@ class DomStorageContext
// We use a 32 bit identifier for per tab storage sessions.
// At a tab per second, this range is large enough for 68 years.
base::AtomicSequenceNumber session_id_sequence_;
-
- bool clear_local_state_;
- bool save_session_state_;
- scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
};
} // namespace dom_storage