OLD | NEW |
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_SESSION_STORAGE_NAMESPACE_H_ | 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ |
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_SESSION_STORAGE_NAMESPACE_H_ | 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "content/common/content_export.h" | |
12 | 11 |
13 class WebKitContext; | 12 namespace dom_storage { |
14 | 13 |
15 // This is a ref-counted class that represents a SessionStorageNamespace. | 14 class DomStorageContext; |
16 // On destruction it ensures that the storage namespace is destroyed. | 15 |
17 // NOTE: That if we're shutting down, we don't strictly need to do this, but | 16 // This refcounted class determines the lifetime of a session |
18 // it keeps valgrind happy. | 17 // storage namespace and provides an interface to Clone() an |
19 class SessionStorageNamespace | 18 // existing session storage namespace. It may be used on any thread. |
20 : public base::RefCountedThreadSafe<SessionStorageNamespace> { | 19 // See class comments for DomStorageContext for a larger overview. |
| 20 class DomStorageSession |
| 21 : public base::RefCountedThreadSafe<DomStorageSession> { |
21 public: | 22 public: |
22 explicit SessionStorageNamespace(WebKitContext* context); | 23 explicit DomStorageSession(DomStorageContext* context); |
23 | 24 int64 namespace_id() const { return namespace_id_; } |
24 int64 id() const { return id_; } | 25 DomStorageSession* Clone(); |
25 | |
26 // The session storage namespace parameter allows multiple render views and | |
27 // tab contentses to share the same session storage (part of the WebStorage | |
28 // spec) space. Passing in NULL simply allocates a new one which is often the | |
29 // correct thing to do (especially in tests. | |
30 SessionStorageNamespace* Clone(); | |
31 | 26 |
32 private: | 27 private: |
33 SessionStorageNamespace(WebKitContext* webkit_context, int64 id); | 28 friend class base::RefCountedThreadSafe<DomStorageContext>; |
34 | 29 |
35 friend class base::RefCountedThreadSafe<SessionStorageNamespace>; | 30 DomStorageSession(DomStorageContext* context, int64 namespace_id); |
36 CONTENT_EXPORT ~SessionStorageNamespace(); | 31 ~DomStorageSession(); |
37 | 32 |
38 scoped_refptr<WebKitContext> webkit_context_; | 33 scoped_refptr<DomStorageContext> context_; |
| 34 int64 namespace_id_; |
39 | 35 |
40 // The session storage namespace id. | 36 DISALLOW_IMPLICIT_CONSTRUCTORS(DomStorageSession); |
41 int64 id_; | |
42 | |
43 DISALLOW_IMPLICIT_CONSTRUCTORS(SessionStorageNamespace); | |
44 }; | 37 }; |
45 | 38 |
46 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_SESSION_STORAGE_NAMESPACE_H_ | 39 } // namespace dom_storage |
| 40 |
| 41 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ |
OLD | NEW |