| OLD | NEW |
| 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_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 void SetForceKeepSessionState() { | 57 void SetForceKeepSessionState() { |
| 58 force_keep_session_state_ = true; | 58 force_keep_session_state_ = true; |
| 59 } | 59 } |
| 60 | 60 |
| 61 // IndexedDBContext implementation: | 61 // IndexedDBContext implementation: |
| 62 virtual std::vector<GURL> GetAllOrigins() OVERRIDE; | 62 virtual std::vector<GURL> GetAllOrigins() OVERRIDE; |
| 63 virtual std::vector<IndexedDBInfo> GetAllOriginsInfo() OVERRIDE; | 63 virtual std::vector<IndexedDBInfo> GetAllOriginsInfo() OVERRIDE; |
| 64 virtual int64 GetOriginDiskUsage(const GURL& origin_url) OVERRIDE; | 64 virtual int64 GetOriginDiskUsage(const GURL& origin_url) OVERRIDE; |
| 65 virtual base::Time GetOriginLastModified(const GURL& origin_url) OVERRIDE; | 65 virtual base::Time GetOriginLastModified(const GURL& origin_url) OVERRIDE; |
| 66 virtual void DeleteForOrigin(const GURL& origin_url) OVERRIDE; | 66 virtual void DeleteForOrigin(const GURL& origin_url) OVERRIDE; |
| 67 virtual void ForceClose(const GURL& origin_url) OVERRIDE; |
| 68 virtual base::FilePath GetFilePath(const GURL& origin_url) OVERRIDE; |
| 67 virtual base::FilePath GetFilePathForTesting( | 69 virtual base::FilePath GetFilePathForTesting( |
| 68 const string16& origin_id) const OVERRIDE; | 70 const string16& origin_id) const OVERRIDE; |
| 71 virtual bool HasOrigin(const GURL& origin_url) OVERRIDE; |
| 69 | 72 |
| 70 // Methods called by IndexedDBDispatcherHost for quota support. | 73 // Methods called by IndexedDBDispatcherHost for quota support. |
| 71 void ConnectionOpened(const GURL& origin_url, WebKit::WebIDBDatabase*); | 74 void ConnectionOpened(const GURL& origin_url, WebKit::WebIDBDatabase*); |
| 72 void ConnectionClosed(const GURL& origin_url, WebKit::WebIDBDatabase*); | 75 void ConnectionClosed(const GURL& origin_url, WebKit::WebIDBDatabase*); |
| 73 void TransactionComplete(const GURL& origin_url); | 76 void TransactionComplete(const GURL& origin_url); |
| 74 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes); | 77 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes); |
| 75 bool IsOverQuota(const GURL& origin_url); | 78 bool IsOverQuota(const GURL& origin_url); |
| 76 | 79 |
| 77 quota::QuotaManagerProxy* quota_manager_proxy(); | 80 quota::QuotaManagerProxy* quota_manager_proxy(); |
| 78 | 81 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 105 void GotUpdatedQuota(const GURL& origin_url, int64 usage, int64 quota); | 108 void GotUpdatedQuota(const GURL& origin_url, int64 usage, int64 quota); |
| 106 void QueryAvailableQuota(const GURL& origin_url); | 109 void QueryAvailableQuota(const GURL& origin_url); |
| 107 | 110 |
| 108 std::set<GURL>* GetOriginSet(); | 111 std::set<GURL>* GetOriginSet(); |
| 109 bool AddToOriginSet(const GURL& origin_url) { | 112 bool AddToOriginSet(const GURL& origin_url) { |
| 110 return GetOriginSet()->insert(origin_url).second; | 113 return GetOriginSet()->insert(origin_url).second; |
| 111 } | 114 } |
| 112 void RemoveFromOriginSet(const GURL& origin_url) { | 115 void RemoveFromOriginSet(const GURL& origin_url) { |
| 113 GetOriginSet()->erase(origin_url); | 116 GetOriginSet()->erase(origin_url); |
| 114 } | 117 } |
| 115 bool IsInOriginSet(const GURL& origin_url) { | |
| 116 std::set<GURL>* set = GetOriginSet(); | |
| 117 return set->find(origin_url) != set->end(); | |
| 118 } | |
| 119 | 118 |
| 120 // Only for testing. | 119 // Only for testing. |
| 121 void ResetCaches(); | 120 void ResetCaches(); |
| 122 | 121 |
| 123 scoped_ptr<WebKit::WebIDBFactory> idb_factory_; | 122 scoped_ptr<WebKit::WebIDBFactory> idb_factory_; |
| 124 base::FilePath data_path_; | 123 base::FilePath data_path_; |
| 125 // If true, nothing (not even session-only data) should be deleted on exit. | 124 // If true, nothing (not even session-only data) should be deleted on exit. |
| 126 bool force_keep_session_state_; | 125 bool force_keep_session_state_; |
| 127 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 126 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
| 128 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 127 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| 129 scoped_ptr<std::set<GURL> > origin_set_; | 128 scoped_ptr<std::set<GURL> > origin_set_; |
| 130 OriginToSizeMap origin_size_map_; | 129 OriginToSizeMap origin_size_map_; |
| 131 OriginToSizeMap space_available_map_; | 130 OriginToSizeMap space_available_map_; |
| 132 typedef std::set<WebKit::WebIDBDatabase*> ConnectionSet; | 131 typedef std::set<WebKit::WebIDBDatabase*> ConnectionSet; |
| 133 std::map<GURL, ConnectionSet> connections_; | 132 std::map<GURL, ConnectionSet> connections_; |
| 134 | 133 |
| 135 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); | 134 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); |
| 136 }; | 135 }; |
| 137 | 136 |
| 138 } // namespace content | 137 } // namespace content |
| 139 | 138 |
| 140 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ | 139 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ |
| OLD | NEW |