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

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

Issue 2727733004: [IndexedDB] Closing mojo connections when renderer quits (Closed)
Patch Set: comments Created 3 years, 8 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
« no previous file with comments | « content/browser/indexed_db/cursor_impl.cc ('k') | content/browser/indexed_db/database_impl.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_DATABASE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_DATABASE_IMPL_H_
6 #define CONTENT_BROWSER_INDEXED_DB_DATABASE_IMPL_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_DATABASE_IMPL_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/common/indexed_db/indexed_db.mojom.h" 10 #include "content/common/indexed_db/indexed_db.mojom.h"
11 11
12 namespace base {
13 class SequencedTaskRunner;
14 }
15
12 namespace content { 16 namespace content {
13 17
14 class IndexedDBConnection; 18 class IndexedDBConnection;
15 class IndexedDBDispatcherHost; 19 class IndexedDBDispatcherHost;
16 20
21 // Expected to be constructed, called, and destructed on the IO thread.
17 class DatabaseImpl : public ::indexed_db::mojom::Database { 22 class DatabaseImpl : public ::indexed_db::mojom::Database {
18 public: 23 public:
19 explicit DatabaseImpl(std::unique_ptr<IndexedDBConnection> connection, 24 explicit DatabaseImpl(std::unique_ptr<IndexedDBConnection> connection,
20 const url::Origin& origin, 25 const url::Origin& origin,
21 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host); 26 IndexedDBDispatcherHost* dispatcher_host,
27 scoped_refptr<base::SequencedTaskRunner> idb_runner);
22 ~DatabaseImpl() override; 28 ~DatabaseImpl() override;
23 29
24 // ::indexed_db::mojom::Database implementation 30 // ::indexed_db::mojom::Database implementation
25 void CreateObjectStore(int64_t transaction_id, 31 void CreateObjectStore(int64_t transaction_id,
26 int64_t object_store_id, 32 int64_t object_store_id,
27 const base::string16& name, 33 const base::string16& name,
28 const IndexedDBKeyPath& key_path, 34 const IndexedDBKeyPath& key_path,
29 bool auto_increment) override; 35 bool auto_increment) override;
30 void DeleteObjectStore(int64_t transaction_id, 36 void DeleteObjectStore(int64_t transaction_id,
31 int64_t object_store_id) override; 37 int64_t object_store_id) override;
(...skipping 21 matching lines...) Expand all
53 void GetAll( 59 void GetAll(
54 int64_t transaction_id, 60 int64_t transaction_id,
55 int64_t object_store_id, 61 int64_t object_store_id,
56 int64_t index_id, 62 int64_t index_id,
57 const IndexedDBKeyRange& key_range, 63 const IndexedDBKeyRange& key_range,
58 bool key_only, 64 bool key_only,
59 int64_t max_count, 65 int64_t max_count,
60 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override; 66 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override;
61 void Put(int64_t transaction_id, 67 void Put(int64_t transaction_id,
62 int64_t object_store_id, 68 int64_t object_store_id,
63 indexed_db::mojom::ValuePtr value, 69 ::indexed_db::mojom::ValuePtr value,
64 const IndexedDBKey& key, 70 const IndexedDBKey& key,
65 blink::WebIDBPutMode mode, 71 blink::WebIDBPutMode mode,
66 const std::vector<IndexedDBIndexKeys>& index_keys, 72 const std::vector<IndexedDBIndexKeys>& index_keys,
67 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override; 73 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override;
68 void SetIndexKeys(int64_t transaction_id, 74 void SetIndexKeys(int64_t transaction_id,
69 int64_t object_store_id, 75 int64_t object_store_id,
70 const IndexedDBKey& primary_key, 76 const IndexedDBKey& primary_key,
71 const std::vector<IndexedDBIndexKeys>& index_keys) override; 77 const std::vector<IndexedDBIndexKeys>& index_keys) override;
72 void SetIndexesReady(int64_t transaction_id, 78 void SetIndexesReady(int64_t transaction_id,
73 int64_t object_store_id, 79 int64_t object_store_id,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 int64_t index_id, 117 int64_t index_id,
112 const base::string16& new_name) override; 118 const base::string16& new_name) override;
113 void Abort(int64_t transaction_id) override; 119 void Abort(int64_t transaction_id) override;
114 void Commit(int64_t transaction_id) override; 120 void Commit(int64_t transaction_id) override;
115 void AckReceivedBlobs(const std::vector<std::string>& uuids) override; 121 void AckReceivedBlobs(const std::vector<std::string>& uuids) override;
116 122
117 private: 123 private:
118 class IDBThreadHelper; 124 class IDBThreadHelper;
119 125
120 IDBThreadHelper* helper_; 126 IDBThreadHelper* helper_;
121 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; 127 // This raw pointer is safe because all DatabaseImpl instances are owned by
128 // an IndexedDBDispatcherHost.
129 IndexedDBDispatcherHost* dispatcher_host_;
122 const url::Origin origin_; 130 const url::Origin origin_;
123 scoped_refptr<base::SingleThreadTaskRunner> idb_runner_; 131 scoped_refptr<base::SequencedTaskRunner> idb_runner_;
124 132
125 DISALLOW_COPY_AND_ASSIGN(DatabaseImpl); 133 DISALLOW_COPY_AND_ASSIGN(DatabaseImpl);
126 }; 134 };
127 135
128 } // namespace content 136 } // namespace content
129 137
130 #endif // CONTENT_BROWSER_INDEXED_DB_DATABASE_IMPL_H_ 138 #endif // CONTENT_BROWSER_INDEXED_DB_DATABASE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/indexed_db/cursor_impl.cc ('k') | content/browser/indexed_db/database_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698