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
3 // found in the LICENSE file.
5 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h"
7 #include "content/common/indexed_db/indexed_db_messages.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"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCallbacks.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
15 using WebKit::WebIDBObjectStore
;
16 using WebKit::WebIDBTransactionCallbacks
;
17 using WebKit::WebString
;
21 RendererWebIDBTransactionImpl::RendererWebIDBTransactionImpl(
22 int32 ipc_transaction_id
)
23 : ipc_transaction_id_(ipc_transaction_id
) {
26 RendererWebIDBTransactionImpl::~RendererWebIDBTransactionImpl() {
27 // 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
29 // this object. But, if that ever changed, then we'd need to invalidate
31 IndexedDBDispatcher::Send(new IndexedDBHostMsg_TransactionDestroyed(
32 ipc_transaction_id_
));
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
));
44 return new RendererWebIDBObjectStoreImpl(ipc_object_store_id
);
47 void RendererWebIDBTransactionImpl::commit() {
48 IndexedDBDispatcher::Send(new IndexedDBHostMsg_TransactionCommit(
49 ipc_transaction_id_
));
52 void RendererWebIDBTransactionImpl::abort() {
53 IndexedDBDispatcher::Send(new IndexedDBHostMsg_TransactionAbort(
54 ipc_transaction_id_
));
57 void RendererWebIDBTransactionImpl::didCompleteTaskEvents() {
58 IndexedDBDispatcher::Send(
59 new IndexedDBHostMsg_TransactionDidCompleteTaskEvents(
60 ipc_transaction_id_
));
63 void RendererWebIDBTransactionImpl::setCallbacks(
64 WebIDBTransactionCallbacks
* callbacks
) {
65 IndexedDBDispatcher
* dispatcher
=
66 IndexedDBDispatcher::ThreadSpecificInstance();
67 dispatcher
->RegisterWebIDBTransactionCallbacks(callbacks
,
71 } // namespace content