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

Side by Side Diff: webkit/dom_storage/dom_storage_session.h

Issue 10546167: Create and store persistent unique ids for sessionStorage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: code review Created 8 years, 6 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
« no previous file with comments | « webkit/dom_storage/dom_storage_namespace.cc ('k') | webkit/dom_storage/dom_storage_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:
25 // Constructs a |DomStorageSession| and allocates new IDs for it.
23 explicit DomStorageSession(DomStorageContext* context); 26 explicit DomStorageSession(DomStorageContext* context);
27
28 // Constructs a |DomStorageSession| and assigns |persistent_namespace_id|
29 // to it. Allocates a new non-persistent ID.
30 DomStorageSession(DomStorageContext* context,
31 const std::string& persistent_namespace_id);
32
24 int64 namespace_id() const { return namespace_id_; } 33 int64 namespace_id() const { return namespace_id_; }
34 const std::string& persistent_namespace_id() const {
35 return persistent_namespace_id_;
36 }
25 DomStorageSession* Clone(); 37 DomStorageSession* Clone();
26 38
39 // Constructs a |DomStorageSession| by cloning
40 // |namespace_id_to_clone|. Allocates new IDs for it.
27 static DomStorageSession* CloneFrom(DomStorageContext* context, 41 static DomStorageSession* CloneFrom(DomStorageContext* context,
28 int64 namepace_id_to_clone); 42 int64 namepace_id_to_clone);
29 43
30 private: 44 private:
31 friend class base::RefCountedThreadSafe<DomStorageSession>; 45 friend class base::RefCountedThreadSafe<DomStorageSession>;
32 46
33 DomStorageSession(DomStorageContext* context, int64 namespace_id); 47 DomStorageSession(DomStorageContext* context,
48 int64 namespace_id,
49 const std::string& persistent_namespace_id);
34 ~DomStorageSession(); 50 ~DomStorageSession();
35 51
36 scoped_refptr<DomStorageContext> context_; 52 scoped_refptr<DomStorageContext> context_;
37 int64 namespace_id_; 53 int64 namespace_id_;
54 std::string persistent_namespace_id_;
38 55
39 DISALLOW_IMPLICIT_CONSTRUCTORS(DomStorageSession); 56 DISALLOW_IMPLICIT_CONSTRUCTORS(DomStorageSession);
40 }; 57 };
41 58
42 } // namespace dom_storage 59 } // namespace dom_storage
43 60
44 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ 61 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_
OLDNEW
« no previous file with comments | « webkit/dom_storage/dom_storage_namespace.cc ('k') | webkit/dom_storage/dom_storage_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698