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

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

Issue 2788813002: Try to flush DOMStorage too when ending the browsing session.
Patch Set: fixes Created 3 years, 8 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
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/memory_coordinator_client.h" 12 #include "base/memory/memory_coordinator_client.h"
13 #include "base/memory/memory_pressure_listener.h" 13 #include "base/memory/memory_pressure_listener.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "content/browser/dom_storage/dom_storage_context_impl.h" 15 #include "content/browser/dom_storage/dom_storage_context_impl.h"
16 #include "content/browser/dom_storage/dom_storage_task_runner.h"
16 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
17 #include "content/common/storage_partition_service.mojom.h" 18 #include "content/common/storage_partition_service.mojom.h"
18 #include "content/public/browser/dom_storage_context.h" 19 #include "content/public/browser/dom_storage_context.h"
19 #include "url/origin.h" 20 #include "url/origin.h"
20 21
21 namespace base { 22 namespace base {
22 class FilePath; 23 class FilePath;
23 } 24 }
24 25
25 namespace service_manager { 26 namespace service_manager {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 65
65 // Used by content settings to alter the behavior around 66 // Used by content settings to alter the behavior around
66 // what data to keep and what data to discard at shutdown. 67 // what data to keep and what data to discard at shutdown.
67 // The policy is not so straight forward to describe, see 68 // The policy is not so straight forward to describe, see
68 // the implementation for details. 69 // the implementation for details.
69 void SetForceKeepSessionState(); 70 void SetForceKeepSessionState();
70 71
71 // Called when the BrowserContext/Profile is going away. 72 // Called when the BrowserContext/Profile is going away.
72 void Shutdown(); 73 void Shutdown();
73 74
74 void Flush(); 75 // Write any unwritten data to disk, returns a collection of task runners
76 // that have been tasked with writing data.
77 // Note: this method does not sync the data - it only ensures that any
78 // unwritten data has been written out to the filesystem.
79 std::vector<scoped_refptr<base::SequencedTaskRunner>> Flush();
75 80
76 // See mojom::StoragePartitionService interface. 81 // See mojom::StoragePartitionService interface.
77 void OpenLocalStorage(const url::Origin& origin, 82 void OpenLocalStorage(const url::Origin& origin,
78 mojom::LevelDBWrapperRequest request); 83 mojom::LevelDBWrapperRequest request);
79 84
80 private: 85 private:
81 friend class DOMStorageMessageFilter; // for access to context() 86 friend class DOMStorageMessageFilter; // for access to context()
82 friend class SessionStorageNamespaceImpl; // ditto 87 friend class SessionStorageNamespaceImpl; // ditto
83 friend class base::RefCountedThreadSafe<DOMStorageContextWrapper>; 88 friend class base::RefCountedThreadSafe<DOMStorageContextWrapper>;
84 friend class MojoDOMStorageBrowserTest; 89 friend class MojoDOMStorageBrowserTest;
(...skipping 21 matching lines...) Expand all
106 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; 111 std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_;
107 112
108 scoped_refptr<DOMStorageContextImpl> context_; 113 scoped_refptr<DOMStorageContextImpl> context_;
109 114
110 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper); 115 DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageContextWrapper);
111 }; 116 };
112 117
113 } // namespace content 118 } // namespace content
114 119
115 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_ 120 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_CONTEXT_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698