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/common/indexed_db/proxy_webidbtransaction_impl.h" | 5 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h" |
6 | 6 |
7 #include "content/common/indexed_db/indexed_db_messages.h" | 7 #include "content/common/indexed_db/indexed_db_messages.h" |
8 #include "content/common/indexed_db/indexed_db_dispatcher.h" | 8 #include "content/common/indexed_db/indexed_db_dispatcher.h" |
9 #include "content/common/indexed_db/proxy_webidbobjectstore_impl.h" | |
10 #include "content/common/child_thread.h" | 9 #include "content/common/child_thread.h" |
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" | |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" |
14 | 12 |
15 using WebKit::WebIDBObjectStore; | 13 using WebKit::WebIDBObjectStore; |
16 using WebKit::WebIDBTransactionCallbacks; | 14 using WebKit::WebIDBTransactionCallbacks; |
17 using WebKit::WebString; | 15 using WebKit::WebString; |
18 | 16 |
19 namespace content { | 17 namespace content { |
20 | 18 |
21 RendererWebIDBTransactionImpl::RendererWebIDBTransactionImpl( | 19 RendererWebIDBTransactionImpl::RendererWebIDBTransactionImpl( |
22 int32 ipc_transaction_id) | 20 int32 ipc_transaction_id) |
23 : ipc_transaction_id_(ipc_transaction_id) { | 21 : ipc_transaction_id_(ipc_transaction_id) { |
24 } | 22 } |
25 | 23 |
26 RendererWebIDBTransactionImpl::~RendererWebIDBTransactionImpl() { | 24 RendererWebIDBTransactionImpl::~RendererWebIDBTransactionImpl() { |
27 // It's not possible for there to be pending callbacks that address this | 25 // It's not possible for there to be pending callbacks that address this |
28 // object since inside WebKit, they hold a reference to the object wich owns | 26 // object since inside WebKit, they hold a reference to the object wich owns |
29 // this object. But, if that ever changed, then we'd need to invalidate | 27 // this object. But, if that ever changed, then we'd need to invalidate |
30 // any such pointers. | 28 // any such pointers. |
31 IndexedDBDispatcher::Send(new IndexedDBHostMsg_TransactionDestroyed( | 29 IndexedDBDispatcher::Send(new IndexedDBHostMsg_TransactionDestroyed( |
32 ipc_transaction_id_)); | 30 ipc_transaction_id_)); |
33 } | 31 } |
34 | 32 |
35 WebIDBObjectStore* RendererWebIDBTransactionImpl::objectStore( | |
36 long long object_store_id, | |
37 WebKit::WebExceptionCode& ec) { | |
38 int ipc_object_store_id; | |
39 IndexedDBDispatcher::Send( | |
40 new IndexedDBHostMsg_TransactionObjectStore( | |
41 ipc_transaction_id_, object_store_id, &ipc_object_store_id, &ec)); | |
42 if (!object_store_id) | |
43 return NULL; | |
44 return new RendererWebIDBObjectStoreImpl(ipc_object_store_id); | |
45 } | |
46 | |
47 void RendererWebIDBTransactionImpl::commit() { | 33 void RendererWebIDBTransactionImpl::commit() { |
48 IndexedDBDispatcher::Send(new IndexedDBHostMsg_TransactionCommit( | 34 IndexedDBDispatcher::Send(new IndexedDBHostMsg_TransactionCommit( |
49 ipc_transaction_id_)); | 35 ipc_transaction_id_)); |
50 } | 36 } |
51 | 37 |
52 void RendererWebIDBTransactionImpl::abort() { | 38 void RendererWebIDBTransactionImpl::abort() { |
53 IndexedDBDispatcher::Send(new IndexedDBHostMsg_TransactionAbort( | 39 IndexedDBDispatcher::Send(new IndexedDBHostMsg_TransactionAbort( |
54 ipc_transaction_id_)); | 40 ipc_transaction_id_)); |
55 } | 41 } |
56 | 42 |
57 void RendererWebIDBTransactionImpl::didCompleteTaskEvents() { | 43 void RendererWebIDBTransactionImpl::didCompleteTaskEvents() { |
58 IndexedDBDispatcher::Send( | 44 IndexedDBDispatcher::Send( |
59 new IndexedDBHostMsg_TransactionDidCompleteTaskEvents( | 45 new IndexedDBHostMsg_TransactionDidCompleteTaskEvents( |
60 ipc_transaction_id_)); | 46 ipc_transaction_id_)); |
61 } | 47 } |
62 | 48 |
63 void RendererWebIDBTransactionImpl::setCallbacks( | 49 void RendererWebIDBTransactionImpl::setCallbacks( |
64 WebIDBTransactionCallbacks* callbacks) { | 50 WebIDBTransactionCallbacks* callbacks) { |
65 IndexedDBDispatcher* dispatcher = | 51 IndexedDBDispatcher* dispatcher = |
66 IndexedDBDispatcher::ThreadSpecificInstance(); | 52 IndexedDBDispatcher::ThreadSpecificInstance(); |
67 dispatcher->RegisterWebIDBTransactionCallbacks(callbacks, | 53 dispatcher->RegisterWebIDBTransactionCallbacks(callbacks, |
68 ipc_transaction_id_); | 54 ipc_transaction_id_); |
69 } | 55 } |
70 | 56 |
71 } // namespace content | 57 } // namespace content |
OLD | NEW |