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