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

Unified Diff: Source/web/IDBDatabaseBackendProxy.cpp

Issue 18590006: Blob support for IDB [Blink] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Merge fixes [builds, untested] Created 7 years, 3 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/web/IDBDatabaseBackendProxy.cpp
diff --git a/Source/web/IDBDatabaseBackendProxy.cpp b/Source/web/IDBDatabaseBackendProxy.cpp
index 0680198a98a3aca59392e6aebbb9d0518dfcc9f0..e65409acab417a2e09927a88f73456204c618d4d 100644
--- a/Source/web/IDBDatabaseBackendProxy.cpp
+++ b/Source/web/IDBDatabaseBackendProxy.cpp
@@ -34,6 +34,7 @@
#include "modules/indexeddb/IDBDatabaseCallbacks.h"
#include "modules/indexeddb/IDBKeyRange.h"
#include "modules/indexeddb/IDBMetadata.h"
+#include "public/platform/WebBlobInfo.h"
#include "public/platform/WebData.h"
#include "public/platform/WebIDBCursor.h"
#include "public/platform/WebIDBDatabase.h"
@@ -103,10 +104,20 @@ void IDBDatabaseBackendProxy::get(int64_t transactionId, int64_t objectStoreId,
m_webIDBDatabase->get(transactionId, objectStoreId, indexId, keyRange, keyOnly, new WebIDBCallbacksImpl(callbacks));
}
-void IDBDatabaseBackendProxy::put(int64_t transactionId, int64_t objectStoreId, PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
+void IDBDatabaseBackendProxy::put(int64_t transactionId, int64_t objectStoreId, PassRefPtr<SharedBuffer> value, const Vector<WebCore::BlobInfo>* blobInfo, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
{
if (m_webIDBDatabase) {
- m_webIDBDatabase->put(transactionId, objectStoreId, WebData(value), key, static_cast<WebIDBDatabase::PutMode>(putMode), new WebIDBCallbacksImpl(callbacks), indexIds, indexKeys);
+ size_t blobCount = blobInfo ? blobInfo->size() : 0;
+ WebVector<WebBlobInfo> webBlobInfo(blobCount);
+ for (size_t i = 0; i < blobCount; ++i) {
+ const WebCore::BlobInfo& info = (*blobInfo)[i];
+ if (info.isFile())
+ webBlobInfo[i] = WebBlobInfo(WebString(), info.filePath(), info.fileName(), info.type());
+ else
+ webBlobInfo[i] = WebBlobInfo(info.url(), info.type(), info.size());
+ }
+
+ m_webIDBDatabase->put(transactionId, objectStoreId, WebData(value), webBlobInfo, key, static_cast<WebIDBDatabase::PutMode>(putMode), new WebIDBCallbacksImpl(callbacks), indexIds, indexKeys);
}
}

Powered by Google App Engine
This is Rietveld 408576698