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" |
7 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 8 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
8 #include "content/common/indexed_db/indexed_db_messages.h" | 9 #include "content/common/indexed_db/indexed_db_messages.h" |
9 | 10 |
10 namespace content { | 11 namespace content { |
11 | 12 |
12 IndexedDBDatabaseCallbacks::IndexedDBDatabaseCallbacks( | 13 IndexedDBDatabaseCallbacks::IndexedDBDatabaseCallbacks( |
13 IndexedDBDispatcherHost* dispatcher_host, | 14 IndexedDBDispatcherHost* dispatcher_host, |
14 int ipc_thread_id, | 15 int ipc_thread_id, |
15 int ipc_database_callbacks_id) | 16 int ipc_database_callbacks_id) |
16 : dispatcher_host_(dispatcher_host), | 17 : dispatcher_host_(dispatcher_host), |
17 ipc_thread_id_(ipc_thread_id), | 18 ipc_thread_id_(ipc_thread_id), |
18 ipc_database_callbacks_id_(ipc_database_callbacks_id) { | 19 ipc_database_callbacks_id_(ipc_database_callbacks_id) {} |
19 } | |
20 | 20 |
21 IndexedDBDatabaseCallbacks::~IndexedDBDatabaseCallbacks() { | 21 IndexedDBDatabaseCallbacks::~IndexedDBDatabaseCallbacks() {} |
22 } | |
23 | 22 |
24 void IndexedDBDatabaseCallbacks::onForcedClose() { | 23 void IndexedDBDatabaseCallbacks::onForcedClose() { |
25 dispatcher_host_->Send( | 24 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksForcedClose( |
26 new IndexedDBMsg_DatabaseCallbacksForcedClose( | 25 ipc_thread_id_, ipc_database_callbacks_id_)); |
27 ipc_thread_id_, | |
28 ipc_database_callbacks_id_)); | |
29 } | 26 } |
30 | 27 |
31 void IndexedDBDatabaseCallbacks::onVersionChange(long long old_version, | 28 void IndexedDBDatabaseCallbacks::onVersionChange(long long old_version, |
32 long long new_version) { | 29 long long new_version) { |
33 dispatcher_host_->Send( | 30 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksIntVersionChange( |
34 new IndexedDBMsg_DatabaseCallbacksIntVersionChange( | 31 ipc_thread_id_, ipc_database_callbacks_id_, old_version, new_version)); |
35 ipc_thread_id_, | |
36 ipc_database_callbacks_id_, | |
37 old_version, | |
38 new_version)); | |
39 } | 32 } |
40 | 33 |
41 void IndexedDBDatabaseCallbacks::onAbort( | 34 void IndexedDBDatabaseCallbacks::onAbort( |
42 long long host_transaction_id, | 35 long long host_transaction_id, |
43 const WebKit::WebIDBDatabaseError& error) { | 36 const WebKit::WebIDBDatabaseError& error) { |
44 dispatcher_host_->FinishTransaction(host_transaction_id, false); | 37 dispatcher_host_->FinishTransaction(host_transaction_id, false); |
45 dispatcher_host_->Send( | 38 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksAbort( |
46 new IndexedDBMsg_DatabaseCallbacksAbort( | 39 ipc_thread_id_, |
47 ipc_thread_id_, ipc_database_callbacks_id_, | 40 ipc_database_callbacks_id_, |
48 dispatcher_host_->RendererTransactionId(host_transaction_id), | 41 dispatcher_host_->RendererTransactionId(host_transaction_id), |
49 error.code(), error.message())); | 42 error.code(), |
| 43 error.message())); |
50 } | 44 } |
51 | 45 |
52 void IndexedDBDatabaseCallbacks::onComplete(long long host_transaction_id) { | 46 void IndexedDBDatabaseCallbacks::onComplete(long long host_transaction_id) { |
53 dispatcher_host_->FinishTransaction(host_transaction_id, true); | 47 dispatcher_host_->FinishTransaction(host_transaction_id, true); |
54 dispatcher_host_->Send( | 48 dispatcher_host_->Send(new IndexedDBMsg_DatabaseCallbacksComplete( |
55 new IndexedDBMsg_DatabaseCallbacksComplete( | 49 ipc_thread_id_, |
56 ipc_thread_id_, ipc_database_callbacks_id_, | 50 ipc_database_callbacks_id_, |
57 dispatcher_host_->RendererTransactionId(host_transaction_id))); | 51 dispatcher_host_->RendererTransactionId(host_transaction_id))); |
58 } | 52 } |
59 | 53 |
60 } // namespace content | 54 } // namespace content |
OLD | NEW |