Index: content/child/indexed_db/indexed_db_database_callbacks_impl.cc |
diff --git a/content/child/indexed_db/indexed_db_database_callbacks_impl.cc b/content/child/indexed_db/indexed_db_database_callbacks_impl.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..da5a876ef94624ae05eca4dbdd7523b255520143 |
--- /dev/null |
+++ b/content/child/indexed_db/indexed_db_database_callbacks_impl.cc |
@@ -0,0 +1,52 @@ |
+// 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. |
+ |
+#include "content/child/indexed_db/indexed_db_database_callbacks_impl.h" |
+ |
+#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseCallbacks.h" |
+#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseError.h" |
+ |
+using blink::WebIDBDatabaseCallbacks; |
+ |
+namespace content { |
+ |
+IndexedDBDatabaseCallbacksImpl::IndexedDBDatabaseCallbacksImpl( |
+ WebIDBDatabaseCallbacks* callbacks) |
+ : callback_runner_(base::ThreadTaskRunnerHandle::Get()), |
+ callbacks_(callbacks) {} |
+ |
+IndexedDBDatabaseCallbacksImpl::~IndexedDBDatabaseCallbacksImpl() { |
+ callback_runner_->DeleteSoon(FROM_HERE, callbacks_); |
+} |
+ |
+void IndexedDBDatabaseCallbacksImpl::ForcedClose() { |
+ callback_runner_->PostTask(FROM_HERE, |
+ base::Bind(&WebIDBDatabaseCallbacks::onForcedClose, |
+ base::Unretained(callbacks_))); |
+} |
+ |
+void IndexedDBDatabaseCallbacksImpl::VersionChange(int64_t old_version, |
+ int64_t new_version) { |
+ callback_runner_->PostTask( |
+ FROM_HERE, |
+ base::Bind(&WebIDBDatabaseCallbacks::onVersionChange, |
+ base::Unretained(callbacks_), old_version, new_version)); |
+} |
+ |
+void IndexedDBDatabaseCallbacksImpl::Abort(int64_t transaction_id, |
+ int32_t code, |
+ const base::string16& message) { |
+ callback_runner_->PostTask( |
+ FROM_HERE, base::Bind(&WebIDBDatabaseCallbacks::onAbort, |
+ base::Unretained(callbacks_), transaction_id, |
+ blink::WebIDBDatabaseError(code, message))); |
+} |
+ |
+void IndexedDBDatabaseCallbacksImpl::Complete(int64_t transaction_id) { |
+ callback_runner_->PostTask( |
+ FROM_HERE, base::Bind(&WebIDBDatabaseCallbacks::onComplete, |
+ base::Unretained(callbacks_), transaction_id)); |
+} |
+ |
+} // namespace content |