| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_webidbcursor_impl.h" | 5 #include "content/renderer/renderer_webidbcursor_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.h" | 9 #include "content/renderer/render_thread_impl.h" |
| 10 | 10 |
| 11 using WebKit::WebExceptionCode; | 11 using WebKit::WebExceptionCode; |
| 12 using WebKit::WebIDBCallbacks; | 12 using WebKit::WebIDBCallbacks; |
| 13 using WebKit::WebIDBKey; | 13 using WebKit::WebIDBKey; |
| 14 using WebKit::WebSerializedScriptValue; | 14 using WebKit::WebSerializedScriptValue; |
| 15 | 15 |
| 16 RendererWebIDBCursorImpl::RendererWebIDBCursorImpl(int32 idb_cursor_id) | 16 RendererWebIDBCursorImpl::RendererWebIDBCursorImpl(int32 idb_cursor_id) |
| 17 : idb_cursor_id_(idb_cursor_id) { | 17 : idb_cursor_id_(idb_cursor_id) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() { | 20 RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() { |
| 21 // It's not possible for there to be pending callbacks that address this | 21 // It's not possible for there to be pending callbacks that address this |
| 22 // object since inside WebKit, they hold a reference to the object wich owns | 22 // object since inside WebKit, they hold a reference to the object wich owns |
| 23 // this object. But, if that ever changed, then we'd need to invalidate | 23 // this object. But, if that ever changed, then we'd need to invalidate |
| 24 // any such pointers. | 24 // any such pointers. |
| 25 RenderThread::current()->Send(new IndexedDBHostMsg_CursorDestroyed( | 25 RenderThreadImpl::current()->Send(new IndexedDBHostMsg_CursorDestroyed( |
| 26 idb_cursor_id_)); | 26 idb_cursor_id_)); |
| 27 } | 27 } |
| 28 | 28 |
| 29 unsigned short RendererWebIDBCursorImpl::direction() const { | 29 unsigned short RendererWebIDBCursorImpl::direction() const { |
| 30 int direction; | 30 int direction; |
| 31 RenderThread::current()->Send( | 31 RenderThreadImpl::current()->Send( |
| 32 new IndexedDBHostMsg_CursorDirection(idb_cursor_id_, &direction)); | 32 new IndexedDBHostMsg_CursorDirection(idb_cursor_id_, &direction)); |
| 33 return direction; | 33 return direction; |
| 34 } | 34 } |
| 35 | 35 |
| 36 WebIDBKey RendererWebIDBCursorImpl::key() const { | 36 WebIDBKey RendererWebIDBCursorImpl::key() const { |
| 37 IndexedDBKey key; | 37 IndexedDBKey key; |
| 38 RenderThread::current()->Send( | 38 RenderThreadImpl::current()->Send( |
| 39 new IndexedDBHostMsg_CursorKey(idb_cursor_id_, &key)); | 39 new IndexedDBHostMsg_CursorKey(idb_cursor_id_, &key)); |
| 40 return key; | 40 return key; |
| 41 } | 41 } |
| 42 | 42 |
| 43 WebIDBKey RendererWebIDBCursorImpl::primaryKey() const { | 43 WebIDBKey RendererWebIDBCursorImpl::primaryKey() const { |
| 44 IndexedDBKey primaryKey; | 44 IndexedDBKey primaryKey; |
| 45 RenderThread::current()->Send( | 45 RenderThreadImpl::current()->Send( |
| 46 new IndexedDBHostMsg_CursorPrimaryKey(idb_cursor_id_, &primaryKey)); | 46 new IndexedDBHostMsg_CursorPrimaryKey(idb_cursor_id_, &primaryKey)); |
| 47 return primaryKey; | 47 return primaryKey; |
| 48 } | 48 } |
| 49 | 49 |
| 50 WebSerializedScriptValue RendererWebIDBCursorImpl::value() const { | 50 WebSerializedScriptValue RendererWebIDBCursorImpl::value() const { |
| 51 SerializedScriptValue scriptValue; | 51 SerializedScriptValue scriptValue; |
| 52 RenderThread::current()->Send( | 52 RenderThreadImpl::current()->Send( |
| 53 new IndexedDBHostMsg_CursorValue(idb_cursor_id_, &scriptValue)); | 53 new IndexedDBHostMsg_CursorValue(idb_cursor_id_, &scriptValue)); |
| 54 return scriptValue; | 54 return scriptValue; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value, | 57 void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value, |
| 58 WebIDBCallbacks* callbacks, | 58 WebIDBCallbacks* callbacks, |
| 59 WebExceptionCode& ec) { | 59 WebExceptionCode& ec) { |
| 60 IndexedDBDispatcher* dispatcher = | 60 IndexedDBDispatcher* dispatcher = |
| 61 RenderThread::current()->indexed_db_dispatcher(); | 61 RenderThreadImpl::current()->indexed_db_dispatcher(); |
| 62 dispatcher->RequestIDBCursorUpdate(SerializedScriptValue(value), callbacks, | 62 dispatcher->RequestIDBCursorUpdate(SerializedScriptValue(value), callbacks, |
| 63 idb_cursor_id_, &ec); | 63 idb_cursor_id_, &ec); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key, | 66 void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key, |
| 67 WebIDBCallbacks* callbacks, | 67 WebIDBCallbacks* callbacks, |
| 68 WebExceptionCode& ec) { | 68 WebExceptionCode& ec) { |
| 69 IndexedDBDispatcher* dispatcher = | 69 IndexedDBDispatcher* dispatcher = |
| 70 RenderThread::current()->indexed_db_dispatcher(); | 70 RenderThreadImpl::current()->indexed_db_dispatcher(); |
| 71 dispatcher->RequestIDBCursorContinue(IndexedDBKey(key), callbacks, | 71 dispatcher->RequestIDBCursorContinue(IndexedDBKey(key), callbacks, |
| 72 idb_cursor_id_, &ec); | 72 idb_cursor_id_, &ec); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void RendererWebIDBCursorImpl::deleteFunction(WebIDBCallbacks* callbacks, | 75 void RendererWebIDBCursorImpl::deleteFunction(WebIDBCallbacks* callbacks, |
| 76 WebExceptionCode& ec) { | 76 WebExceptionCode& ec) { |
| 77 IndexedDBDispatcher* dispatcher = | 77 IndexedDBDispatcher* dispatcher = |
| 78 RenderThread::current()->indexed_db_dispatcher(); | 78 RenderThreadImpl::current()->indexed_db_dispatcher(); |
| 79 dispatcher->RequestIDBCursorDelete(callbacks, idb_cursor_id_, &ec); | 79 dispatcher->RequestIDBCursorDelete(callbacks, idb_cursor_id_, &ec); |
| 80 } | 80 } |
| OLD | NEW |