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

Side by Side Diff: content/renderer/dom_storage/local_storage_area.h

Issue 1814003002: Implement the renderer side of the mojo based local storage implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_ 5 #ifndef CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_
6 #define CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_ 6 #define CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/renderer/dom_storage/local_storage_cached_area.h" 9 #include "content/renderer/dom_storage/local_storage_cached_area.h"
11 #include "third_party/WebKit/public/platform/WebStorageArea.h" 10 #include "third_party/WebKit/public/platform/WebStorageArea.h"
12 11
13 namespace content { 12 namespace content {
14 13
15 // There could be n instances of this class for the same origin in a renderer 14 // There could be n instances of this class for the same origin in a renderer
16 // process. It delegates to the one LocalStorageCachedArea instance in a process 15 // process. It delegates to the one LocalStorageCachedArea instance in a process
17 // for a given origin. 16 // for a given origin.
18 class LocalStorageArea : public blink::WebStorageArea { 17 class LocalStorageArea : public blink::WebStorageArea {
19 public: 18 public:
20 explicit LocalStorageArea(scoped_refptr<LocalStorageCachedArea> cached_area); 19 // |cached_area| outlives this object.
20 explicit LocalStorageArea(LocalStorageCachedArea* cached_area);
21 ~LocalStorageArea() override; 21 ~LocalStorageArea() override;
22 22
23 // blink::WebStorageArea: 23 // blink::WebStorageArea:
24 unsigned length() override; 24 unsigned length() override;
25 blink::WebString key(unsigned index) override; 25 blink::WebString key(unsigned index) override;
26 blink::WebString getItem(const blink::WebString& key) override; 26 blink::WebString getItem(const blink::WebString& key) override;
27 void setItem(const blink::WebString& key, 27 void setItem(const blink::WebString& key,
28 const blink::WebString& value, 28 const blink::WebString& value,
29 const blink::WebURL& page_url, 29 const blink::WebURL& page_url,
30 WebStorageArea::Result& result) override; 30 WebStorageArea::Result& result) override;
31 void removeItem(const blink::WebString& key, 31 void removeItem(const blink::WebString& key,
32 const blink::WebURL& page_url) override; 32 const blink::WebURL& page_url) override;
33 void clear(const blink::WebURL& url) override; 33 void clear(const blink::WebURL& url) override;
34 34
35 const std::string& id() const { return id_; }
36
35 private: 37 private:
36 scoped_refptr<LocalStorageCachedArea> cached_area_; 38 LocalStorageCachedArea* cached_area_;
39 // A globally unique identifier for this storage area. It's used to pass the
40 // source storage area, if any, in mutation events.
41 std::string id_;
dcheng 2016/03/18 06:35:29 Maybe const this so it can only be bound in the co
jam 2016/03/18 16:48:33 i believe this is personal preference (i.e. nothin
37 42
38 DISALLOW_COPY_AND_ASSIGN(LocalStorageArea); 43 DISALLOW_COPY_AND_ASSIGN(LocalStorageArea);
39 }; 44 };
40 45
41 } // namespace content 46 } // namespace content
42 47
43 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_ 48 #endif // CONTENT_RENDERER_DOM_STORAGE_LOCAL_STORAGE_AREA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698