Chromium Code Reviews| 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(); |
| } |