| 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 "chrome/renderer/renderer_webidbtransaction_impl.h" | 5 #include "chrome/renderer/renderer_webidbtransaction_impl.h" |
| 6 | 6 |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/indexed_db_messages.h" |
| 8 #include "chrome/renderer/indexed_db_dispatcher.h" | 8 #include "chrome/renderer/indexed_db_dispatcher.h" |
| 9 #include "chrome/renderer/render_thread.h" | 9 #include "chrome/renderer/render_thread.h" |
| 10 #include "chrome/renderer/renderer_webidbobjectstore_impl.h" | 10 #include "chrome/renderer/renderer_webidbobjectstore_impl.h" |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebIDBObjectStore.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebIDBObjectStore.h" |
| 12 #include "third_party/WebKit/WebKit/chromium/public/WebIDBTransactionCallbacks.h
" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebIDBTransactionCallbacks.h
" |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 13 #include "third_party/WebKit/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 RenderThread::current()->Send(new ViewHostMsg_IDBTransactionDestroyed( | 25 RenderThread::current()->Send(new IndexedDBHostMsg_TransactionDestroyed( |
| 26 idb_transaction_id_)); | 26 idb_transaction_id_)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 int RendererWebIDBTransactionImpl::mode() const | 29 int RendererWebIDBTransactionImpl::mode() const |
| 30 { | 30 { |
| 31 int mode; | 31 int mode; |
| 32 RenderThread::current()->Send(new ViewHostMsg_IDBTransactionMode( | 32 RenderThread::current()->Send(new IndexedDBHostMsg_TransactionMode( |
| 33 idb_transaction_id_, &mode)); | 33 idb_transaction_id_, &mode)); |
| 34 return mode; | 34 return mode; |
| 35 } | 35 } |
| 36 | 36 |
| 37 WebIDBObjectStore* RendererWebIDBTransactionImpl::objectStore( | 37 WebIDBObjectStore* RendererWebIDBTransactionImpl::objectStore( |
| 38 const WebString& name, | 38 const WebString& name, |
| 39 WebKit::WebExceptionCode& ec) | 39 WebKit::WebExceptionCode& ec) |
| 40 { | 40 { |
| 41 int object_store_id; | 41 int object_store_id; |
| 42 RenderThread::current()->Send( | 42 RenderThread::current()->Send( |
| 43 new ViewHostMsg_IDBTransactionObjectStore( | 43 new IndexedDBHostMsg_TransactionObjectStore( |
| 44 idb_transaction_id_, name, &object_store_id, &ec)); | 44 idb_transaction_id_, name, &object_store_id, &ec)); |
| 45 if (!object_store_id) | 45 if (!object_store_id) |
| 46 return NULL; | 46 return NULL; |
| 47 return new RendererWebIDBObjectStoreImpl(object_store_id); | 47 return new RendererWebIDBObjectStoreImpl(object_store_id); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void RendererWebIDBTransactionImpl::abort() | 50 void RendererWebIDBTransactionImpl::abort() |
| 51 { | 51 { |
| 52 RenderThread::current()->Send(new ViewHostMsg_IDBTransactionAbort( | 52 RenderThread::current()->Send(new IndexedDBHostMsg_TransactionAbort( |
| 53 idb_transaction_id_)); | 53 idb_transaction_id_)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void RendererWebIDBTransactionImpl::didCompleteTaskEvents() | 56 void RendererWebIDBTransactionImpl::didCompleteTaskEvents() |
| 57 { | 57 { |
| 58 RenderThread::current()->Send( | 58 RenderThread::current()->Send( |
| 59 new ViewHostMsg_IDBTransactionDidCompleteTaskEvents( | 59 new IndexedDBHostMsg_TransactionDidCompleteTaskEvents( |
| 60 idb_transaction_id_)); | 60 idb_transaction_id_)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void RendererWebIDBTransactionImpl::setCallbacks( | 63 void RendererWebIDBTransactionImpl::setCallbacks( |
| 64 WebIDBTransactionCallbacks* callbacks) | 64 WebIDBTransactionCallbacks* callbacks) |
| 65 { | 65 { |
| 66 IndexedDBDispatcher* dispatcher = | 66 IndexedDBDispatcher* dispatcher = |
| 67 RenderThread::current()->indexed_db_dispatcher(); | 67 RenderThread::current()->indexed_db_dispatcher(); |
| 68 dispatcher->RegisterWebIDBTransactionCallbacks(callbacks, | 68 dispatcher->RegisterWebIDBTransactionCallbacks(callbacks, |
| 69 idb_transaction_id_); | 69 idb_transaction_id_); |
| 70 } | 70 } |
| OLD | NEW |