OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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/renderer/renderer_webidbtransaction_impl.h" | 5 #include "content/renderer/renderer_webidbtransaction_impl.h" |
6 | 6 |
7 #include "content/common/indexed_db_messages.h" | 7 #include "content/common/indexed_db_messages.h" |
8 #include "content/renderer/indexed_db_dispatcher.h" | 8 #include "content/renderer/indexed_db_dispatcher.h" |
9 #include "content/renderer/render_thread_impl.h" | 9 #include "content/renderer/render_thread_impl.h" |
10 #include "content/renderer/renderer_webidbobjectstore_impl.h" | 10 #include "content/renderer/renderer_webidbobjectstore_impl.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCall
backs.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
14 | 14 |
15 using WebKit::WebIDBObjectStore; | 15 using WebKit::WebIDBObjectStore; |
16 using WebKit::WebIDBTransactionCallbacks; | 16 using WebKit::WebIDBTransactionCallbacks; |
17 using WebKit::WebString; | 17 using WebKit::WebString; |
18 | 18 |
19 RendererWebIDBTransactionImpl::RendererWebIDBTransactionImpl( | 19 RendererWebIDBTransactionImpl::RendererWebIDBTransactionImpl( |
20 int32 idb_transaction_id) | 20 int32 idb_transaction_id) |
21 : idb_transaction_id_(idb_transaction_id) { | 21 : idb_transaction_id_(idb_transaction_id) { |
22 } | 22 } |
23 | 23 |
24 RendererWebIDBTransactionImpl::~RendererWebIDBTransactionImpl() { | 24 RendererWebIDBTransactionImpl::~RendererWebIDBTransactionImpl() { |
25 // 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 |
26 // 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 |
27 // 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 |
28 // any such pointers. | 28 // any such pointers. |
29 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_TransactionDestroyed( | 29 ChildThread::current()->Send(new IndexedDBHostMsg_TransactionDestroyed( |
30 idb_transaction_id_)); | 30 idb_transaction_id_)); |
31 } | 31 } |
32 | 32 |
33 int RendererWebIDBTransactionImpl::mode() const | 33 int RendererWebIDBTransactionImpl::mode() const |
34 { | 34 { |
35 int mode; | 35 int mode; |
36 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_TransactionMode( | 36 ChildThread::current()->Send(new IndexedDBHostMsg_TransactionMode( |
37 idb_transaction_id_, &mode)); | 37 idb_transaction_id_, &mode)); |
38 return mode; | 38 return mode; |
39 } | 39 } |
40 | 40 |
41 WebIDBObjectStore* RendererWebIDBTransactionImpl::objectStore( | 41 WebIDBObjectStore* RendererWebIDBTransactionImpl::objectStore( |
42 const WebString& name, | 42 const WebString& name, |
43 WebKit::WebExceptionCode& ec) | 43 WebKit::WebExceptionCode& ec) |
44 { | 44 { |
45 int object_store_id; | 45 int object_store_id; |
46 RenderThreadImpl::current()->Send( | 46 ChildThread::current()->Send( |
47 new IndexedDBHostMsg_TransactionObjectStore( | 47 new IndexedDBHostMsg_TransactionObjectStore( |
48 idb_transaction_id_, name, &object_store_id, &ec)); | 48 idb_transaction_id_, name, &object_store_id, &ec)); |
49 if (!object_store_id) | 49 if (!object_store_id) |
50 return NULL; | 50 return NULL; |
51 return new RendererWebIDBObjectStoreImpl(object_store_id); | 51 return new RendererWebIDBObjectStoreImpl(object_store_id); |
52 } | 52 } |
53 | 53 |
54 void RendererWebIDBTransactionImpl::abort() | 54 void RendererWebIDBTransactionImpl::abort() |
55 { | 55 { |
56 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_TransactionAbort( | 56 ChildThread::current()->Send(new IndexedDBHostMsg_TransactionAbort( |
57 idb_transaction_id_)); | 57 idb_transaction_id_)); |
58 } | 58 } |
59 | 59 |
60 void RendererWebIDBTransactionImpl::didCompleteTaskEvents() | 60 void RendererWebIDBTransactionImpl::didCompleteTaskEvents() |
61 { | 61 { |
62 RenderThreadImpl::current()->Send( | 62 ChildThread::current()->Send( |
63 new IndexedDBHostMsg_TransactionDidCompleteTaskEvents( | 63 new IndexedDBHostMsg_TransactionDidCompleteTaskEvents( |
64 idb_transaction_id_)); | 64 idb_transaction_id_)); |
65 } | 65 } |
66 | 66 |
67 void RendererWebIDBTransactionImpl::setCallbacks( | 67 void RendererWebIDBTransactionImpl::setCallbacks( |
68 WebIDBTransactionCallbacks* callbacks) | 68 WebIDBTransactionCallbacks* callbacks) |
69 { | 69 { |
70 IndexedDBDispatcher* dispatcher = | 70 IndexedDBDispatcher* dispatcher = |
71 RenderThreadImpl::current()->indexed_db_dispatcher(); | 71 ChildThread::current()->indexed_db_dispatcher(); |
72 dispatcher->RegisterWebIDBTransactionCallbacks(callbacks, | 72 dispatcher->RegisterWebIDBTransactionCallbacks(callbacks, |
73 idb_transaction_id_); | 73 idb_transaction_id_); |
74 } | 74 } |
OLD | NEW |