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

Side by Side Diff: content/browser/indexed_db/indexed_db_factory.h

Issue 19117005: IndexedDB: Coding conventions and cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "content/browser/indexed_db/indexed_db_callbacks.h" 16 #include "content/browser/indexed_db/indexed_db_callbacks.h"
17 #include "content/browser/indexed_db/indexed_db_database_callbacks.h" 17 #include "content/browser/indexed_db/indexed_db_database_callbacks.h"
18 #include "content/browser/indexed_db/indexed_db_factory.h" 18 #include "content/browser/indexed_db/indexed_db_factory.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 20
21 namespace content { 21 namespace content {
22 22
23 class IndexedDBBackingStore; 23 class IndexedDBBackingStore;
24 class IndexedDBDatabase; 24 class IndexedDBDatabase;
25 25
26 class CONTENT_EXPORT IndexedDBFactory 26 class CONTENT_EXPORT IndexedDBFactory
27 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBFactory>) { 27 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBFactory>) {
28 public: 28 public:
29 static scoped_refptr<IndexedDBFactory> Create() { 29 IndexedDBFactory();
30 return make_scoped_refptr(new IndexedDBFactory());
31 }
32 30
33 // Notifications from weak pointers. 31 // Notifications from weak pointers.
34 void RemoveIDBDatabaseBackend(const string16& unique_identifier); 32 void RemoveIDBDatabaseBackend(const string16& unique_identifier);
35 33
36 void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks, 34 void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks,
37 const std::string& origin_identifier, 35 const std::string& origin_identifier,
38 const base::FilePath& data_directory); 36 const base::FilePath& data_directory);
39 void Open(const string16& name, 37 void Open(const string16& name,
40 int64 version, 38 int64 version,
41 int64 transaction_id, 39 int64 transaction_id,
42 scoped_refptr<IndexedDBCallbacks> callbacks, 40 scoped_refptr<IndexedDBCallbacks> callbacks,
43 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, 41 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks,
44 const std::string& origin_identifier, 42 const std::string& origin_identifier,
45 const base::FilePath& data_directory); 43 const base::FilePath& data_directory);
46 44
47 void DeleteDatabase(const string16& name, 45 void DeleteDatabase(const string16& name,
48 scoped_refptr<IndexedDBCallbacks> callbacks, 46 scoped_refptr<IndexedDBCallbacks> callbacks,
49 const std::string& origin_identifier, 47 const std::string& origin_identifier,
50 const base::FilePath& data_directory); 48 const base::FilePath& data_directory);
51 49
52 protected: 50 protected:
53 friend class base::RefCounted<IndexedDBFactory>; 51 friend class base::RefCounted<IndexedDBFactory>;
54 52
55 IndexedDBFactory();
56 virtual ~IndexedDBFactory(); 53 virtual ~IndexedDBFactory();
57 54
58 scoped_refptr<IndexedDBBackingStore> OpenBackingStore( 55 scoped_refptr<IndexedDBBackingStore> OpenBackingStore(
59 const std::string& origin_identifier, 56 const std::string& origin_identifier,
60 const base::FilePath& data_directory, 57 const base::FilePath& data_directory,
61 WebKit::WebIDBCallbacks::DataLoss* data_loss); 58 WebKit::WebIDBCallbacks::DataLoss* data_loss);
62 59
63 private: 60 private:
64 typedef std::map<string16, scoped_refptr<IndexedDBDatabase> > 61 typedef std::map<string16, scoped_refptr<IndexedDBDatabase> >
65 IndexedDBDatabaseMap; 62 IndexedDBDatabaseMap;
66 IndexedDBDatabaseMap database_backend_map_; 63 IndexedDBDatabaseMap database_backend_map_;
67 64
68 typedef std::map<std::string, base::WeakPtr<IndexedDBBackingStore> > 65 typedef std::map<std::string, base::WeakPtr<IndexedDBBackingStore> >
69 IndexedDBBackingStoreMap; 66 IndexedDBBackingStoreMap;
70 IndexedDBBackingStoreMap backing_store_map_; 67 IndexedDBBackingStoreMap backing_store_map_;
71 68
72 std::set<scoped_refptr<IndexedDBBackingStore> > session_only_backing_stores_; 69 std::set<scoped_refptr<IndexedDBBackingStore> > session_only_backing_stores_;
73 }; 70 };
74 71
75 } // namespace content 72 } // namespace content
76 73
77 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ 74 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698