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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBTestHelper.cpp

Issue 2867693004: Snapshot of all changes to get jumbo in blink and content.
Patch Set: Rebased again Created 3 years, 5 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: third_party/WebKit/Source/modules/indexeddb/IDBTestHelper.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTestHelper.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTestHelper.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..2e79ccf4cf320af7de108a962a233f44192f4f6e
--- /dev/null
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBTestHelper.cpp
@@ -0,0 +1,48 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "modules/indexeddb/IDBTestHelper.h"
+
+#include <utility>
+#include "modules/indexeddb/IDBKey.h"
+#include "modules/indexeddb/IDBKeyPath.h"
+#include "modules/indexeddb/IDBValueWrapping.h"
+#include "platform/SharedBuffer.h"
+#include "platform/blob/BlobData.h"
+#include "platform/wtf/Vector.h"
+#include "public/platform/WebBlobInfo.h"
+
+namespace blink {
+
+RefPtr<IDBValue> CreateIDBValueForTesting(v8::Isolate* isolate,
+ bool create_wrapped_value) {
+ size_t element_count = create_wrapped_value ? 16 : 2;
+ v8::Local<v8::Array> v8_array = v8::Array::New(isolate, element_count);
+ for (size_t i = 0; i < element_count; ++i)
+ v8_array->Set(i, v8::True(isolate));
+
+ NonThrowableExceptionState non_throwable_exception_state;
+ IDBValueWrapper wrapper(isolate, v8_array,
+ SerializedScriptValue::SerializeOptions::kSerialize,
+ non_throwable_exception_state);
+ wrapper.WrapIfBiggerThan(create_wrapped_value ? 0 : 1024 * element_count);
+
+ std::unique_ptr<Vector<RefPtr<BlobDataHandle>>> blob_data_handles =
+ WTF::MakeUnique<Vector<RefPtr<BlobDataHandle>>>();
+ wrapper.ExtractBlobDataHandles(blob_data_handles.get());
+ Vector<WebBlobInfo>& blob_infos = wrapper.WrappedBlobInfo();
+ RefPtr<SharedBuffer> wrapped_marker_buffer = wrapper.ExtractWireBytes();
+ IDBKey* key = IDBKey::CreateNumber(42.0);
+ IDBKeyPath key_path(String("primaryKey"));
+
+ RefPtr<IDBValue> idb_value = IDBValue::Create(
+ std::move(wrapped_marker_buffer), std::move(blob_data_handles),
+ WTF::MakeUnique<Vector<WebBlobInfo>>(blob_infos), key, key_path);
+
+ DCHECK_EQ(create_wrapped_value,
+ IDBValueUnwrapper::IsWrapped(idb_value.Get()));
+ return idb_value;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698