Chromium Code Reviews| Index: Source/modules/indexeddb/IDBCursor.cpp |
| diff --git a/Source/modules/indexeddb/IDBCursor.cpp b/Source/modules/indexeddb/IDBCursor.cpp |
| index 1b8a2a486b4f557450a3c23b0b8af0b1f0e96ae2..13865bdf11d9086efd4d35f47197a8353d951030 100644 |
| --- a/Source/modules/indexeddb/IDBCursor.cpp |
| +++ b/Source/modules/indexeddb/IDBCursor.cpp |
| @@ -38,6 +38,7 @@ |
| #include "modules/indexeddb/IDBTracing.h" |
| #include "modules/indexeddb/IDBTransaction.h" |
| #include "modules/indexeddb/WebIDBCallbacksImpl.h" |
| +#include "public/platform/WebBlobInfo.h" |
| #include "public/platform/WebIDBDatabase.h" |
| #include "public/platform/WebIDBKeyRange.h" |
| #include <limits> |
| @@ -96,6 +97,7 @@ IDBCursor::IDBCursor(PassOwnPtr<blink::WebIDBCursor> backend, WebIDBCursor::Dire |
| IDBCursor::~IDBCursor() |
| { |
| + handleBlobAcks(); |
| } |
| PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value, ExceptionState& exceptionState) |
| @@ -328,16 +330,18 @@ ScriptValue IDBCursor::value(NewScriptState* scriptState) |
| const IDBObjectStoreMetadata& metadata = objectStore->metadata(); |
| RefPtr<IDBAny> value; |
| if (metadata.autoIncrement && !metadata.keyPath.isNull()) { |
| - value = IDBAny::create(m_value, m_primaryKey, metadata.keyPath); |
| + value = IDBAny::create(m_value, m_blobInfo.get(), m_primaryKey, metadata.keyPath); |
| #ifndef NDEBUG |
| - assertPrimaryKeyValidOrInjectable(scriptState, m_value, m_primaryKey, metadata.keyPath); |
| + assertPrimaryKeyValidOrInjectable(scriptState, m_value, m_blobInfo.get(), m_primaryKey, metadata.keyPath); |
| #endif |
| } else { |
| - value = IDBAny::create(m_value); |
| + value = IDBAny::create(m_value, m_blobInfo.get()); |
| } |
| m_valueDirty = false; |
| - return idbAnyToScriptValue(scriptState, value); |
| + ScriptValue scriptValue = idbAnyToScriptValue(scriptState, value); |
| + handleBlobAcks(); |
| + return scriptValue; |
| } |
| ScriptValue IDBCursor::source(NewScriptState* scriptState) const |
| @@ -345,7 +349,7 @@ ScriptValue IDBCursor::source(NewScriptState* scriptState) const |
| return idbAnyToScriptValue(scriptState, m_source); |
| } |
| -void IDBCursor::setValueReady(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer> value) |
| +void IDBCursor::setValueReady(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer> value, PassOwnPtr<Vector<blink::WebBlobInfo> > blobInfo) |
| { |
| m_key = key; |
| m_keyDirty = true; |
| @@ -355,6 +359,7 @@ void IDBCursor::setValueReady(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primary |
| if (isCursorWithValue()) { |
| m_value = value; |
| + m_blobInfo = blobInfo; |
| m_valueDirty = true; |
| } |
| @@ -376,6 +381,14 @@ bool IDBCursor::isDeleted() const |
| return m_source->idbIndex()->isDeleted(); |
| } |
| +void IDBCursor::handleBlobAcks() |
| +{ |
| + if (m_blobInfo.get() && m_blobInfo->size()) { |
| + m_request->ackReceivedBlobs(m_blobInfo.get()); |
|
jsbell
2014/04/15 18:29:07
I think m_request could be null if called from des
ericu
2014/04/16 23:04:14
Good point; in that case, we'd not only crash, we'
jsbell
2014/04/17 19:00:33
For the reference cycle breaking - although oilpan
|
| + m_blobInfo.clear(); |
| + } |
| +} |
| + |
| WebIDBCursor::Direction IDBCursor::stringToDirection(const String& directionString, ExceptionState& exceptionState) |
| { |
| if (directionString.isNull() || directionString == IDBCursor::directionNext()) |