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

Side by Side Diff: webkit/quota/quota_database.h

Issue 7057006: Add Dump{Quota,LastAccessTime}Table (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: '' Created 9 years, 7 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 | webkit/quota/quota_database.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) 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 const std::set<GURL>& exceptions, 62 const std::set<GURL>& exceptions,
60 GURL* origin); 63 GURL* origin);
61 64
62 // Returns false if SetOriginDatabaseBootstrapped has never 65 // Returns false if SetOriginDatabaseBootstrapped has never
63 // been called before, which means existing origins may not have been 66 // been called before, which means existing origins may not have been
64 // registered. 67 // registered.
65 bool IsOriginDatabaseBootstrapped(); 68 bool IsOriginDatabaseBootstrapped();
66 bool SetOriginDatabaseBootstrapped(bool bootstrap_flag); 69 bool SetOriginDatabaseBootstrapped(bool bootstrap_flag);
67 70
68 private: 71 private:
72 struct QuotaTableEntry {
73 std::string host;
74 StorageType type;
75 int64 quota;
76 };
77 friend bool operator <(const QuotaTableEntry& lhs,
78 const QuotaTableEntry& rhs);
79
80 struct LastAccessTimeTableEntry {
81 GURL origin;
82 StorageType type;
83 int used_count;
84 base::Time last_access_time;
85 };
86 friend bool operator <(const LastAccessTimeTableEntry& lhs,
87 const LastAccessTimeTableEntry& rhs);
88
89 typedef base::Callback<bool (const QuotaTableEntry&)> QuotaTableCallback;
90 typedef base::Callback<bool (const LastAccessTimeTableEntry&)>
91 LastAccessTimeTableCallback;
92
69 // For long-running transactions support. We always keep a transaction open 93 // For long-running transactions support. We always keep a transaction open
70 // so that multiple transactions can be batched. They are flushed 94 // so that multiple transactions can be batched. They are flushed
71 // with a delay after a modification has been made. We support neither 95 // with a delay after a modification has been made. We support neither
72 // nested transactions nor rollback (as we don't need them for now). 96 // nested transactions nor rollback (as we don't need them for now).
73 void Commit(); 97 void Commit();
74 void ScheduleCommit(); 98 void ScheduleCommit();
75 99
76 bool FindOriginUsedCount(const GURL& origin, 100 bool FindOriginUsedCount(const GURL& origin,
77 StorageType type, 101 StorageType type,
78 int* used_count); 102 int* used_count);
79 103
80 bool LazyOpen(bool create_if_needed); 104 bool LazyOpen(bool create_if_needed);
81 bool EnsureDatabaseVersion(); 105 bool EnsureDatabaseVersion();
82 bool CreateSchema(); 106 bool CreateSchema();
83 bool ResetSchema(); 107 bool ResetSchema();
84 108
109 // |callback| may return false to stop reading data
110 bool DumpQuotaTable(QuotaTableCallback* callback);
111 bool DumpLastAccessTimeTable(LastAccessTimeTableCallback* callback);
112
113
85 FilePath db_file_path_; 114 FilePath db_file_path_;
86 115
87 scoped_ptr<sql::Connection> db_; 116 scoped_ptr<sql::Connection> db_;
88 scoped_ptr<sql::MetaTable> meta_table_; 117 scoped_ptr<sql::MetaTable> meta_table_;
89 bool is_recreating_; 118 bool is_recreating_;
90 bool is_disabled_; 119 bool is_disabled_;
91 120
92 base::OneShotTimer<QuotaDatabase> timer_; 121 base::OneShotTimer<QuotaDatabase> timer_;
93 122
94 friend class QuotaDatabaseTest; 123 friend class QuotaDatabaseTest;
95 124
96 DISALLOW_COPY_AND_ASSIGN(QuotaDatabase); 125 DISALLOW_COPY_AND_ASSIGN(QuotaDatabase);
97 }; 126 };
98 127
99 } // namespace quota 128 } // namespace quota
100 129
101 #endif // WEBKIT_QUOTA_QUOTA_DATABASE_H_ 130 #endif // WEBKIT_QUOTA_QUOTA_DATABASE_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/quota/quota_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698