| Index: third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
|
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
|
| index 48e4aa7be38f52b9f7ea39bc4ff7e0781b3c1404..8156154bfdc47fcf50bb92b8dc8b91ec26d3d929 100644
|
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
|
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
|
| @@ -41,8 +41,10 @@
|
| #include "modules/indexeddb/IDBDatabase.h"
|
| #include "modules/indexeddb/IDBKeyPath.h"
|
| #include "modules/indexeddb/IDBTracing.h"
|
| +#include "modules/indexeddb/IDBValueWrapper.h"
|
| #include "platform/Histogram.h"
|
| #include "platform/SharedBuffer.h"
|
| +#include "platform/wtf/RefPtr.h"
|
| #include "public/platform/WebBlobInfo.h"
|
| #include "public/platform/WebData.h"
|
| #include "public/platform/WebVector.h"
|
| @@ -418,14 +420,10 @@ IDBRequest* IDBObjectStore::put(ScriptState* script_state,
|
|
|
| v8::Isolate* isolate = script_state->GetIsolate();
|
| DCHECK(isolate->InContext());
|
| - Vector<WebBlobInfo> blob_info;
|
| - SerializedScriptValue::SerializeOptions options;
|
| - options.blob_info = &blob_info;
|
| - options.write_wasm_to_stream =
|
| + bool write_wasm_to_stream =
|
| ExecutionContext::From(script_state)->IsSecureContext();
|
| - RefPtr<SerializedScriptValue> serialized_value =
|
| - SerializedScriptValue::Serialize(isolate, value.V8Value(), options,
|
| - exception_state);
|
| + IDBValueWrapper value_wrapper(isolate, value.V8Value(), write_wasm_to_stream,
|
| + exception_state);
|
| if (exception_state.HadException())
|
| return nullptr;
|
|
|
| @@ -449,9 +447,8 @@ IDBRequest* IDBObjectStore::put(ScriptState* script_state,
|
| // value.
|
| if (put_mode == kWebIDBPutModeCursorUpdate && uses_in_line_keys) {
|
| DCHECK(key);
|
| - if (clone.IsEmpty())
|
| - clone = DeserializeScriptValue(script_state, serialized_value.Get(),
|
| - &blob_info);
|
| + DCHECK(clone.IsEmpty());
|
| + value_wrapper.Clone(script_state, &clone);
|
| IDBKey* key_path_key = ScriptValue::To<IDBKey*>(
|
| script_state->GetIsolate(), clone, exception_state, key_path);
|
| if (exception_state.HadException())
|
| @@ -474,10 +471,8 @@ IDBRequest* IDBObjectStore::put(ScriptState* script_state,
|
| return nullptr;
|
| }
|
| if (uses_in_line_keys) {
|
| - if (clone.IsEmpty()) {
|
| - clone = DeserializeScriptValue(script_state, serialized_value.Get(),
|
| - &blob_info);
|
| - }
|
| + if (clone.IsEmpty())
|
| + value_wrapper.Clone(script_state, &clone);
|
| IDBKey* key_path_key = ScriptValue::To<IDBKey*>(
|
| script_state->GetIsolate(), clone, exception_state, key_path);
|
| if (exception_state.HadException())
|
| @@ -531,10 +526,8 @@ IDBRequest* IDBObjectStore::put(ScriptState* script_state,
|
| Vector<int64_t> index_ids;
|
| HeapVector<IndexKeys> index_keys;
|
| for (const auto& it : Metadata().indexes) {
|
| - if (clone.IsEmpty()) {
|
| - clone = DeserializeScriptValue(script_state, serialized_value.Get(),
|
| - &blob_info);
|
| - }
|
| + if (clone.IsEmpty())
|
| + value_wrapper.Clone(script_state, &clone);
|
| IndexKeys keys;
|
| GenerateIndexKeysForValue(script_state->GetIsolate(), *it.value, clone,
|
| &keys);
|
| @@ -544,14 +537,14 @@ IDBRequest* IDBObjectStore::put(ScriptState* script_state,
|
|
|
| IDBRequest* request =
|
| IDBRequest::Create(script_state, source, transaction_.Get());
|
| - Vector<char> wire_bytes;
|
| - serialized_value->ToWireBytes(wire_bytes);
|
| - RefPtr<SharedBuffer> value_buffer = SharedBuffer::AdoptVector(wire_bytes);
|
| -
|
| - BackendDB()->Put(transaction_->Id(), Id(), WebData(value_buffer), blob_info,
|
| - key, static_cast<WebIDBPutMode>(put_mode),
|
| - request->CreateWebCallbacks().release(), index_ids,
|
| - index_keys);
|
| +
|
| + value_wrapper.WrapIfBiggerThan(IDBValueWrapper::kWrapThreshold);
|
| +
|
| + BackendDB()->Put(
|
| + transaction_->Id(), Id(), WebData(value_wrapper.ExtractWireBytes()),
|
| + value_wrapper.WrappedBlobInfo(), key,
|
| + static_cast<WebIDBPutMode>(put_mode),
|
| + request->CreateWebCallbacks().release(), index_ids, index_keys);
|
| return request;
|
| }
|
|
|
|
|