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. |
20 : public base::RefCountedThreadSafe<SessionStorageNamespace> { | 19 class DomStorageSession |
| 20 : public base::RefCountedThreadSafe<DomStorageSession> { |
21 public: | 21 public: |
22 explicit SessionStorageNamespace(WebKitContext* context); | 22 explicit DomStorageSession(DomStorageContext* context); |
23 | 23 int64 namespace_id() const { return namespace_id_; } |
24 int64 id() const { return id_; } | 24 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 | 25 |
32 private: | 26 private: |
33 SessionStorageNamespace(WebKitContext* webkit_context, int64 id); | 27 friend class base::RefCountedThreadSafe<DomStorageContext>; |
34 | 28 |
35 friend class base::RefCountedThreadSafe<SessionStorageNamespace>; | 29 DomStorageSession(DomStorageContext* context, int64 namespace_id); |
36 CONTENT_EXPORT ~SessionStorageNamespace(); | 30 ~DomStorageSession(); |
37 | 31 |
38 scoped_refptr<WebKitContext> webkit_context_; | 32 scoped_refptr<DomStorageContext> context_; |
| 33 int64 namespace_id_; |
39 | 34 |
40 // The session storage namespace id. | 35 DISALLOW_IMPLICIT_CONSTRUCTORS(DomStorageSession); |
41 int64 id_; | |
42 | |
43 DISALLOW_IMPLICIT_CONSTRUCTORS(SessionStorageNamespace); | |
44 }; | 36 }; |
45 | 37 |
46 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_SESSION_STORAGE_NAMESPACE_H_ | 38 } // namespace dom_storage |
| 39 |
| 40 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ |
OLD | NEW |