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

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

Issue 2755383004: Encapsulate optional SerializedScriptValue serialize/deserialize parameters. (Closed)
Patch Set: fuzzer Created 3 years, 9 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 | third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
index ea223805e180c5d4a0ef89b3768903d0a13bfdf1..2317349b8a006cfadb5d890e5af3578bdc8ee599 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
@@ -38,6 +38,7 @@
#include "bindings/core/v8/Transferables.h"
#include "core/CoreExport.h"
#include "v8/include/v8.h"
+#include "wtf/Allocator.h"
#include "wtf/HashMap.h"
#include "wtf/ThreadSafeRefCounted.h"
#include "wtf/allocator/Partitions.h"
@@ -76,10 +77,14 @@ class CORE_EXPORT SerializedScriptValue
static const int varIntShift = 7;
static const int varIntMask = (1 << varIntShift) - 1;
+ struct SerializeOptions {
+ STACK_ALLOCATED();
+ Transferables* transferables = nullptr;
+ WebBlobInfoArray* blobInfo = nullptr;
+ };
static PassRefPtr<SerializedScriptValue> serialize(v8::Isolate*,
v8::Local<v8::Value>,
- Transferables*,
- WebBlobInfoArray*,
+ const SerializeOptions&,
ExceptionState&);
static PassRefPtr<SerializedScriptValue> serializeAndSwallowExceptions(
v8::Isolate*,
@@ -99,9 +104,15 @@ class CORE_EXPORT SerializedScriptValue
// Deserializes the value (in the current context). Returns a null value in
// case of failure.
- v8::Local<v8::Value> deserialize(v8::Isolate*,
- MessagePortArray* = 0,
- const WebBlobInfoArray* = 0);
+ struct DeserializeOptions {
+ STACK_ALLOCATED();
+ MessagePortArray* messagePorts = nullptr;
+ const WebBlobInfoArray* blobInfo = nullptr;
+ };
+ v8::Local<v8::Value> deserialize(v8::Isolate* isolate) {
+ return deserialize(isolate, DeserializeOptions());
+ }
+ v8::Local<v8::Value> deserialize(v8::Isolate*, const DeserializeOptions&);
// Helper function which pulls the values out of a JS sequence and into a
// MessagePortArray. Also validates the elements per sections 4.1.13 and
@@ -199,8 +210,9 @@ struct NativeValueTraits<SerializedScriptValue>
v8::Isolate* isolate,
v8::Local<v8::Value> value,
ExceptionState& exceptionState) {
- return SerializedScriptValue::serialize(isolate, value, nullptr, nullptr,
- exceptionState);
+ return SerializedScriptValue::serialize(
+ isolate, value, SerializedScriptValue::SerializeOptions(),
+ exceptionState);
}
};
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698