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

Side by Side Diff: content/child/indexed_db/indexed_db_database_callbacks_impl.cc

Issue 2370643004: Port messages sent by WebIDBFactoryImpl to Mojo. (Closed)
Patch Set: Allow cpp_only to be set by the invoker. 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/child/indexed_db/indexed_db_database_callbacks_impl.h"
6
7 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseCal lbacks.h"
8 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseErr or.h"
9
10 using blink::WebIDBDatabaseCallbacks;
11
12 namespace content {
13
14 IndexedDBDatabaseCallbacksImpl::IndexedDBDatabaseCallbacksImpl(
15 WebIDBDatabaseCallbacks* callbacks)
16 : callback_runner_(base::ThreadTaskRunnerHandle::Get()),
17 callbacks_(callbacks),
18 binding_(this) {}
19
20 IndexedDBDatabaseCallbacksImpl::~IndexedDBDatabaseCallbacksImpl() {
21 callback_runner_->DeleteSoon(FROM_HERE, callbacks_);
22 }
23
24 void IndexedDBDatabaseCallbacksImpl::Bind(
25 indexed_db::mojom::DatabaseCallbacksAssociatedPtrInfo* ptr_info,
26 mojo::AssociatedGroup* associated_group) {
27 binding_.Bind(ptr_info, associated_group);
28 binding_.set_connection_error_handler(
29 base::Bind(&IndexedDBDatabaseCallbacksImpl::OnConnectionError,
30 base::Unretained(this)));
31 }
32
33 void IndexedDBDatabaseCallbacksImpl::OnConnectionError() {
34 delete this;
35 }
36
37 void IndexedDBDatabaseCallbacksImpl::ForcedClose() {
38 callback_runner_->PostTask(FROM_HERE,
39 base::Bind(&WebIDBDatabaseCallbacks::onForcedClose,
40 base::Unretained(callbacks_)));
41 }
42
43 void IndexedDBDatabaseCallbacksImpl::VersionChange(int64_t old_version,
44 int64_t new_version) {
45 callback_runner_->PostTask(
46 FROM_HERE,
47 base::Bind(&WebIDBDatabaseCallbacks::onVersionChange,
48 base::Unretained(callbacks_), old_version, new_version));
49 }
50
51 void IndexedDBDatabaseCallbacksImpl::Abort(int64_t transaction_id,
52 int32_t code,
53 const base::string16& message) {
54 callback_runner_->PostTask(
55 FROM_HERE, base::Bind(&WebIDBDatabaseCallbacks::onAbort,
56 base::Unretained(callbacks_), transaction_id,
57 blink::WebIDBDatabaseError(code, message)));
58 }
59
60 void IndexedDBDatabaseCallbacksImpl::Complete(int64_t transaction_id) {
61 callback_runner_->PostTask(
62 FROM_HERE, base::Bind(&WebIDBDatabaseCallbacks::onComplete,
63 base::Unretained(callbacks_), transaction_id));
64 }
65
66 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698