| Index: content/common/indexed_db/proxy_webidbcursor_impl.cc
|
| diff --git a/content/common/indexed_db/proxy_webidbcursor_impl.cc b/content/common/indexed_db/proxy_webidbcursor_impl.cc
|
| index f043356171fdbe58f43eac00908d79113b030043..5fa1c8703a60fbd1bab2eb1870728fa4d1b1e9be 100644
|
| --- a/content/common/indexed_db/proxy_webidbcursor_impl.cc
|
| +++ b/content/common/indexed_db/proxy_webidbcursor_impl.cc
|
| @@ -26,6 +26,8 @@ RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() {
|
| // 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.
|
| + if (idb_cursor_id_ == kInvalidIDBCursorId)
|
| + return;
|
| IndexedDBDispatcher::Send(new IndexedDBHostMsg_CursorDestroyed(
|
| idb_cursor_id_));
|
| IndexedDBDispatcher* dispatcher =
|
| @@ -34,6 +36,8 @@ RendererWebIDBCursorImpl::~RendererWebIDBCursorImpl() {
|
| }
|
|
|
| unsigned short RendererWebIDBCursorImpl::direction() const {
|
| + if (idb_cursor_id_ == kInvalidIDBCursorId)
|
| + return 0;
|
| int direction;
|
| IndexedDBDispatcher::Send(
|
| new IndexedDBHostMsg_CursorDirection(idb_cursor_id_, &direction));
|
| @@ -55,6 +59,8 @@ WebSerializedScriptValue RendererWebIDBCursorImpl::value() const {
|
| void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value,
|
| WebIDBCallbacks* callbacks,
|
| WebExceptionCode& ec) {
|
| + if (idb_cursor_id_ == kInvalidIDBCursorId)
|
| + return;
|
| IndexedDBDispatcher* dispatcher =
|
| IndexedDBDispatcher::ThreadSpecificInstance();
|
| dispatcher->RequestIDBCursorUpdate(
|
| @@ -67,7 +73,7 @@ void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key,
|
| IndexedDBDispatcher* dispatcher =
|
| IndexedDBDispatcher::ThreadSpecificInstance();
|
|
|
| - if (key.type() == WebIDBKey::InvalidType) {
|
| + if (key.type() == WebIDBKey::NullType) {
|
| // No key, so this would qualify for a prefetch.
|
| ++continue_count_;
|
|
|
| @@ -77,6 +83,9 @@ void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key,
|
| return;
|
| }
|
|
|
| + if (idb_cursor_id_ == kInvalidIDBCursorId)
|
| + return;
|
| +
|
| if (continue_count_ > kPrefetchContinueThreshold) {
|
| // Request pre-fetch.
|
| dispatcher->RequestIDBCursorPrefetch(prefetch_amount_, callbacks,
|
| @@ -94,12 +103,17 @@ void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key,
|
| ResetPrefetchCache();
|
| }
|
|
|
| + if (idb_cursor_id_ == kInvalidIDBCursorId)
|
| + return;
|
| +
|
| dispatcher->RequestIDBCursorContinue(IndexedDBKey(key), callbacks,
|
| idb_cursor_id_, &ec);
|
| }
|
|
|
| void RendererWebIDBCursorImpl::deleteFunction(WebIDBCallbacks* callbacks,
|
| WebExceptionCode& ec) {
|
| + if (idb_cursor_id_ == kInvalidIDBCursorId)
|
| + return;
|
| IndexedDBDispatcher* dispatcher =
|
| IndexedDBDispatcher::ThreadSpecificInstance();
|
| dispatcher->RequestIDBCursorDelete(callbacks, idb_cursor_id_, &ec);
|
| @@ -168,11 +182,14 @@ void RendererWebIDBCursorImpl::ResetPrefetchCache() {
|
| return;
|
| }
|
|
|
| - IndexedDBDispatcher* dispatcher =
|
| - IndexedDBDispatcher::ThreadSpecificInstance();
|
| - dispatcher->RequestIDBCursorPrefetchReset(used_prefetches_,
|
| - prefetch_keys_.size(),
|
| - idb_cursor_id_);
|
| + if (idb_cursor_id_ != kInvalidIDBCursorId) {
|
| + IndexedDBDispatcher* dispatcher =
|
| + IndexedDBDispatcher::ThreadSpecificInstance();
|
| + dispatcher->RequestIDBCursorPrefetchReset(used_prefetches_,
|
| + prefetch_keys_.size(),
|
| + idb_cursor_id_);
|
| + }
|
| +
|
| prefetch_keys_.clear();
|
| prefetch_primary_keys_.clear();
|
| prefetch_values_.clear();
|
|
|