diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-18 01:33:34 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-18 01:33:34 +0000 |
commit | acb94729d3aa35ec833c922ade31340229770d60 (patch) | |
tree | 7c26a239c8b9e09b78f809a308e081329625c8b2 /content/renderer/renderer_webidbcursor_impl.cc | |
parent | 4874aae4718d407f7f4de1b71f0c02b9a2065474 (diff) | |
download | chromium_src-acb94729d3aa35ec833c922ade31340229770d60.zip chromium_src-acb94729d3aa35ec833c922ade31340229770d60.tar.gz chromium_src-acb94729d3aa35ec833c922ade31340229770d60.tar.bz2 |
Move the renderer_web* files to content.
TBR=avi
Review URL: http://codereview.chromium.org/6713024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78643 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/renderer_webidbcursor_impl.cc')
-rw-r--r-- | content/renderer/renderer_webidbcursor_impl.cc | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/content/renderer/renderer_webidbcursor_impl.cc b/content/renderer/renderer_webidbcursor_impl.cc new file mode 100644 index 0000000..1bad237 --- /dev/null +++ b/content/renderer/renderer_webidbcursor_impl.cc @@ -0,0 +1,87 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/renderer/renderer_webidbcursor_impl.h" + +#include "chrome/renderer/render_thread.h" +#include "content/common/indexed_db_messages.h" +#include "content/renderer/indexed_db_dispatcher.h" + +using WebKit::WebExceptionCode; +using WebKit::WebIDBCallbacks; +using WebKit::WebIDBKey; +using WebKit::WebSerializedScriptValue; + +RendererWebIDBCursorImpl::RendererWebIDBCursorImpl(int32 idb_cursor_id) + : idb_cursor_id_(idb_cursor_id) { +} + +RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() { + // It's not possible for there to be pending callbacks that address this + // object since inside WebKit, they hold a reference to the object wich owns + // this object. But, if that ever changed, then we'd need to invalidate + // any such pointers. + RenderThread::current()->Send(new IndexedDBHostMsg_CursorDestroyed( + idb_cursor_id_)); +} + +unsigned short RendererWebIDBCursorImpl::direction() const { + int direction; + RenderThread::current()->Send( + new IndexedDBHostMsg_CursorDirection(idb_cursor_id_, &direction)); + return direction; +} + +WebIDBKey RendererWebIDBCursorImpl::key() const { + IndexedDBKey key; + RenderThread::current()->Send( + new IndexedDBHostMsg_CursorKey(idb_cursor_id_, &key)); + return key; +} + +WebIDBKey RendererWebIDBCursorImpl::primaryKey() const { + IndexedDBKey primaryKey; + RenderThread::current()->Send( + new IndexedDBHostMsg_CursorPrimaryKey(idb_cursor_id_, &primaryKey)); + return primaryKey; +} + +void RendererWebIDBCursorImpl::value( + WebSerializedScriptValue& webScriptValue, + WebIDBKey& webKey) const { + SerializedScriptValue scriptValue; + IndexedDBKey key; + RenderThread::current()->Send( + new IndexedDBHostMsg_CursorValue(idb_cursor_id_, &scriptValue, + &key)); + // Only one or the other type should have been "returned" to us. + DCHECK(scriptValue.is_null() != (key.type() == WebIDBKey::InvalidType)); + webScriptValue = scriptValue; + webKey = key; +} + +void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value, + WebIDBCallbacks* callbacks, + WebExceptionCode& ec) { + IndexedDBDispatcher* dispatcher = + RenderThread::current()->indexed_db_dispatcher(); + dispatcher->RequestIDBCursorUpdate(SerializedScriptValue(value), callbacks, + idb_cursor_id_, &ec); +} + +void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key, + WebIDBCallbacks* callbacks, + WebExceptionCode& ec) { + IndexedDBDispatcher* dispatcher = + RenderThread::current()->indexed_db_dispatcher(); + dispatcher->RequestIDBCursorContinue(IndexedDBKey(key), callbacks, + idb_cursor_id_, &ec); +} + +void RendererWebIDBCursorImpl::remove(WebIDBCallbacks* callbacks, + WebExceptionCode& ec) { + IndexedDBDispatcher* dispatcher = + RenderThread::current()->indexed_db_dispatcher(); + dispatcher->RequestIDBCursorDelete(callbacks, idb_cursor_id_, &ec); +} |