Chromium Code Reviews| 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" |
| 16 #include "base/time.h" | |
| 15 #include "base/timer.h" | 17 #include "base/timer.h" |
| 18 #include "googleurl/src/gurl.h" | |
| 16 #include "webkit/quota/quota_types.h" | 19 #include "webkit/quota/quota_types.h" |
| 17 | 20 |
| 18 namespace sql { | 21 namespace sql { |
| 19 class Connection; | 22 class Connection; |
| 20 class MetaTable; | 23 class MetaTable; |
| 21 class Statement; | 24 class Statement; |
| 22 } | 25 } |
| 23 | 26 |
| 24 class GURL; | 27 class GURL; |
| 25 | 28 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 | 78 |
| 76 bool FindOriginUsedCount(const GURL& origin, | 79 bool FindOriginUsedCount(const GURL& origin, |
| 77 StorageType type, | 80 StorageType type, |
| 78 int* used_count); | 81 int* used_count); |
| 79 | 82 |
| 80 bool LazyOpen(bool create_if_needed); | 83 bool LazyOpen(bool create_if_needed); |
| 81 bool EnsureDatabaseVersion(); | 84 bool EnsureDatabaseVersion(); |
| 82 bool CreateSchema(); | 85 bool CreateSchema(); |
| 83 bool ResetSchema(); | 86 bool ResetSchema(); |
| 84 | 87 |
| 88 // For Tests and Debug use | |
| 89 struct QuotaTableEntry { | |
| 90 std::string host; | |
| 91 StorageType type; | |
| 92 int64 quota; | |
| 93 }; | |
|
kinuko
2011/05/23 08:16:52
Please move all the typedefs before the methods (i
tzik
2011/05/24 04:32:41
Done.
| |
| 94 typedef base::Callback<bool (const QuotaTableEntry&)> QuotaTableCallback; | |
| 95 bool DumpQuotaTable(QuotaTableCallback* callback); | |
| 96 friend bool operator <(const QuotaTableEntry& lhs, | |
|
kinuko
2011/05/23 08:16:52
Please place this next to (right after) the struct
tzik
2011/05/24 04:32:41
Done.
| |
| 97 const QuotaTableEntry& rhs); | |
| 98 | |
| 99 struct LastAccessTimeTableEntry { | |
| 100 GURL origin; | |
| 101 StorageType type; | |
| 102 int used_count; | |
| 103 base::Time last_access_time; | |
| 104 }; | |
| 105 typedef base::Callback<bool (const LastAccessTimeTableEntry&)> | |
| 106 LastAccessTimeTableCallback; | |
| 107 bool DumpLastAccessTimeTable(LastAccessTimeTableCallback* callback); | |
| 108 friend bool operator <(const LastAccessTimeTableEntry& lhs, | |
| 109 const LastAccessTimeTableEntry& rhs); | |
| 110 | |
| 85 FilePath db_file_path_; | 111 FilePath db_file_path_; |
| 86 | 112 |
| 87 scoped_ptr<sql::Connection> db_; | 113 scoped_ptr<sql::Connection> db_; |
| 88 scoped_ptr<sql::MetaTable> meta_table_; | 114 scoped_ptr<sql::MetaTable> meta_table_; |
| 89 bool is_recreating_; | 115 bool is_recreating_; |
| 90 bool is_disabled_; | 116 bool is_disabled_; |
| 91 | 117 |
| 92 base::OneShotTimer<QuotaDatabase> timer_; | 118 base::OneShotTimer<QuotaDatabase> timer_; |
| 93 | 119 |
| 94 friend class QuotaDatabaseTest; | 120 friend class QuotaDatabaseTest; |
| 95 | 121 |
| 96 DISALLOW_COPY_AND_ASSIGN(QuotaDatabase); | 122 DISALLOW_COPY_AND_ASSIGN(QuotaDatabase); |
| 97 }; | 123 }; |
| 98 | 124 |
| 99 } // namespace quota | 125 } // namespace quota |
| 100 | 126 |
| 101 #endif // WEBKIT_QUOTA_QUOTA_DATABASE_H_ | 127 #endif // WEBKIT_QUOTA_QUOTA_DATABASE_H_ |
| OLD | NEW |