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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp

Issue 2809773003: [SharedArrayBuffer] Throw DataClone error if SharedArrayBuffer can't be sent (Closed)
Patch Set: Created 3 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
Index: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
index 8efc23cd4283067ed3ef31ede6ae472dd36ef848..0d6e8860e7ce77ffb7a1de7f6aee35bf04f430b4 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
@@ -30,6 +30,7 @@
#include "bindings/core/v8/SerializedScriptValue.h"
+#include <algorithm>
#include <memory>
#include "bindings/core/v8/DOMDataStore.h"
#include "bindings/core/v8/DOMWrapperWorld.h"
@@ -363,6 +364,21 @@ bool SerializedScriptValue::ExtractTransferables(
return true;
}
+ArrayBufferArray SerializedScriptValue::ExtractNonSharedArrayBuffers(
+ Transferables& transferables) {
+ ArrayBufferArray& array_buffers = transferables.array_buffers;
+ ArrayBufferArray result;
+ auto non_shared_begin =
+ std::partition(array_buffers.begin(), array_buffers.end(),
+ [](Member<DOMArrayBufferBase>& array_buffer) {
+ return array_buffer->IsShared();
+ });
+ result.AppendRange(non_shared_begin, array_buffers.end());
+ array_buffers.erase(non_shared_begin - array_buffers.begin(),
+ array_buffers.end() - non_shared_begin);
+ return result;
+}
+
std::unique_ptr<SerializedScriptValue::ArrayBufferContentsArray>
SerializedScriptValue::TransferArrayBufferContents(
v8::Isolate* isolate,

Powered by Google App Engine
This is Rietveld 408576698