OLD | NEW |
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_CHILD_INDEXED_DB_INDEXED_DB_CALLBACKS_IMPL_H_ | 5 #ifndef CONTENT_CHILD_INDEXED_DB_INDEXED_DB_CALLBACKS_IMPL_H_ |
6 #define CONTENT_CHILD_INDEXED_DB_INDEXED_DB_CALLBACKS_IMPL_H_ | 6 #define CONTENT_CHILD_INDEXED_DB_INDEXED_DB_CALLBACKS_IMPL_H_ |
7 | 7 |
8 #include "content/common/indexed_db/indexed_db.mojom.h" | 8 #include "content/common/indexed_db/indexed_db.mojom.h" |
9 #include "mojo/public/cpp/bindings/associated_binding.h" | 9 #include "mojo/public/cpp/bindings/associated_binding.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 class WebIDBCallbacks; | 12 class WebIDBCallbacks; |
| 13 struct WebIDBValue; |
13 } | 14 } |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 class WebIDBCursorImpl; | 18 class WebIDBCursorImpl; |
18 | 19 |
19 // Implements the child-process end of the pipe used to deliver callbacks. It | 20 // Implements the child-process end of the pipe used to deliver callbacks. It |
20 // is owned by the IO thread. |callback_runner_| is used to post tasks back to | 21 // is owned by the IO thread. |callback_runner_| is used to post tasks back to |
21 // the thread which owns the blink::WebIDBCallbacks. | 22 // the thread which owns the blink::WebIDBCallbacks. |
22 class IndexedDBCallbacksImpl : public indexed_db::mojom::Callbacks { | 23 class IndexedDBCallbacksImpl : public indexed_db::mojom::Callbacks { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 62 |
62 private: | 63 private: |
63 std::unique_ptr<blink::WebIDBCallbacks> callbacks_; | 64 std::unique_ptr<blink::WebIDBCallbacks> callbacks_; |
64 int64_t transaction_id_; | 65 int64_t transaction_id_; |
65 base::WeakPtr<WebIDBCursorImpl> cursor_; | 66 base::WeakPtr<WebIDBCursorImpl> cursor_; |
66 scoped_refptr<base::SingleThreadTaskRunner> io_runner_; | 67 scoped_refptr<base::SingleThreadTaskRunner> io_runner_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(InternalState); | 69 DISALLOW_COPY_AND_ASSIGN(InternalState); |
69 }; | 70 }; |
70 | 71 |
| 72 static void ConvertValue(const indexed_db::mojom::ValuePtr& value, |
| 73 blink::WebIDBValue* web_value); |
| 74 |
71 IndexedDBCallbacksImpl(std::unique_ptr<blink::WebIDBCallbacks> callbacks, | 75 IndexedDBCallbacksImpl(std::unique_ptr<blink::WebIDBCallbacks> callbacks, |
72 int64_t transaction_id, | 76 int64_t transaction_id, |
73 const base::WeakPtr<WebIDBCursorImpl>& cursor, | 77 const base::WeakPtr<WebIDBCursorImpl>& cursor, |
74 scoped_refptr<base::SingleThreadTaskRunner> io_runner); | 78 scoped_refptr<base::SingleThreadTaskRunner> io_runner); |
75 ~IndexedDBCallbacksImpl() override; | 79 ~IndexedDBCallbacksImpl() override; |
76 | 80 |
77 // indexed_db::mojom::Callbacks implementation: | 81 // indexed_db::mojom::Callbacks implementation: |
78 void Error(int32_t code, const base::string16& message) override; | 82 void Error(int32_t code, const base::string16& message) override; |
79 void SuccessStringList(const std::vector<base::string16>& value) override; | 83 void SuccessStringList(const std::vector<base::string16>& value) override; |
80 void Blocked(int64_t existing_version) override; | 84 void Blocked(int64_t existing_version) override; |
(...skipping 29 matching lines...) Expand all Loading... |
110 // executes tasks and must be destroyed there. | 114 // executes tasks and must be destroyed there. |
111 InternalState* internal_state_; | 115 InternalState* internal_state_; |
112 scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; | 116 scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; |
113 | 117 |
114 DISALLOW_COPY_AND_ASSIGN(IndexedDBCallbacksImpl); | 118 DISALLOW_COPY_AND_ASSIGN(IndexedDBCallbacksImpl); |
115 }; | 119 }; |
116 | 120 |
117 } // namespace content | 121 } // namespace content |
118 | 122 |
119 #endif // CONTENT_CHILD_INDEXED_DB_INDEXED_DB_CALLBACKS_IMPL_H_ | 123 #endif // CONTENT_CHILD_INDEXED_DB_INDEXED_DB_CALLBACKS_IMPL_H_ |
OLD | NEW |