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

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

Issue 10695158: IndexedDB: Close open databases when user requests browsing data deletion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove const from iterator (not sure how this slipped through) Created 8 years, 3 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
« no previous file with comments | « no previous file | content/browser/in_process_webkit/indexed_db_context_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "content/public/browser/indexed_db_context.h" 15 #include "content/public/browser/indexed_db_context.h"
16 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
17 #include "webkit/quota/quota_types.h" 17 #include "webkit/quota/quota_types.h"
18 18
19 class GURL; 19 class GURL;
20 class FilePath; 20 class FilePath;
21 21
22 namespace WebKit { 22 namespace WebKit {
23 class WebIDBDatabase;
23 class WebIDBFactory; 24 class WebIDBFactory;
24 } 25 }
25 26
26 namespace base { 27 namespace base {
27 class MessageLoopProxy; 28 class MessageLoopProxy;
28 } 29 }
29 30
30 namespace quota { 31 namespace quota {
31 class QuotaManagerProxy; 32 class QuotaManagerProxy;
32 class SpecialStoragePolicy; 33 class SpecialStoragePolicy;
(...skipping 23 matching lines...) Expand all
56 57
57 // IndexedDBContext implementation: 58 // IndexedDBContext implementation:
58 virtual std::vector<GURL> GetAllOrigins() OVERRIDE; 59 virtual std::vector<GURL> GetAllOrigins() OVERRIDE;
59 virtual int64 GetOriginDiskUsage(const GURL& origin_url) OVERRIDE; 60 virtual int64 GetOriginDiskUsage(const GURL& origin_url) OVERRIDE;
60 virtual base::Time GetOriginLastModified(const GURL& origin_url) OVERRIDE; 61 virtual base::Time GetOriginLastModified(const GURL& origin_url) OVERRIDE;
61 virtual void DeleteForOrigin(const GURL& origin_url) OVERRIDE; 62 virtual void DeleteForOrigin(const GURL& origin_url) OVERRIDE;
62 virtual FilePath GetFilePathForTesting( 63 virtual FilePath GetFilePathForTesting(
63 const string16& origin_id) const OVERRIDE; 64 const string16& origin_id) const OVERRIDE;
64 65
65 // Methods called by IndexedDBDispatcherHost for quota support. 66 // Methods called by IndexedDBDispatcherHost for quota support.
66 void ConnectionOpened(const GURL& origin_url); 67 void ConnectionOpened(const GURL& origin_url, WebKit::WebIDBDatabase*);
67 void ConnectionClosed(const GURL& origin_url); 68 void ConnectionClosed(const GURL& origin_url, WebKit::WebIDBDatabase*);
68 void TransactionComplete(const GURL& origin_url); 69 void TransactionComplete(const GURL& origin_url);
69 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes); 70 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes);
70 bool IsOverQuota(const GURL& origin_url); 71 bool IsOverQuota(const GURL& origin_url);
71 72
72 quota::QuotaManagerProxy* quota_manager_proxy(); 73 quota::QuotaManagerProxy* quota_manager_proxy();
73 74
74 FilePath data_path() const { return data_path_; } 75 FilePath data_path() const { return data_path_; }
75 76
76 // For unit tests allow to override the |data_path_|. 77 // For unit tests allow to override the |data_path_|.
77 void set_data_path_for_testing(const FilePath& data_path) { 78 void set_data_path_for_testing(const FilePath& data_path) {
78 data_path_ = data_path; 79 data_path_ = data_path;
79 } 80 }
80 81
81 protected: 82 protected:
82 virtual ~IndexedDBContextImpl(); 83 virtual ~IndexedDBContextImpl();
83 84
84 private: 85 private:
85 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearLocalState); 86 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearLocalState);
86 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearSessionOnlyDatabases); 87 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearSessionOnlyDatabases);
87 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, SetForceKeepSessionState); 88 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, SetForceKeepSessionState);
89 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ForceCloseOpenDatabasesOnDelete);
88 friend class IndexedDBQuotaClientTest; 90 friend class IndexedDBQuotaClientTest;
89 91
90 typedef std::map<GURL, int64> OriginToSizeMap; 92 typedef std::map<GURL, int64> OriginToSizeMap;
91 class IndexedDBGetUsageAndQuotaCallback; 93 class IndexedDBGetUsageAndQuotaCallback;
92 94
93 FilePath GetIndexedDBFilePath(const string16& origin_id) const; 95 FilePath GetIndexedDBFilePath(const string16& origin_id) const;
94 int64 ReadUsageFromDisk(const GURL& origin_url) const; 96 int64 ReadUsageFromDisk(const GURL& origin_url) const;
95 void EnsureDiskUsageCacheInitialized(const GURL& origin_url); 97 void EnsureDiskUsageCacheInitialized(const GURL& origin_url);
96 void QueryDiskAndUpdateQuotaUsage(const GURL& origin_url); 98 void QueryDiskAndUpdateQuotaUsage(const GURL& origin_url);
97 void GotUsageAndQuota(const GURL& origin_url, quota::QuotaStatusCode, 99 void GotUsageAndQuota(const GURL& origin_url, quota::QuotaStatusCode,
(...skipping 18 matching lines...) Expand all
116 118
117 scoped_ptr<WebKit::WebIDBFactory> idb_factory_; 119 scoped_ptr<WebKit::WebIDBFactory> idb_factory_;
118 FilePath data_path_; 120 FilePath data_path_;
119 // If true, nothing (not even session-only data) should be deleted on exit. 121 // If true, nothing (not even session-only data) should be deleted on exit.
120 bool force_keep_session_state_; 122 bool force_keep_session_state_;
121 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; 123 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
122 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; 124 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
123 scoped_ptr<std::set<GURL> > origin_set_; 125 scoped_ptr<std::set<GURL> > origin_set_;
124 OriginToSizeMap origin_size_map_; 126 OriginToSizeMap origin_size_map_;
125 OriginToSizeMap space_available_map_; 127 OriginToSizeMap space_available_map_;
126 std::map<GURL, unsigned int> connection_count_; 128 typedef std::set<WebKit::WebIDBDatabase*> ConnectionSet;
129 std::map<GURL, ConnectionSet> connections_;
127 130
128 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); 131 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl);
129 }; 132 };
130 133
131 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_IMPL_H_ 134 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/in_process_webkit/indexed_db_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698