OLD | NEW |
(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 |
| 19 IndexedDBDatabaseCallbacksImpl::~IndexedDBDatabaseCallbacksImpl() { |
| 20 callback_runner_->DeleteSoon(FROM_HERE, callbacks_); |
| 21 } |
| 22 |
| 23 void IndexedDBDatabaseCallbacksImpl::ForcedClose() { |
| 24 callback_runner_->PostTask(FROM_HERE, |
| 25 base::Bind(&WebIDBDatabaseCallbacks::onForcedClose, |
| 26 base::Unretained(callbacks_))); |
| 27 } |
| 28 |
| 29 void IndexedDBDatabaseCallbacksImpl::VersionChange(int64_t old_version, |
| 30 int64_t new_version) { |
| 31 callback_runner_->PostTask( |
| 32 FROM_HERE, |
| 33 base::Bind(&WebIDBDatabaseCallbacks::onVersionChange, |
| 34 base::Unretained(callbacks_), old_version, new_version)); |
| 35 } |
| 36 |
| 37 void IndexedDBDatabaseCallbacksImpl::Abort(int64_t transaction_id, |
| 38 int32_t code, |
| 39 const base::string16& message) { |
| 40 callback_runner_->PostTask( |
| 41 FROM_HERE, base::Bind(&WebIDBDatabaseCallbacks::onAbort, |
| 42 base::Unretained(callbacks_), transaction_id, |
| 43 blink::WebIDBDatabaseError(code, message))); |
| 44 } |
| 45 |
| 46 void IndexedDBDatabaseCallbacksImpl::Complete(int64_t transaction_id) { |
| 47 callback_runner_->PostTask( |
| 48 FROM_HERE, base::Bind(&WebIDBDatabaseCallbacks::onComplete, |
| 49 base::Unretained(callbacks_), transaction_id)); |
| 50 } |
| 51 |
| 52 } // namespace content |
OLD | NEW |