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

Side by Side 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, 10 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_MAP_H_
6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_MAP_H_
7 #pragma once
8
9 #include <map>
10
11 #include "base/memory/ref_counted.h"
12 #include "base/nullable_string16.h"
13 #include "base/string16.h"
14 #include "webkit/dom_storage/dom_storage_types.h"
15
16 class FilePath;
17 class GURL;
18
19 namespace dom_storage {
20
21 // A wrapper around a std::map that adds refcounting and
22 // imposes a limit on the total byte size of the keys/values.
23 // See class comments for DomStorageContext for a larger overview.
24 class DomStorageMap
25 : public base::RefCountedThreadSafe<DomStorageMap> {
26 public:
27 DomStorageMap();
28
29 unsigned Length();
30 NullableString16 Key(unsigned index);
31 NullableString16 GetItem(const string16& key);
32 bool SetItem(const string16& key, const string16& value,
33 NullableString16* old_value);
34 bool RemoveItem(const string16& key, string16* old_value);
35
36 void SwapValues(ValuesMap* map);
37 DomStorageMap* DeepCopy();
38
39 private:
40 friend class base::RefCountedThreadSafe<DomStorageMap>;
41 ~DomStorageMap();
42
43 ValuesMap values_;
44 // TODO(benm): track usage and enforce a quota limit.
45 };
46
47 } // namespace dom_storage
48
49 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_AREA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698