| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" | 5 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_vector.h" | |
| 8 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 7 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
| 9 #include "content/common/indexed_db/indexed_db_messages.h" | 8 #include "content/common/indexed_db/indexed_db_messages.h" |
| 10 | 9 |
| 11 namespace content { | 10 namespace content { |
| 12 | 11 |
| 13 IndexedDBDatabaseCallbacks::IndexedDBDatabaseCallbacks( | 12 IndexedDBDatabaseCallbacks::IndexedDBDatabaseCallbacks( |
| 14 IndexedDBDispatcherHost* dispatcher_host, | 13 IndexedDBDispatcherHost* dispatcher_host, |
| 15 int ipc_thread_id, | 14 int ipc_thread_id, |
| 16 int ipc_database_callbacks_id) | 15 int ipc_database_callbacks_id) |
| 17 : dispatcher_host_(dispatcher_host), | 16 : dispatcher_host_(dispatcher_host), |
| 18 ipc_thread_id_(ipc_thread_id), | 17 ipc_thread_id_(ipc_thread_id), |
| 19 ipc_database_callbacks_id_(ipc_database_callbacks_id) {} | 18 ipc_database_callbacks_id_(ipc_database_callbacks_id) { |
| 19 } |
| 20 | 20 |
| 21 IndexedDBDatabaseCallbacks::~IndexedDBDatabaseCallbacks() {} | 21 IndexedDBDatabaseCallbacks::~IndexedDBDatabaseCallbacks() { |
| 22 } |
| 22 | 23 |
| 23 void IndexedDBDatabaseCallbacks::onForcedClose() { | 24 void IndexedDBDatabaseCallbacks::onForcedClose() { |
| 24 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksForcedClose( | 25 dispatcher_host_->Send( |
| 25 ipc_thread_id_, ipc_database_callbacks_id_)); | 26 new IndexedDBMsg_DatabaseCallbacksForcedClose( |
| 27 ipc_thread_id_, |
| 28 ipc_database_callbacks_id_)); |
| 26 } | 29 } |
| 27 | 30 |
| 28 void IndexedDBDatabaseCallbacks::onVersionChange(long long old_version, | 31 void IndexedDBDatabaseCallbacks::onVersionChange(long long old_version, |
| 29 long long new_version) { | 32 long long new_version) { |
| 30 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksIntVersionChange( | 33 dispatcher_host_->Send( |
| 31 ipc_thread_id_, ipc_database_callbacks_id_, old_version, new_version)); | 34 new IndexedDBMsg_DatabaseCallbacksIntVersionChange( |
| 35 ipc_thread_id_, |
| 36 ipc_database_callbacks_id_, |
| 37 old_version, |
| 38 new_version)); |
| 32 } | 39 } |
| 33 | 40 |
| 34 void IndexedDBDatabaseCallbacks::onAbort( | 41 void IndexedDBDatabaseCallbacks::onAbort( |
| 35 long long host_transaction_id, | 42 long long host_transaction_id, |
| 36 const WebKit::WebIDBDatabaseError& error) { | 43 const WebKit::WebIDBDatabaseError& error) { |
| 37 dispatcher_host_->FinishTransaction(host_transaction_id, false); | 44 dispatcher_host_->FinishTransaction(host_transaction_id, false); |
| 38 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksAbort( | 45 dispatcher_host_->Send( |
| 39 ipc_thread_id_, | 46 new IndexedDBMsg_DatabaseCallbacksAbort( |
| 40 ipc_database_callbacks_id_, | 47 ipc_thread_id_, ipc_database_callbacks_id_, |
| 41 dispatcher_host_->RendererTransactionId(host_transaction_id), | 48 dispatcher_host_->RendererTransactionId(host_transaction_id), |
| 42 error.code(), | 49 error.code(), error.message())); |
| 43 error.message())); | |
| 44 } | 50 } |
| 45 | 51 |
| 46 void IndexedDBDatabaseCallbacks::onComplete(long long host_transaction_id) { | 52 void IndexedDBDatabaseCallbacks::onComplete(long long host_transaction_id) { |
| 47 dispatcher_host_->FinishTransaction(host_transaction_id, true); | 53 dispatcher_host_->FinishTransaction(host_transaction_id, true); |
| 48 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksComplete( | 54 dispatcher_host_->Send( |
| 49 ipc_thread_id_, | 55 new IndexedDBMsg_DatabaseCallbacksComplete( |
| 50 ipc_database_callbacks_id_, | 56 ipc_thread_id_, ipc_database_callbacks_id_, |
| 51 dispatcher_host_->RendererTransactionId(host_transaction_id))); | 57 dispatcher_host_->RendererTransactionId(host_transaction_id))); |
| 52 } | 58 } |
| 53 | 59 |
| 54 } // namespace content | 60 } // namespace content |
| OLD | NEW |