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

Side by Side Diff: webkit/dom_storage/dom_storage_host.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_HOST_H_
6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_
7 #pragma once
8
9 #include <map>
10
11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/nullable_string16.h"
14 #include "base/string16.h"
15
16 class GURL;
17
18 namespace dom_storage {
19
20 class DomStorageContext;
21 class DomStorageHost;
22 class DomStorageNamespace;
23 class DomStorageArea;
24
25 // One instance is allocated in the main process for each client process.
26 // Used by DomStorageMessageFilter in Chrome and by SimpleDomStorage in DRT.
27 // This class is single threaded, and performs blocking file reads/writes,
28 // so it shouldn't be used on chrome's IO thread.
29 class DomStorageHost {
30 public:
31 explicit DomStorageHost(DomStorageContext* context);
32 ~DomStorageHost();
33
34 int OpenStorageArea(int namespace_id, const GURL& origin);
35 void CloseStorageArea(int connection_id);
36
37 unsigned GetAreaLength(int connection_id);
38 NullableString16 GetAreaKey(int connection_id, unsigned index);
39 NullableString16 GetAreaItem(int connection_id, const string16& key);
40 bool SetAreaItem(int connection_id, const string16& key,
41 const string16& value, const GURL& page_url,
42 NullableString16* old_value);
43 bool RemoveAreaItem(int connection_id, const string16& key,
44 const GURL& page_url,
45 string16* old_value);
46 bool ClearArea(int connection_id, const GURL& page_url);
47
48 private:
49 // Struct to hold referernces needed.
benm (inactive) 2012/02/02 16:23:19 references
michaeln 2012/02/03 00:33:42 Done.
50 struct NamespaceAndArea {
51 scoped_refptr<DomStorageNamespace> namespace_;
52 scoped_refptr<DomStorageArea> area_;
53 };
54 typedef std::map<int, NamespaceAndArea > AreaMap;
55
56 DomStorageArea* GetOpenArea(int connection_id);
57
58 int last_connection_id_;
59 scoped_refptr<DomStorageContext> context_;
60 AreaMap connections_;
61 };
62
63 } // namespace dom_storage
64
65 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698