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_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 Loading... | |
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) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 | 117 |
117 scoped_ptr<WebKit::WebIDBFactory> idb_factory_; | 118 scoped_ptr<WebKit::WebIDBFactory> idb_factory_; |
118 FilePath data_path_; | 119 FilePath data_path_; |
119 // 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. |
120 bool force_keep_session_state_; | 121 bool force_keep_session_state_; |
121 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; | 122 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
122 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 123 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
123 scoped_ptr<std::set<GURL> > origin_set_; | 124 scoped_ptr<std::set<GURL> > origin_set_; |
124 OriginToSizeMap origin_size_map_; | 125 OriginToSizeMap origin_size_map_; |
125 OriginToSizeMap space_available_map_; | 126 OriginToSizeMap space_available_map_; |
126 std::map<GURL, unsigned int> connection_count_; | 127 typedef std::set<WebKit::WebIDBDatabase*> ConnectionSet; |
128 std::map<GURL, ConnectionSet > connections_; | |
dgrogan
2012/07/17 20:20:20
extra space
| |
127 | 129 |
128 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); | 130 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); |
129 }; | 131 }; |
130 | 132 |
131 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_IMPL_H_ | 133 #endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_IMPL_H_ |
OLD | NEW |