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

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

Issue 266583002: Switch WebIDBDatabase::put over to the version with blobs. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update calls. 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
« no previous file with comments | « no previous file | Source/modules/indexeddb/WebIDBCallbacksImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/indexeddb/IDBObjectStore.cpp
diff --git a/Source/modules/indexeddb/IDBObjectStore.cpp b/Source/modules/indexeddb/IDBObjectStore.cpp
index 0ff9486ac70dc8db55c1d7cecb96e0bb921d4a95..0d355d1d482fb0035253f824ca15d3beb621be51 100644
--- a/Source/modules/indexeddb/IDBObjectStore.cpp
+++ b/Source/modules/indexeddb/IDBObjectStore.cpp
@@ -40,13 +40,17 @@
#include "modules/indexeddb/IDBTracing.h"
#include "modules/indexeddb/WebIDBCallbacksImpl.h"
#include "platform/SharedBuffer.h"
+#include "public/platform/WebBlobInfo.h"
#include "public/platform/WebData.h"
#include "public/platform/WebIDBKey.h"
#include "public/platform/WebIDBKeyRange.h"
+#include "public/platform/WebVector.h"
+using blink::WebBlobInfo;
using blink::WebIDBCallbacks;
using blink::WebIDBCursor;
using blink::WebIDBDatabase;
+using blink::WebVector;
namespace WebCore {
@@ -169,15 +173,19 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi
return nullptr;
}
- RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(value, 0, exceptionState, toIsolate(executionContext));
+ Vector<WebBlobInfo> blobInfo;
+
+ RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(value, &blobInfo, exceptionState, toIsolate(executionContext));
if (exceptionState.hadException())
return nullptr;
+
jsbell 2014/04/30 21:38:33 remove extra blank line
ericu 2014/04/30 22:30:44 Done.
if (serializedValue->containsBlobs()) {
// FIXME: Add Blob/File/FileList support
exceptionState.throwDOMException(DataCloneError, "The object store currently does not support blob values.");
return nullptr;
}
+ ASSERT(blobInfo.isEmpty());
const IDBKeyPath& keyPath = m_metadata.keyPath;
const bool usesInLineKeys = !keyPath.isNull();
@@ -233,7 +241,17 @@ PassRefPtrWillBeRawPtr<IDBRequest> IDBObjectStore::put(ExecutionContext* executi
Vector<char> wireBytes;
serializedValue->toWireBytes(wireBytes);
RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes);
- backendDB()->put(m_transaction->id(), id(), blink::WebData(valueBuffer), key.release(), static_cast<WebIDBDatabase::PutMode>(putMode), WebIDBCallbacksImpl::create(request).leakPtr(), indexIds, indexKeys);
+
+ WebVector<WebBlobInfo> webBlobInfo(blobInfo.size());
+ for (size_t i = 0; i < blobInfo.size(); ++i) {
+ const WebBlobInfo& info = blobInfo[i];
+ if (info.isFile())
jsbell 2014/04/30 21:38:33 Move this to a WebBlobInfo(const WebBlobInfo&) con
ericu 2014/04/30 22:30:44 Heh; it turns out that this dates back to when I w
+ webBlobInfo[i] = WebBlobInfo(info.uuid(), info.filePath(), info.fileName(), info.type());
+ else
+ webBlobInfo[i] = WebBlobInfo(info.uuid(), info.type(), info.size());
+ }
+
+ backendDB()->put(m_transaction->id(), id(), blink::WebData(valueBuffer), webBlobInfo, key.release(), static_cast<WebIDBDatabase::PutMode>(putMode), WebIDBCallbacksImpl::create(request).leakPtr(), indexIds, indexKeys);
return request.release();
}
« no previous file with comments | « no previous file | Source/modules/indexeddb/WebIDBCallbacksImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698