Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1407)

Unified Diff: Source/modules/indexeddb/IDBCursor.cpp

Issue 18590006: Blob support for IDB [Blink] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: small cleanup Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/indexeddb/IDBCursor.cpp
diff --git a/Source/modules/indexeddb/IDBCursor.cpp b/Source/modules/indexeddb/IDBCursor.cpp
index f3c4b3caf5e57dc5ccf5c1478577040e57693b64..edf25a3a0cd090037bb933a1ed2cbfa24582d01a 100644
--- a/Source/modules/indexeddb/IDBCursor.cpp
+++ b/Source/modules/indexeddb/IDBCursor.cpp
@@ -41,7 +41,7 @@
#include "modules/indexeddb/IDBTransaction.h"
#include "modules/indexeddb/WebIDBCallbacksImpl.h"
#include "platform/SharedBuffer.h"
-#include "platform/SharedBuffer.h"
+#include "platform/blob/BlobInfo.h"
#include "public/platform/WebIDBCursor.h"
#include "public/platform/WebIDBDatabase.h"
#include "public/platform/WebIDBKeyRange.h"
@@ -101,6 +101,7 @@ IDBCursor::IDBCursor(PassOwnPtr<blink::WebIDBCursor> backend, IndexedDB::CursorD
IDBCursor::~IDBCursor()
{
+ handleBlobAcks();
}
PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value, ExceptionState& exceptionState)
@@ -320,19 +321,21 @@ ScriptValue IDBCursor::value(ExecutionContext* context)
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(&requestState, m_value, m_primaryKey, metadata.keyPath);
+ assertPrimaryKeyValidOrInjectable(&requestState, 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(&requestState, value);
+ ScriptValue scriptValue = idbAnyToScriptValue(&requestState, value);
+ handleBlobAcks();
+ return scriptValue;
}
-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<BlobInfo> > blobInfo)
{
m_key = key;
m_keyDirty = true;
@@ -342,6 +345,7 @@ void IDBCursor::setValueReady(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primary
if (isCursorWithValue()) {
m_value = value;
+ m_blobInfo = blobInfo;
m_valueDirty = true;
}
@@ -363,6 +367,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());
+ m_blobInfo.clear();
+ }
+}
+
IndexedDB::CursorDirection IDBCursor::stringToDirection(const String& directionString, ExceptionState& exceptionState)
{
if (directionString.isNull() || directionString == IDBCursor::directionNext())

Powered by Google App Engine
This is Rietveld 408576698