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

Side by Side Diff: content/browser/indexed_db/cursor_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 | « no previous file | content/browser/indexed_db/cursor_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_CURSOR_IMPL_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_CURSOR_IMPL_H_
6 #define CONTENT_BROWSER_INDEXED_DB_CURSOR_IMPL_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_CURSOR_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "content/common/indexed_db/indexed_db.mojom.h" 11 #include "content/common/indexed_db/indexed_db.mojom.h"
12 12
13 namespace base { 13 namespace base {
14 class SingleThreadTaskRunner; 14 class SequencedTaskRunner;
15 } 15 }
16 16
17 namespace content { 17 namespace content {
18 18
19 class IndexedDBCursor; 19 class IndexedDBCursor;
20 class IndexedDBDispatcherHost; 20 class IndexedDBDispatcherHost;
21 class IndexedDBKey; 21 class IndexedDBKey;
22 22
23 // Expected to be constructed, called, and destructed on the IO thread.
23 class CursorImpl : public ::indexed_db::mojom::Cursor { 24 class CursorImpl : public ::indexed_db::mojom::Cursor {
24 public: 25 public:
25 CursorImpl(std::unique_ptr<IndexedDBCursor> cursor, 26 CursorImpl(std::unique_ptr<IndexedDBCursor> cursor,
26 const url::Origin& origin, 27 const url::Origin& origin,
27 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host); 28 IndexedDBDispatcherHost* dispatcher_host,
29 scoped_refptr<base::SequencedTaskRunner> idb_runner);
28 ~CursorImpl() override; 30 ~CursorImpl() override;
29 31
30 // ::indexed_db::mojom::Cursor implementation 32 // ::indexed_db::mojom::Cursor implementation
31 void Advance( 33 void Advance(
32 uint32_t count, 34 uint32_t count,
33 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override; 35 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override;
34 void Continue( 36 void Continue(
35 const IndexedDBKey& key, 37 const IndexedDBKey& key,
36 const IndexedDBKey& primary_key, 38 const IndexedDBKey& primary_key,
37 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override; 39 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override;
38 void Prefetch( 40 void Prefetch(
39 int32_t count, 41 int32_t count,
40 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override; 42 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks) override;
41 void PrefetchReset( 43 void PrefetchReset(
42 int32_t used_prefetches, 44 int32_t used_prefetches,
43 int32_t unused_prefetches, 45 int32_t unused_prefetches,
44 const std::vector<std::string>& unused_blob_uuids) override; 46 const std::vector<std::string>& unused_blob_uuids) override;
45 47
46 private: 48 private:
47 class IDBThreadHelper; 49 class IDBThreadHelper;
48 50
49 IDBThreadHelper* helper_; 51 IDBThreadHelper* helper_;
50 scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_; 52 // This raw pointer is safe because all CursorImpl instances are owned by an
53 // IndexedDBDispatcherHost.
54 IndexedDBDispatcherHost* dispatcher_host_;
51 const url::Origin origin_; 55 const url::Origin origin_;
52 scoped_refptr<base::SingleThreadTaskRunner> idb_runner_; 56 scoped_refptr<base::SequencedTaskRunner> idb_runner_;
53 57
54 DISALLOW_COPY_AND_ASSIGN(CursorImpl); 58 DISALLOW_COPY_AND_ASSIGN(CursorImpl);
55 }; 59 };
56 60
57 } // namespace content 61 } // namespace content
58 62
59 #endif // CONTENT_BROWSER_INDEXED_DB_CURSOR_IMPL_H_ 63 #endif // CONTENT_BROWSER_INDEXED_DB_CURSOR_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/indexed_db/cursor_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698