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

Side by Side Diff: content/browser/in_process_webkit/indexed_db_context_impl.h

Issue 10447117: Unwire the clear on exit preference from the storage systems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_IMPL_H_ 5 #ifndef CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_IMPL_H_
6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_IMPL_H_ 6 #define CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 base::MessageLoopProxy* webkit_thread_loop); 43 base::MessageLoopProxy* webkit_thread_loop);
44 44
45 WebKit::WebIDBFactory* GetIDBFactory(); 45 WebKit::WebIDBFactory* GetIDBFactory();
46 46
47 // The indexed db directory. 47 // The indexed db directory.
48 static const FilePath::CharType kIndexedDBDirectory[]; 48 static const FilePath::CharType kIndexedDBDirectory[];
49 49
50 // The indexed db file extension. 50 // The indexed db file extension.
51 static const FilePath::CharType kIndexedDBExtension[]; 51 static const FilePath::CharType kIndexedDBExtension[];
52 52
53 void set_clear_local_state_on_exit(bool clear_local_state) { 53 // Disables the exit-time deletion of session-only data.
54 clear_local_state_on_exit_ = clear_local_state; 54 void SetForceKeepSessionState() {
55 } 55 force_keep_session_state_ = true;
56
57 // Disables the exit-time deletion for all data (also session-only data).
58 void SaveSessionState() {
59 save_session_state_ = true;
60 } 56 }
61 57
62 // IndexedDBContext implementation: 58 // IndexedDBContext implementation:
63 virtual std::vector<GURL> GetAllOrigins() OVERRIDE; 59 virtual std::vector<GURL> GetAllOrigins() OVERRIDE;
64 virtual int64 GetOriginDiskUsage(const GURL& origin_url) OVERRIDE; 60 virtual int64 GetOriginDiskUsage(const GURL& origin_url) OVERRIDE;
65 virtual base::Time GetOriginLastModified(const GURL& origin_url) OVERRIDE; 61 virtual base::Time GetOriginLastModified(const GURL& origin_url) OVERRIDE;
66 virtual void DeleteForOrigin(const GURL& origin_url) OVERRIDE; 62 virtual void DeleteForOrigin(const GURL& origin_url) OVERRIDE;
67 virtual FilePath GetFilePathForTesting( 63 virtual FilePath GetFilePathForTesting(
68 const string16& origin_id) const OVERRIDE; 64 const string16& origin_id) const OVERRIDE;
69 65
(...skipping 12 matching lines...) Expand all
82 void set_data_path_for_testing(const FilePath& data_path) { 78 void set_data_path_for_testing(const FilePath& data_path) {
83 data_path_ = data_path; 79 data_path_ = data_path;
84 } 80 }
85 81
86 protected: 82 protected:
87 virtual ~IndexedDBContextImpl(); 83 virtual ~IndexedDBContextImpl();
88 84
89 private: 85 private:
90 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearLocalState); 86 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearLocalState);
91 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearSessionOnlyDatabases); 87 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearSessionOnlyDatabases);
92 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, SaveSessionState); 88 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, SetForceKeepSessionState);
93 friend class IndexedDBQuotaClientTest; 89 friend class IndexedDBQuotaClientTest;
94 90
95 typedef std::map<GURL, int64> OriginToSizeMap; 91 typedef std::map<GURL, int64> OriginToSizeMap;
96 class IndexedDBGetUsageAndQuotaCallback; 92 class IndexedDBGetUsageAndQuotaCallback;
97 93
98 FilePath GetIndexedDBFilePath(const string16& origin_id) const; 94 FilePath GetIndexedDBFilePath(const string16& origin_id) const;
99 int64 ReadUsageFromDisk(const GURL& origin_url) const; 95 int64 ReadUsageFromDisk(const GURL& origin_url) const;
100 void EnsureDiskUsageCacheInitialized(const GURL& origin_url); 96 void EnsureDiskUsageCacheInitialized(const GURL& origin_url);
101 void QueryDiskAndUpdateQuotaUsage(const GURL& origin_url); 97 void QueryDiskAndUpdateQuotaUsage(const GURL& origin_url);
102 void GotUsageAndQuota(const GURL& origin_url, quota::QuotaStatusCode, 98 void GotUsageAndQuota(const GURL& origin_url, quota::QuotaStatusCode,
(...skipping 11 matching lines...) Expand all
114 bool IsInOriginSet(const GURL& origin_url) { 110 bool IsInOriginSet(const GURL& origin_url) {
115 std::set<GURL>* set = GetOriginSet(); 111 std::set<GURL>* set = GetOriginSet();
116 return set->find(origin_url) != set->end(); 112 return set->find(origin_url) != set->end();
117 } 113 }
118 114
119 // Only for testing. 115 // Only for testing.
120 void ResetCaches(); 116 void ResetCaches();
121 117
122 scoped_ptr<WebKit::WebIDBFactory> idb_factory_; 118 scoped_ptr<WebKit::WebIDBFactory> idb_factory_;
123 FilePath data_path_; 119 FilePath data_path_;
124 bool clear_local_state_on_exit_;
125 // If true, nothing (not even session-only data) should be deleted on exit. 120 // If true, nothing (not even session-only data) should be deleted on exit.
126 bool save_session_state_; 121 bool force_keep_session_state_;
127 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; 122 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
128 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; 123 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
129 scoped_ptr<std::set<GURL> > origin_set_; 124 scoped_ptr<std::set<GURL> > origin_set_;
130 OriginToSizeMap origin_size_map_; 125 OriginToSizeMap origin_size_map_;
131 OriginToSizeMap space_available_map_; 126 OriginToSizeMap space_available_map_;
132 std::map<GURL, unsigned int> connection_count_; 127 std::map<GURL, unsigned int> connection_count_;
133 128
134 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); 129 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl);
135 }; 130 };
136 131
137 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_IMPL_H_ 132 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698