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

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

Issue 1737933002: mojo leveldb: Get profile and leveldb connected to DOMStorageContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT 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 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_CONTEXT_WRAPPER_H_ 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_
6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 18 matching lines...) Expand all
29 class LevelDBWrapperImpl; 29 class LevelDBWrapperImpl;
30 30
31 // This is owned by Storage Partition and encapsulates all its dom storage 31 // This is owned by Storage Partition and encapsulates all its dom storage
32 // state. 32 // state.
33 class CONTENT_EXPORT DOMStorageContextWrapper : 33 class CONTENT_EXPORT DOMStorageContextWrapper :
34 NON_EXPORTED_BASE(public DOMStorageContext), 34 NON_EXPORTED_BASE(public DOMStorageContext),
35 public base::RefCountedThreadSafe<DOMStorageContextWrapper> { 35 public base::RefCountedThreadSafe<DOMStorageContextWrapper> {
36 public: 36 public:
37 // If |data_path| is empty, nothing will be saved to disk. 37 // If |data_path| is empty, nothing will be saved to disk.
38 DOMStorageContextWrapper( 38 DOMStorageContextWrapper(
39 const std::string& mojo_user_id,
39 const base::FilePath& data_path, 40 const base::FilePath& data_path,
41 const base::FilePath& local_partition_path,
40 storage::SpecialStoragePolicy* special_storage_policy); 42 storage::SpecialStoragePolicy* special_storage_policy);
41 43
42 // DOMStorageContext implementation. 44 // DOMStorageContext implementation.
43 void GetLocalStorageUsage( 45 void GetLocalStorageUsage(
44 const GetLocalStorageUsageCallback& callback) override; 46 const GetLocalStorageUsageCallback& callback) override;
45 void GetSessionStorageUsage( 47 void GetSessionStorageUsage(
46 const GetSessionStorageUsageCallback& callback) override; 48 const GetSessionStorageUsageCallback& callback) override;
47 void DeleteLocalStorage(const GURL& origin) override; 49 void DeleteLocalStorage(const GURL& origin) override;
48 void DeleteSessionStorage(const SessionStorageUsageInfo& usage_info) override; 50 void DeleteSessionStorage(const SessionStorageUsageInfo& usage_info) override;
49 void SetSaveSessionStorageOnDisk() override; 51 void SetSaveSessionStorageOnDisk() override;
50 scoped_refptr<SessionStorageNamespace> RecreateSessionStorage( 52 scoped_refptr<SessionStorageNamespace> RecreateSessionStorage(
51 const std::string& persistent_id) override; 53 const std::string& persistent_id) override;
52 void StartScavengingUnusedSessionStorage() override; 54 void StartScavengingUnusedSessionStorage() override;
53 55
54 // Used by content settings to alter the behavior around 56 // Used by content settings to alter the behavior around
55 // what data to keep and what data to discard at shutdown. 57 // what data to keep and what data to discard at shutdown.
56 // The policy is not so straight forward to describe, see 58 // The policy is not so straight forward to describe, see
57 // the implementation for details. 59 // the implementation for details.
58 void SetForceKeepSessionState(); 60 void SetForceKeepSessionState();
59 61
60 // Called when the BrowserContext/Profile is going away. 62 // Called when the BrowserContext/Profile is going away.
61 void Shutdown(); 63 void Shutdown();
62 64
63 void Flush(); 65 void Flush();
64 66
65 // See StoragePartitionService interface. 67 // See StoragePartitionService interface.
66 void OpenLocalStorage( 68 void OpenLocalStorage(const url::Origin& origin,
67 const url::Origin& origin, 69 LevelDBWrapperRequest request);
68 mojo::InterfaceRequest<LevelDBWrapper> request);
69 70
70 private: 71 private:
71 friend class DOMStorageMessageFilter; // for access to context() 72 friend class DOMStorageMessageFilter; // for access to context()
72 friend class SessionStorageNamespaceImpl; // ditto 73 friend class SessionStorageNamespaceImpl; // ditto
73 friend class base::RefCountedThreadSafe<DOMStorageContextWrapper>; 74 friend class base::RefCountedThreadSafe<DOMStorageContextWrapper>;
74 75
75 ~DOMStorageContextWrapper() override; 76 ~DOMStorageContextWrapper() override;
76 DOMStorageContextImpl* context() const { return context_.get(); } 77 DOMStorageContextImpl* context() const { return context_.get(); }
77 78
78 void LevelDBWrapperImplHasNoBindings(const url::Origin& origin); 79 // An inner class to keep all mojo-ish details together and not bleed them
79 80 // through the public interface.
80 // Used for mojo-based LocalStorage implementation (behind 81 class MojoState;
81 // --mojo-local-storage for now). Maps between an origin and its prefixed 82 scoped_ptr<MojoState> mojo_state_;
82 // LevelDB view.
83 std::map<url::Origin, scoped_ptr<LevelDBWrapperImpl>> level_db_wrappers_;
84 83
85 scoped_refptr<DOMStorageContextImpl> context_; 84 scoped_refptr<DOMStorageContextImpl> context_;
86 85
87 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper); 86 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper);
88 }; 87 };
89 88
90 } // namespace content 89 } // namespace content
91 90
92 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ 91 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698