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

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

Issue 235933013: Add the backchannel for Blobs to be received into Blink from the database backend. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove accidentally-included files Created 6 years, 8 months 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 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())

Powered by Google App Engine
This is Rietveld 408576698