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

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

Issue 11274003: webkit: Merge 'database' and 'quota' to 'webkit_storage' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More EXPORT for Win Created 8 years, 1 month 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 | « content/content_tests.gypi ('k') | webkit/database/database_quota_client.h » ('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
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "webkit/storage/webkit_storage_export.h"
14 15
15 namespace base { 16 namespace base {
16 class MessageLoopProxy; 17 class MessageLoopProxy;
17 } 18 }
18 19
19 namespace webkit_database { 20 namespace webkit_database {
20 21
21 class DatabaseConnections { 22 class WEBKIT_STORAGE_EXPORT DatabaseConnections {
22 public: 23 public:
23 DatabaseConnections(); 24 DatabaseConnections();
24 ~DatabaseConnections(); 25 ~DatabaseConnections();
25 26
26 bool IsEmpty() const; 27 bool IsEmpty() const;
27 bool IsDatabaseOpened(const string16& origin_identifier, 28 bool IsDatabaseOpened(const string16& origin_identifier,
28 const string16& database_name) const; 29 const string16& database_name) const;
29 bool IsOriginUsed(const string16& origin_identifier) const; 30 bool IsOriginUsed(const string16& origin_identifier) const;
30 31
31 // Returns true if this is the first connection. 32 // Returns true if this is the first connection.
(...skipping 28 matching lines...) Expand all
60 61
61 // Returns true if the last connection was removed. 62 // Returns true if the last connection was removed.
62 bool RemoveConnectionsHelper(const string16& origin_identifier, 63 bool RemoveConnectionsHelper(const string16& origin_identifier,
63 const string16& database_name, 64 const string16& database_name,
64 int num_connections); 65 int num_connections);
65 }; 66 };
66 67
67 // A wrapper class that provides thread-safety and the 68 // A wrapper class that provides thread-safety and the
68 // ability to wait until all connections have closed. 69 // ability to wait until all connections have closed.
69 // Intended for use in renderer processes. 70 // Intended for use in renderer processes.
70 class DatabaseConnectionsWrapper 71 class WEBKIT_STORAGE_EXPORT DatabaseConnectionsWrapper
71 : public base::RefCountedThreadSafe<DatabaseConnectionsWrapper> { 72 : public base::RefCountedThreadSafe<DatabaseConnectionsWrapper> {
72 public: 73 public:
73 DatabaseConnectionsWrapper(); 74 DatabaseConnectionsWrapper();
74 75
75 // The Wait and Has methods should only be called on the 76 // The Wait and Has methods should only be called on the
76 // main thread (the thread on which the wrapper is constructed). 77 // main thread (the thread on which the wrapper is constructed).
77 void WaitForAllDatabasesToClose(); 78 void WaitForAllDatabasesToClose();
78 bool HasOpenConnections(); 79 bool HasOpenConnections();
79 80
80 // Add and Remove may be called on any thread. 81 // Add and Remove may be called on any thread.
81 void AddOpenConnection(const string16& origin_identifier, 82 void AddOpenConnection(const string16& origin_identifier,
82 const string16& database_name); 83 const string16& database_name);
83 void RemoveOpenConnection(const string16& origin_identifier, 84 void RemoveOpenConnection(const string16& origin_identifier,
84 const string16& database_name); 85 const string16& database_name);
85 private: 86 private:
86 ~DatabaseConnectionsWrapper(); 87 ~DatabaseConnectionsWrapper();
87 friend class base::RefCountedThreadSafe<DatabaseConnectionsWrapper>; 88 friend class base::RefCountedThreadSafe<DatabaseConnectionsWrapper>;
88 89
89 bool waiting_for_dbs_to_close_; 90 bool waiting_for_dbs_to_close_;
90 base::Lock open_connections_lock_; 91 base::Lock open_connections_lock_;
91 DatabaseConnections open_connections_; 92 DatabaseConnections open_connections_;
92 scoped_refptr<base::MessageLoopProxy> main_thread_; 93 scoped_refptr<base::MessageLoopProxy> main_thread_;
93 }; 94 };
94 95
95 } // namespace webkit_database 96 } // namespace webkit_database
96 97
97 #endif // WEBKIT_DATABASE_DATABASE_CONNECTIONS_H_ 98 #endif // WEBKIT_DATABASE_DATABASE_CONNECTIONS_H_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | webkit/database/database_quota_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698