Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: webkit/dom_storage/dom_storage_map.h

Issue 9146025: Framing for a DOMStorage backend that does not depend on in-process-webkit. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/dom_storage/dom_storage_map.h
===================================================================
--- webkit/dom_storage/dom_storage_map.h (revision 0)
+++ webkit/dom_storage/dom_storage_map.h (revision 0)
@@ -0,0 +1,49 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_MAP_H_
+#define WEBKIT_DOM_STORAGE_DOM_STORAGE_MAP_H_
+#pragma once
+
+#include <map>
+
+#include "base/memory/ref_counted.h"
+#include "base/nullable_string16.h"
+#include "base/string16.h"
+#include "webkit/dom_storage/dom_storage_types.h"
+
+class FilePath;
+class GURL;
+
+namespace dom_storage {
+
+// A wrapper around a std::map that adds refcounting and
+// imposes a limit on the total byte size of the keys/values.
+// See class comments for DomStorageContext for a larger overview.
+class DomStorageMap
+ : public base::RefCountedThreadSafe<DomStorageMap> {
+ public:
+ DomStorageMap();
+
+ unsigned Length();
+ NullableString16 Key(unsigned index);
+ NullableString16 GetItem(const string16& key);
+ bool SetItem(const string16& key, const string16& value,
+ NullableString16* old_value);
+ bool RemoveItem(const string16& key, string16* old_value);
+
+ void SwapValues(ValuesMap* map);
+ DomStorageMap* DeepCopy();
+
+ private:
+ friend class base::RefCountedThreadSafe<DomStorageMap>;
+ ~DomStorageMap();
+
+ ValuesMap values_;
+ // TODO(benm): track usage and enforce a quota limit.
+};
+
+} // namespace dom_storage
+
+#endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_
Property changes on: webkit\dom_storage\dom_storage_map.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698