OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_QUOTA_QUOTA_DATABASE_H_ | 5 #ifndef WEBKIT_QUOTA_QUOTA_DATABASE_H_ |
6 #define WEBKIT_QUOTA_QUOTA_DATABASE_H_ | 6 #define WEBKIT_QUOTA_QUOTA_DATABASE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | |
12 #include "base/file_path.h" | 13 #include "base/file_path.h" |
13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "googleurl/src/gurl.h" | |
16 #include "webkit/quota/quota_types.h" | 18 #include "webkit/quota/quota_types.h" |
17 | 19 |
18 namespace sql { | 20 namespace sql { |
19 class Connection; | 21 class Connection; |
20 class MetaTable; | 22 class MetaTable; |
21 class Statement; | 23 class Statement; |
22 } | 24 } |
23 | 25 |
24 class GURL; | 26 class GURL; |
25 | 27 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 private: | 70 private: |
69 bool FindOriginUsedCount(const GURL& origin, | 71 bool FindOriginUsedCount(const GURL& origin, |
70 StorageType type, | 72 StorageType type, |
71 int* used_count); | 73 int* used_count); |
72 | 74 |
73 bool LazyOpen(bool create_if_needed); | 75 bool LazyOpen(bool create_if_needed); |
74 bool EnsureDatabaseVersion(); | 76 bool EnsureDatabaseVersion(); |
75 bool CreateSchema(); | 77 bool CreateSchema(); |
76 bool ResetSchema(); | 78 bool ResetSchema(); |
77 | 79 |
80 // For Tests and Debug use | |
81 struct QuotaTableEntry { | |
82 std::string host; | |
83 StorageType type; | |
84 int64 quota; | |
85 }; | |
86 typedef base::Callback<bool (const QuotaTableEntry&)> QuotaTableCallback; | |
87 bool DumpQuotaTable(QuotaTableCallback* callback); | |
88 friend bool operator <(const QuotaTableEntry& lhs, | |
89 const QuotaTableEntry& rhs); | |
90 bool AssignQuotaTable(const std::set<QuotaTableEntry>& entries); | |
kinuko
2011/05/20 13:19:54
I guess we won't need assign methods?
tzik
2011/05/23 05:24:15
Done. Moved to quota_database_unittest.
| |
91 | |
92 struct AccessTableEntry { | |
93 GURL origin; | |
94 StorageType type; | |
95 int used_count; | |
96 base::Time last_access_time; | |
97 }; | |
98 typedef base::Callback<bool (const AccessTableEntry&)> AccessTableCallback; | |
99 bool DumpAccessTable(AccessTableCallback* callback); | |
100 friend bool operator <(const AccessTableEntry& lhs, | |
101 const AccessTableEntry& rhs); | |
102 bool AssignAccessTable(const std::set<AccessTableEntry>& entries); | |
103 | |
78 FilePath db_file_path_; | 104 FilePath db_file_path_; |
79 | 105 |
80 scoped_ptr<sql::Connection> db_; | 106 scoped_ptr<sql::Connection> db_; |
81 scoped_ptr<sql::MetaTable> meta_table_; | 107 scoped_ptr<sql::MetaTable> meta_table_; |
82 bool is_recreating_; | 108 bool is_recreating_; |
83 bool is_disabled_; | 109 bool is_disabled_; |
84 | 110 |
85 friend class QuotaDatabaseTest; | 111 friend class QuotaDatabaseTest; |
86 | 112 |
87 DISALLOW_COPY_AND_ASSIGN(QuotaDatabase); | 113 DISALLOW_COPY_AND_ASSIGN(QuotaDatabase); |
88 }; | 114 }; |
89 | 115 |
90 } // namespace quota | 116 } // namespace quota |
91 | 117 |
92 #endif // WEBKIT_QUOTA_QUOTA_DATABASE_H_ | 118 #endif // WEBKIT_QUOTA_QUOTA_DATABASE_H_ |
OLD | NEW |