| OLD | NEW |
| 1 // Copyright (c) 2010 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.h" |
| 10 | 10 |
| 11 using WebKit::WebExceptionCode; | 11 using WebKit::WebExceptionCode; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 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 RenderThread::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 void RendererWebIDBCursorImpl::value( | 50 WebSerializedScriptValue RendererWebIDBCursorImpl::value() const { |
| 51 WebSerializedScriptValue& webScriptValue, | |
| 52 WebIDBKey& webKey) const { | |
| 53 SerializedScriptValue scriptValue; | 51 SerializedScriptValue scriptValue; |
| 54 IndexedDBKey key; | |
| 55 RenderThread::current()->Send( | 52 RenderThread::current()->Send( |
| 56 new IndexedDBHostMsg_CursorValue(idb_cursor_id_, &scriptValue, | 53 new IndexedDBHostMsg_CursorValue(idb_cursor_id_, &scriptValue)); |
| 57 &key)); | 54 return scriptValue; |
| 58 // Only one or the other type should have been "returned" to us. | |
| 59 DCHECK(scriptValue.is_null() != (key.type() == WebIDBKey::InvalidType)); | |
| 60 webScriptValue = scriptValue; | |
| 61 webKey = key; | |
| 62 } | 55 } |
| 63 | 56 |
| 64 void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value, | 57 void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value, |
| 65 WebIDBCallbacks* callbacks, | 58 WebIDBCallbacks* callbacks, |
| 66 WebExceptionCode& ec) { | 59 WebExceptionCode& ec) { |
| 67 IndexedDBDispatcher* dispatcher = | 60 IndexedDBDispatcher* dispatcher = |
| 68 RenderThread::current()->indexed_db_dispatcher(); | 61 RenderThread::current()->indexed_db_dispatcher(); |
| 69 dispatcher->RequestIDBCursorUpdate(SerializedScriptValue(value), callbacks, | 62 dispatcher->RequestIDBCursorUpdate(SerializedScriptValue(value), callbacks, |
| 70 idb_cursor_id_, &ec); | 63 idb_cursor_id_, &ec); |
| 71 } | 64 } |
| 72 | 65 |
| 73 void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key, | 66 void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key, |
| 74 WebIDBCallbacks* callbacks, | 67 WebIDBCallbacks* callbacks, |
| 75 WebExceptionCode& ec) { | 68 WebExceptionCode& ec) { |
| 76 IndexedDBDispatcher* dispatcher = | 69 IndexedDBDispatcher* dispatcher = |
| 77 RenderThread::current()->indexed_db_dispatcher(); | 70 RenderThread::current()->indexed_db_dispatcher(); |
| 78 dispatcher->RequestIDBCursorContinue(IndexedDBKey(key), callbacks, | 71 dispatcher->RequestIDBCursorContinue(IndexedDBKey(key), callbacks, |
| 79 idb_cursor_id_, &ec); | 72 idb_cursor_id_, &ec); |
| 80 } | 73 } |
| 81 | 74 |
| 82 void RendererWebIDBCursorImpl::remove(WebIDBCallbacks* callbacks, | 75 void RendererWebIDBCursorImpl::deleteFunction(WebIDBCallbacks* callbacks, |
| 83 WebExceptionCode& ec) { | 76 WebExceptionCode& ec) { |
| 84 IndexedDBDispatcher* dispatcher = | 77 IndexedDBDispatcher* dispatcher = |
| 85 RenderThread::current()->indexed_db_dispatcher(); | 78 RenderThread::current()->indexed_db_dispatcher(); |
| 86 dispatcher->RequestIDBCursorDelete(callbacks, idb_cursor_id_, &ec); | 79 dispatcher->RequestIDBCursorDelete(callbacks, idb_cursor_id_, &ec); |
| 87 } | 80 } |
| OLD | NEW |