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

Side by Side Diff: content/browser/dom_storage/dom_storage_host.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_HOST_H_ 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_HOST_H_
6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_HOST_H_ 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_HOST_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/strings/nullable_string16.h" 11 #include "base/strings/nullable_string16.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "content/browser/dom_storage/dom_storage_namespace.h"
14 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
15 #include "content/common/dom_storage/dom_storage_types.h" 14 #include "content/common/dom_storage/dom_storage_types.h"
16 15
17 class GURL; 16 class GURL;
18 17
19 namespace content { 18 namespace content {
20 19
21 class DOMStorageContextImpl; 20 class DOMStorageContextImpl;
22 class DOMStorageHost; 21 class DOMStorageHost;
23 class DOMStorageNamespace; 22 class DOMStorageNamespace;
24 class DOMStorageArea; 23 class DOMStorageArea;
25 24
26 // One instance is allocated in the main process for each client process. 25 // One instance is allocated in the main process for each client process.
27 // Used by DOMStorageMessageFilter in Chrome. 26 // Used by DOMStorageMessageFilter in Chrome and by SimpleDOMStorage in DRT.
28 // This class is single threaded, and performs blocking file reads/writes, 27 // This class is single threaded, and performs blocking file reads/writes,
29 // so it shouldn't be used on chrome's IO thread. 28 // so it shouldn't be used on chrome's IO thread.
30 // See class comments for DOMStorageContextImpl for a larger overview. 29 // See class comments for DOMStorageContextImpl for a larger overview.
31 class CONTENT_EXPORT DOMStorageHost { 30 class CONTENT_EXPORT DOMStorageHost {
32 public: 31 public:
33 DOMStorageHost(DOMStorageContextImpl* context, int render_process_id); 32 explicit DOMStorageHost(DOMStorageContextImpl* context);
34 ~DOMStorageHost(); 33 ~DOMStorageHost();
35 34
36 bool OpenStorageArea(int connection_id, int namespace_id, 35 bool OpenStorageArea(int connection_id, int namespace_id,
37 const GURL& origin); 36 const GURL& origin);
38 void CloseStorageArea(int connection_id); 37 void CloseStorageArea(int connection_id);
39 bool ExtractAreaValues(int connection_id, DOMStorageValuesMap* map, 38 bool ExtractAreaValues(int connection_id, DOMStorageValuesMap* map);
40 bool* send_log_get_messages);
41 unsigned GetAreaLength(int connection_id); 39 unsigned GetAreaLength(int connection_id);
42 base::NullableString16 GetAreaKey(int connection_id, unsigned index); 40 base::NullableString16 GetAreaKey(int connection_id, unsigned index);
43 base::NullableString16 GetAreaItem(int connection_id, 41 base::NullableString16 GetAreaItem(int connection_id,
44 const base::string16& key); 42 const base::string16& key);
45 bool SetAreaItem(int connection_id, const base::string16& key, 43 bool SetAreaItem(int connection_id, const base::string16& key,
46 const base::string16& value, const GURL& page_url, 44 const base::string16& value, const GURL& page_url,
47 base::NullableString16* old_value); 45 base::NullableString16* old_value);
48 void LogGetAreaItem(int connection_id, const base::string16& key,
49 const base::NullableString16& value);
50 bool RemoveAreaItem(int connection_id, const base::string16& key, 46 bool RemoveAreaItem(int connection_id, const base::string16& key,
51 const GURL& page_url, 47 const GURL& page_url,
52 base::string16* old_value); 48 base::string16* old_value);
53 bool ClearArea(int connection_id, const GURL& page_url); 49 bool ClearArea(int connection_id, const GURL& page_url);
54 bool HasAreaOpen(int64 namespace_id, const GURL& origin, 50 bool HasAreaOpen(int namespace_id, const GURL& origin) const;
55 int64* alias_namespace_id) const;
56 // Resets all open areas for the namespace provided. Returns true
57 // iff there were any areas to reset.
58 bool ResetOpenAreasForNamespace(int64 namespace_id);
59 51
60 private: 52 private:
61 // Struct to hold references needed for areas that are open 53 // Struct to hold references needed for areas that are open
62 // within our associated client process. 54 // within our associated client process.
63 struct NamespaceAndArea { 55 struct NamespaceAndArea {
64 scoped_refptr<DOMStorageNamespace> namespace_; 56 scoped_refptr<DOMStorageNamespace> namespace_;
65 scoped_refptr<DOMStorageArea> area_; 57 scoped_refptr<DOMStorageArea> area_;
66 NamespaceAndArea(); 58 NamespaceAndArea();
67 ~NamespaceAndArea(); 59 ~NamespaceAndArea();
68 }; 60 };
69 typedef std::map<int, NamespaceAndArea > AreaMap; 61 typedef std::map<int, NamespaceAndArea > AreaMap;
70 62
71 DOMStorageArea* GetOpenArea(int connection_id); 63 DOMStorageArea* GetOpenArea(int connection_id);
72 DOMStorageNamespace* GetNamespace(int connection_id); 64 DOMStorageNamespace* GetNamespace(int connection_id);
73 void MaybeLogTransaction(
74 int connection_id,
75 DOMStorageNamespace::LogType transaction_type,
76 const GURL& origin,
77 const GURL& page_url,
78 const base::string16& key,
79 const base::NullableString16& value);
80 65
81 scoped_refptr<DOMStorageContextImpl> context_; 66 scoped_refptr<DOMStorageContextImpl> context_;
82 AreaMap connections_; 67 AreaMap connections_;
83 int render_process_id_;
84 68
85 DISALLOW_COPY_AND_ASSIGN(DOMStorageHost); 69 DISALLOW_COPY_AND_ASSIGN(DOMStorageHost);
86 }; 70 };
87 71
88 } // namespace content 72 } // namespace content
89 73
90 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_HOST_H_ 74 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/dom_storage/dom_storage_context_impl_unittest.cc ('k') | content/browser/dom_storage/dom_storage_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698