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

Side by Side Diff: content/browser/dom_storage/dom_storage_session.h

Issue 757723002: [Tests not passing yet] Remove prerender sessionStorage namespace merging. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_DOM_STORAGE_DOM_STORAGE_SESSION_H_ 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_SESSION_H_
6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_SESSION_H_ 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_SESSION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
13 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
14 13
15 namespace content { 14 namespace content {
16 15
17 class DOMStorageContextImpl; 16 class DOMStorageContextImpl;
18 17
19 // This refcounted class determines the lifetime of a session 18 // This refcounted class determines the lifetime of a session
20 // storage namespace and provides an interface to Clone() an 19 // storage namespace and provides an interface to Clone() an
21 // existing session storage namespace. It may be used on any thread. 20 // existing session storage namespace. It may be used on any thread.
22 // See class comments for DOMStorageContextImpl for a larger overview. 21 // See class comments for DOMStorageContextImpl for a larger overview.
23 class CONTENT_EXPORT DOMStorageSession 22 class CONTENT_EXPORT DOMStorageSession
24 : public base::RefCountedThreadSafe<DOMStorageSession> { 23 : public base::RefCountedThreadSafe<DOMStorageSession> {
25 public: 24 public:
26 // Constructs a |DOMStorageSession| and allocates new IDs for it. 25 // Constructs a |DOMStorageSession| and allocates new IDs for it.
27 explicit DOMStorageSession(DOMStorageContextImpl* context); 26 explicit DOMStorageSession(DOMStorageContextImpl* context);
28 27
29 // Constructs a |DOMStorageSession| and assigns |persistent_namespace_id| 28 // Constructs a |DOMStorageSession| and assigns |persistent_namespace_id|
30 // to it. Allocates a new non-persistent ID. 29 // to it. Allocates a new non-persistent ID.
31 DOMStorageSession(DOMStorageContextImpl* context, 30 DOMStorageSession(DOMStorageContextImpl* context,
32 const std::string& persistent_namespace_id); 31 const std::string& persistent_namespace_id);
33 32
34 // Constructs a |DOMStorageSession| as an alias of
35 // |master_dom_storage_session|. Allocates a new non-persistent ID.
36 explicit DOMStorageSession(DOMStorageSession* master_dom_storage_session);
37
38 int64 namespace_id() const { return namespace_id_; } 33 int64 namespace_id() const { return namespace_id_; }
39 const std::string& persistent_namespace_id() const { 34 const std::string& persistent_namespace_id() const {
40 return persistent_namespace_id_; 35 return persistent_namespace_id_;
41 } 36 }
42 void SetShouldPersist(bool should_persist); 37 void SetShouldPersist(bool should_persist);
43 bool should_persist() const; 38 bool should_persist() const;
44 bool IsFromContext(DOMStorageContextImpl* context); 39 bool IsFromContext(DOMStorageContextImpl* context);
45 DOMStorageSession* Clone(); 40 DOMStorageSession* Clone();
46 41
47 // Constructs a |DOMStorageSession| by cloning 42 // Constructs a |DOMStorageSession| by cloning
48 // |namespace_id_to_clone|. Allocates new IDs for it. 43 // |namespace_id_to_clone|. Allocates new IDs for it.
49 static DOMStorageSession* CloneFrom(DOMStorageContextImpl* context, 44 static DOMStorageSession* CloneFrom(DOMStorageContextImpl* context,
50 int64 namepace_id_to_clone); 45 int64 namepace_id_to_clone);
51 46
52 void AddTransactionLogProcessId(int process_id);
53 void RemoveTransactionLogProcessId(int process_id);
54 void Merge(bool actually_merge,
55 int process_id,
56 DOMStorageSession* other,
57 const SessionStorageNamespace::MergeResultCallback& callback);
58
59 private: 47 private:
60 friend class base::RefCountedThreadSafe<DOMStorageSession>; 48 friend class base::RefCountedThreadSafe<DOMStorageSession>;
61 49
62 DOMStorageSession(DOMStorageContextImpl* context, 50 DOMStorageSession(DOMStorageContextImpl* context,
63 int64 namespace_id, 51 int64 namespace_id,
64 const std::string& persistent_namespace_id); 52 const std::string& persistent_namespace_id);
65 ~DOMStorageSession(); 53 ~DOMStorageSession();
66 54
67 void ProcessMergeResult(
68 bool actually_merge,
69 const SessionStorageNamespace::MergeResultCallback& callback,
70 const std::string& new_persistent_namespace_id,
71 SessionStorageNamespace::MergeResult result);
72
73 scoped_refptr<DOMStorageContextImpl> context_; 55 scoped_refptr<DOMStorageContextImpl> context_;
74 int64 namespace_id_; 56 int64 namespace_id_;
75 std::string persistent_namespace_id_; 57 std::string persistent_namespace_id_;
76 bool should_persist_; 58 bool should_persist_;
77 59
78 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageSession); 60 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageSession);
79 }; 61 };
80 62
81 } // namespace content 63 } // namespace content
82 64
83 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_SESSION_H_ 65 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_SESSION_H_
OLDNEW
« no previous file with comments | « content/browser/dom_storage/dom_storage_namespace.cc ('k') | content/browser/dom_storage/dom_storage_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698