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

Unified Diff: content/child/indexed_db/indexed_db_database_callbacks_impl.cc

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Addressed most of dcheng@'s feedback. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698