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

Side by Side Diff: webkit/database/database_connections.h

Issue 7001014: More Quota WebSQLDatabase integration. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
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/database/database_connections.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_DATABASE_DATABASE_CONNECTIONS_H_ 5 #ifndef WEBKIT_DATABASE_DATABASE_CONNECTIONS_H_
6 #define WEBKIT_DATABASE_DATABASE_CONNECTIONS_H_ 6 #define WEBKIT_DATABASE_DATABASE_CONNECTIONS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 bool IsOriginUsed(const string16& origin_identifier) const; 29 bool IsOriginUsed(const string16& origin_identifier) const;
30 void AddConnection(const string16& origin_identifier, 30 void AddConnection(const string16& origin_identifier,
31 const string16& database_name); 31 const string16& database_name);
32 void RemoveConnection(const string16& origin_identifier, 32 void RemoveConnection(const string16& origin_identifier,
33 const string16& database_name); 33 const string16& database_name);
34 void RemoveAllConnections(); 34 void RemoveAllConnections();
35 void RemoveConnections( 35 void RemoveConnections(
36 const DatabaseConnections& connections, 36 const DatabaseConnections& connections,
37 std::vector<std::pair<string16, string16> >* closed_dbs); 37 std::vector<std::pair<string16, string16> >* closed_dbs);
38 38
39 // Database sizes can be kept only if IsDatabaseOpened returns true.
40 int64 GetOpenDatabaseSize(const string16& origin_identifier,
41 const string16& database_name) const;
42 void SetOpenDatabaseSize(const string16& origin_identifier,
43 const string16& database_name,
44 int64 size);
45
46 // Returns a list of the connections, <origin_id, name>.
47 void ListConnections(
48 std::vector<std::pair<string16, string16> > *list) const;
49
39 private: 50 private:
40 typedef std::map<string16, int> DBConnections; 51 // Mapping from name to <openCount, size>
52 typedef std::map<string16, std::pair<int, int64> > DBConnections;
41 typedef std::map<string16, DBConnections> OriginConnections; 53 typedef std::map<string16, DBConnections> OriginConnections;
42 OriginConnections connections_; 54 mutable OriginConnections connections_; // mutable for GetOpenDatabaseSize
43 55
44 void RemoveConnectionsHelper(const string16& origin_identifier, 56 void RemoveConnectionsHelper(const string16& origin_identifier,
45 const string16& database_name, 57 const string16& database_name,
46 int num_connections); 58 int num_connections);
47 }; 59 };
48 60
49 // A wrapper class that provides thread-safety and the 61 // A wrapper class that provides thread-safety and the
50 // ability to wait until all connections have closed. 62 // ability to wait until all connections have closed.
51 // Intended for use in renderer processes. 63 // Intended for use in renderer processes.
52 class DatabaseConnectionsWrapper 64 class DatabaseConnectionsWrapper
(...skipping 17 matching lines...) Expand all
70 82
71 bool waiting_for_dbs_to_close_; 83 bool waiting_for_dbs_to_close_;
72 base::Lock open_connections_lock_; 84 base::Lock open_connections_lock_;
73 DatabaseConnections open_connections_; 85 DatabaseConnections open_connections_;
74 scoped_refptr<base::MessageLoopProxy> main_thread_; 86 scoped_refptr<base::MessageLoopProxy> main_thread_;
75 }; 87 };
76 88
77 } // namespace webkit_database 89 } // namespace webkit_database
78 90
79 #endif // WEBKIT_DATABASE_DATABASE_CONNECTIONS_H_ 91 #endif // WEBKIT_DATABASE_DATABASE_CONNECTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/database/database_connections.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698