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

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

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

Powered by Google App Engine
This is Rietveld 408576698