| 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_webidbindex_impl.h" | 5 #include "chrome/renderer/renderer_webidbindex_impl.h" |
| 6 | 6 |
| 7 #include "chrome/common/indexed_db_key.h" | 7 #include "chrome/common/indexed_db_messages.h" |
| 8 #include "chrome/common/render_messages.h" | |
| 9 #include "chrome/renderer/render_thread.h" | 8 #include "chrome/renderer/render_thread.h" |
| 10 #include "chrome/renderer/indexed_db_dispatcher.h" | 9 #include "chrome/renderer/indexed_db_dispatcher.h" |
| 11 #include "chrome/renderer/renderer_webidbtransaction_impl.h" | 10 #include "chrome/renderer/renderer_webidbtransaction_impl.h" |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
| 12 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" |
| 12 | 13 |
| 13 using WebKit::WebExceptionCode; | 14 using WebKit::WebExceptionCode; |
| 14 using WebKit::WebDOMStringList; | 15 using WebKit::WebDOMStringList; |
| 15 using WebKit::WebString; | 16 using WebKit::WebString; |
| 16 using WebKit::WebVector; | 17 using WebKit::WebVector; |
| 17 | 18 |
| 18 RendererWebIDBIndexImpl::RendererWebIDBIndexImpl(int32 idb_index_id) | 19 RendererWebIDBIndexImpl::RendererWebIDBIndexImpl(int32 idb_index_id) |
| 19 : idb_index_id_(idb_index_id) { | 20 : idb_index_id_(idb_index_id) { |
| 20 } | 21 } |
| 21 | 22 |
| 22 RendererWebIDBIndexImpl::~RendererWebIDBIndexImpl() { | 23 RendererWebIDBIndexImpl::~RendererWebIDBIndexImpl() { |
| 23 // TODO(jorlow): Is it possible for this to be destroyed but still have | 24 // TODO(jorlow): Is it possible for this to be destroyed but still have |
| 24 // pending callbacks? If so, fix! | 25 // pending callbacks? If so, fix! |
| 25 RenderThread::current()->Send(new ViewHostMsg_IDBIndexDestroyed( | 26 RenderThread::current()->Send(new IndexedDBHostMsg_IndexDestroyed( |
| 26 idb_index_id_)); | 27 idb_index_id_)); |
| 27 } | 28 } |
| 28 | 29 |
| 29 WebString RendererWebIDBIndexImpl::name() const { | 30 WebString RendererWebIDBIndexImpl::name() const { |
| 30 string16 result; | 31 string16 result; |
| 31 RenderThread::current()->Send( | 32 RenderThread::current()->Send( |
| 32 new ViewHostMsg_IDBIndexName(idb_index_id_, &result)); | 33 new IndexedDBHostMsg_IndexName(idb_index_id_, &result)); |
| 33 return result; | 34 return result; |
| 34 } | 35 } |
| 35 | 36 |
| 36 WebString RendererWebIDBIndexImpl::storeName() const { | 37 WebString RendererWebIDBIndexImpl::storeName() const { |
| 37 string16 result; | 38 string16 result; |
| 38 RenderThread::current()->Send( | 39 RenderThread::current()->Send( |
| 39 new ViewHostMsg_IDBIndexStoreName(idb_index_id_, &result)); | 40 new IndexedDBHostMsg_IndexStoreName(idb_index_id_, &result)); |
| 40 return result; | 41 return result; |
| 41 } | 42 } |
| 42 | 43 |
| 43 WebString RendererWebIDBIndexImpl::keyPath() const { | 44 WebString RendererWebIDBIndexImpl::keyPath() const { |
| 44 NullableString16 result; | 45 NullableString16 result; |
| 45 RenderThread::current()->Send( | 46 RenderThread::current()->Send( |
| 46 new ViewHostMsg_IDBIndexKeyPath(idb_index_id_, &result)); | 47 new IndexedDBHostMsg_IndexKeyPath(idb_index_id_, &result)); |
| 47 return result; | 48 return result; |
| 48 } | 49 } |
| 49 | 50 |
| 50 bool RendererWebIDBIndexImpl::unique() const { | 51 bool RendererWebIDBIndexImpl::unique() const { |
| 51 bool result; | 52 bool result; |
| 52 RenderThread::current()->Send( | 53 RenderThread::current()->Send( |
| 53 new ViewHostMsg_IDBIndexUnique(idb_index_id_, &result)); | 54 new IndexedDBHostMsg_IndexUnique(idb_index_id_, &result)); |
| 54 return result; | 55 return result; |
| 55 } | 56 } |
| 56 | 57 |
| 57 void RendererWebIDBIndexImpl::openObjectCursor( | 58 void RendererWebIDBIndexImpl::openObjectCursor( |
| 58 const WebKit::WebIDBKeyRange& range, | 59 const WebKit::WebIDBKeyRange& range, |
| 59 unsigned short direction, | 60 unsigned short direction, |
| 60 WebKit::WebIDBCallbacks* callbacks, | 61 WebKit::WebIDBCallbacks* callbacks, |
| 61 const WebKit::WebIDBTransaction& transaction, | 62 const WebKit::WebIDBTransaction& transaction, |
| 62 WebExceptionCode& ec) { | 63 WebExceptionCode& ec) { |
| 63 IndexedDBDispatcher* dispatcher = | 64 IndexedDBDispatcher* dispatcher = |
| (...skipping 28 matching lines...) Expand all Loading... |
| 92 void RendererWebIDBIndexImpl::getKey( | 93 void RendererWebIDBIndexImpl::getKey( |
| 93 const WebKit::WebIDBKey& key, | 94 const WebKit::WebIDBKey& key, |
| 94 WebKit::WebIDBCallbacks* callbacks, | 95 WebKit::WebIDBCallbacks* callbacks, |
| 95 const WebKit::WebIDBTransaction& transaction, | 96 const WebKit::WebIDBTransaction& transaction, |
| 96 WebExceptionCode& ec) { | 97 WebExceptionCode& ec) { |
| 97 IndexedDBDispatcher* dispatcher = | 98 IndexedDBDispatcher* dispatcher = |
| 98 RenderThread::current()->indexed_db_dispatcher(); | 99 RenderThread::current()->indexed_db_dispatcher(); |
| 99 dispatcher->RequestIDBIndexGetKey( | 100 dispatcher->RequestIDBIndexGetKey( |
| 100 IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec); | 101 IndexedDBKey(key), callbacks, idb_index_id_, transaction, &ec); |
| 101 } | 102 } |
| OLD | NEW |