OLD | NEW |
1 // Copyright (c) 2012 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 WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ | 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ |
6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ | 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include <string> |
| 10 |
9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
11 | 13 |
12 namespace dom_storage { | 14 namespace dom_storage { |
13 | 15 |
14 class DomStorageContext; | 16 class DomStorageContext; |
15 | 17 |
16 // This refcounted class determines the lifetime of a session | 18 // This refcounted class determines the lifetime of a session |
17 // storage namespace and provides an interface to Clone() an | 19 // storage namespace and provides an interface to Clone() an |
18 // existing session storage namespace. It may be used on any thread. | 20 // existing session storage namespace. It may be used on any thread. |
19 // See class comments for DomStorageContext for a larger overview. | 21 // See class comments for DomStorageContext for a larger overview. |
20 class DomStorageSession | 22 class DomStorageSession |
21 : public base::RefCountedThreadSafe<DomStorageSession> { | 23 : public base::RefCountedThreadSafe<DomStorageSession> { |
22 public: | 24 public: |
23 explicit DomStorageSession(DomStorageContext* context); | 25 explicit DomStorageSession(DomStorageContext* context); |
| 26 DomStorageSession(DomStorageContext* context, |
| 27 const std::string& persistent_namespace_id); |
24 int64 namespace_id() const { return namespace_id_; } | 28 int64 namespace_id() const { return namespace_id_; } |
| 29 std::string persistent_namespace_id() const { |
| 30 return persistent_namespace_id_; |
| 31 } |
25 DomStorageSession* Clone(); | 32 DomStorageSession* Clone(); |
26 | 33 |
27 private: | 34 private: |
28 friend class base::RefCountedThreadSafe<DomStorageSession>; | 35 friend class base::RefCountedThreadSafe<DomStorageSession>; |
29 | 36 |
30 DomStorageSession(DomStorageContext* context, int64 namespace_id); | 37 DomStorageSession(DomStorageContext* context, |
| 38 int64 namespace_id, |
| 39 const std::string& persistent_namespace_id); |
31 ~DomStorageSession(); | 40 ~DomStorageSession(); |
32 | 41 |
33 scoped_refptr<DomStorageContext> context_; | 42 scoped_refptr<DomStorageContext> context_; |
34 int64 namespace_id_; | 43 int64 namespace_id_; |
| 44 std::string persistent_namespace_id_; |
35 | 45 |
36 DISALLOW_IMPLICIT_CONSTRUCTORS(DomStorageSession); | 46 DISALLOW_IMPLICIT_CONSTRUCTORS(DomStorageSession); |
37 }; | 47 }; |
38 | 48 |
39 } // namespace dom_storage | 49 } // namespace dom_storage |
40 | 50 |
41 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ | 51 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ |
OLD | NEW |