Index: content/child/indexed_db/indexed_db_callbacks_impl.h |
diff --git a/content/child/indexed_db/indexed_db_callbacks_impl.h b/content/child/indexed_db/indexed_db_callbacks_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..24fd781c59e1c863c449ffef29160ded1091485a |
--- /dev/null |
+++ b/content/child/indexed_db/indexed_db_callbacks_impl.h |
@@ -0,0 +1,58 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_CHILD_INDEXED_DB_INDEXED_DB_CALLBACKS_IMPL_H_ |
+#define CONTENT_CHILD_INDEXED_DB_INDEXED_DB_CALLBACKS_IMPL_H_ |
+ |
+#include "content/common/indexed_db/indexed_db.mojom.h" |
+#include "mojo/public/cpp/bindings/associated_binding.h" |
+ |
+namespace blink { |
+class WebIDBCallbacks; |
+} |
+ |
+namespace content { |
+ |
+class ThreadSafeSender; |
+ |
+// Implements the child-process end of the pipe used to deliver callbacks. It |
+// is owned by the IO thread. |callback_runner_| is used to post tasks back to |
+// the thread which owns the blink::WebIDBCallbacks. |
+class IndexedDBCallbacksImpl : public indexed_db::mojom::Callbacks { |
+ public: |
+ IndexedDBCallbacksImpl(blink::WebIDBCallbacks* callbacks, |
+ scoped_refptr<ThreadSafeSender> thread_safe_sender); |
+ ~IndexedDBCallbacksImpl() override; |
+ |
+ void Bind(indexed_db::mojom::CallbacksAssociatedPtrInfo* ptr_info, |
+ mojo::AssociatedGroup* associated_group); |
+ void OnConnectionError(); |
+ |
+ // indexed_db::mojom::Callbacks implementation |
+ void Blocked(int64_t existing_version) override; |
+ void Error(int32_t code, const base::string16& message) override; |
+ void SuccessDatabase( |
+ int32_t database_id, |
+ indexed_db::mojom::DatabaseMetadataPtr metadata) override; |
+ void SuccessInteger(int64_t value) override; |
+ void SuccessStringList(const std::vector<base::string16>& value) override; |
+ void UpgradeNeeded(int32_t database_id, |
+ int64_t old_version, |
+ indexed_db::mojom::DataLoss data_loss, |
+ const std::string& data_loss_message, |
+ indexed_db::mojom::DatabaseMetadataPtr metadata) override; |
+ |
+ private: |
+ class InternalState; |
+ |
+ // |internal_state_| is owned by the thread on which |callback_runner_| |
+ // executes tasks and must be destroyed there. |
+ InternalState* internal_state_; |
+ scoped_refptr<base::SingleThreadTaskRunner> callback_runner_; |
+ mojo::AssociatedBinding<indexed_db::mojom::Callbacks> binding_; |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_CHILD_INDEXED_DB_INDEXED_DB_CALLBACKS_IMPL_H_ |