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

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

Issue 77863005: Make refcounting of IndexedDBFactory threadsafe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove suppression Created 7 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 | « no previous file | tools/valgrind/tsan_v2/suppressions.txt » ('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) 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/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "content/browser/indexed_db/indexed_db_callbacks.h" 15 #include "content/browser/indexed_db/indexed_db_callbacks.h"
16 #include "content/browser/indexed_db/indexed_db_database.h" 16 #include "content/browser/indexed_db/indexed_db_database.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/common/content_export.h" 18 #include "content/common/content_export.h"
19 #include "url/gurl.h" 19 #include "url/gurl.h"
20 20
21 namespace content { 21 namespace content {
22 22
23 class IndexedDBBackingStore; 23 class IndexedDBBackingStore;
24 class IndexedDBContextImpl; 24 class IndexedDBContextImpl;
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::RefCountedThreadSafe<IndexedDBFactory>) {
28 public: 28 public:
29 explicit IndexedDBFactory(IndexedDBContextImpl* context); 29 explicit IndexedDBFactory(IndexedDBContextImpl* context);
30 30
31 // Notifications from weak pointers. 31 // Notifications from weak pointers.
32 void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier, 32 void ReleaseDatabase(const IndexedDBDatabase::Identifier& identifier,
33 const GURL& origin_url, 33 const GURL& origin_url,
34 bool forcedClose); 34 bool forcedClose);
35 35
36 void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks, 36 void GetDatabaseNames(scoped_refptr<IndexedDBCallbacks> callbacks,
37 const GURL& origin_url, 37 const GURL& origin_url,
(...skipping 16 matching lines...) Expand all
54 // Iterates over all databases; for diagnostics only. 54 // Iterates over all databases; for diagnostics only.
55 std::vector<IndexedDBDatabase*> GetOpenDatabasesForOrigin( 55 std::vector<IndexedDBDatabase*> GetOpenDatabasesForOrigin(
56 const GURL& origin_url) const; 56 const GURL& origin_url) const;
57 57
58 bool IsBackingStoreOpenForTesting(const GURL& origin_url) const; 58 bool IsBackingStoreOpenForTesting(const GURL& origin_url) const;
59 59
60 // Called by the IndexedDBContext destructor so the factory can do cleanup. 60 // Called by the IndexedDBContext destructor so the factory can do cleanup.
61 void ContextDestroyed(); 61 void ContextDestroyed();
62 62
63 protected: 63 protected:
64 friend class base::RefCounted<IndexedDBFactory>; 64 friend class base::RefCountedThreadSafe<IndexedDBFactory>;
65 65
66 virtual ~IndexedDBFactory(); 66 virtual ~IndexedDBFactory();
67 67
68 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore( 68 virtual scoped_refptr<IndexedDBBackingStore> OpenBackingStore(
69 const GURL& origin_url, 69 const GURL& origin_url,
70 const base::FilePath& data_directory, 70 const base::FilePath& data_directory,
71 blink::WebIDBDataLoss* data_loss, 71 blink::WebIDBDataLoss* data_loss,
72 std::string* data_loss_reason, 72 std::string* data_loss_reason,
73 bool* disk_full); 73 bool* disk_full);
74 74
(...skipping 15 matching lines...) Expand all
90 typedef std::map<GURL, scoped_refptr<IndexedDBBackingStore> > 90 typedef std::map<GURL, scoped_refptr<IndexedDBBackingStore> >
91 IndexedDBBackingStoreMap; 91 IndexedDBBackingStoreMap;
92 IndexedDBBackingStoreMap backing_store_map_; 92 IndexedDBBackingStoreMap backing_store_map_;
93 93
94 std::set<scoped_refptr<IndexedDBBackingStore> > session_only_backing_stores_; 94 std::set<scoped_refptr<IndexedDBBackingStore> > session_only_backing_stores_;
95 }; 95 };
96 96
97 } // namespace content 97 } // namespace content
98 98
99 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_ 99 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_FACTORY_H_
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/tsan_v2/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698