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

Side by Side Diff: webkit/dom_storage/dom_storage_namespace.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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_ 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_ 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/hash_tables.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/string16.h"
12 #include "content/common/dom_storage_common.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
14 11
15 class DOMStorageArea; 12 class GURL;
16 class DOMStorageContext;
17 class FilePath;
18 13
19 namespace WebKit { 14 namespace dom_storage {
20 class WebStorageArea;
21 class WebStorageNamespace;
22 }
23 15
24 // Only to be used on the WebKit thread. 16 class DomStorageArea;
25 class DOMStorageNamespace { 17 class DomStorageTaskRunner;
18
19 class DomStorageNamespace {
26 public: 20 public:
27 static DOMStorageNamespace* CreateLocalStorageNamespace( 21 DomStorageNamespace(int64 namespace_id,
28 DOMStorageContext* dom_storage_context, const FilePath& data_dir_path); 22 DomStorageTaskRunner* task_runner);
29 static DOMStorageNamespace* CreateSessionStorageNamespace(
30 DOMStorageContext* dom_storage_context, int64 namespace_id);
31 23
32 ~DOMStorageNamespace(); 24 DomStorageArea* GetStorageArea(const GURL& origin);
33 25
34 DOMStorageArea* GetStorageArea(const string16& origin); 26 int64 namespace_id() const { return namespace_id_; }
35 DOMStorageNamespace* Copy(int64 clone_namespace_id);
36
37 void PurgeMemory();
38
39 const DOMStorageContext* dom_storage_context() const {
40 return dom_storage_context_;
41 }
42 int64 id() const { return id_; }
43 const WebKit::WebString& data_dir_path() const { return data_dir_path_; }
44 DOMStorageType dom_storage_type() const { return dom_storage_type_; }
45
46 // Creates a WebStorageArea for the given origin. This should only be called
47 // by an owned DOMStorageArea.
48 WebKit::WebStorageArea* CreateWebStorageArea(const string16& origin);
49 27
50 private: 28 private:
51 // Called by the static factory methods above. 29 int64 namespace_id_;
52 DOMStorageNamespace(DOMStorageContext* dom_storage_context, 30 scoped_refptr<DomStorageTaskRunner> task_runner_;
benm (inactive) 2012/01/31 18:03:38 Do we want a GUrl,DomStorageArea map here too?
michaeln 2012/01/31 21:17:45 Yup, I'm getting there, still working out ownershi
53 int64 id,
54 const WebKit::WebString& data_dir_path,
55 DOMStorageType storage_type);
56
57 // Creates the underlying WebStorageNamespace on demand.
58 void CreateWebStorageNamespaceIfNecessary();
59
60 // All the storage areas we own.
61 typedef base::hash_map<string16, DOMStorageArea*> OriginToStorageAreaMap;
62 OriginToStorageAreaMap origin_to_storage_area_;
63
64 // The DOMStorageContext that owns us.
65 DOMStorageContext* dom_storage_context_;
66
67 // The WebKit storage namespace we manage.
68 scoped_ptr<WebKit::WebStorageNamespace> storage_namespace_;
69
70 // Our id. Unique to our parent WebKitContext class.
71 int64 id_;
72
73 // The path used to create us, so we can recreate our WebStorageNamespace on
74 // demand.
75 WebKit::WebString data_dir_path_;
76
77 // SessionStorage vs. LocalStorage.
78 const DOMStorageType dom_storage_type_;
79
80 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageNamespace);
81 }; 31 };
82 32
83 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_DOM_STORAGE_NAMESPACE_H_ 33 } // namespace dom_storage
34
35
36 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_NAMESPACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698