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

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

Issue 2857303003: History API throws when serializing a SharedArrayBuffer (Closed)
Patch Set: use enum class instead of bool Created 3 years, 7 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.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
index c3d560af4c9ea207f330b55c230ae529463281fa..319fd811210c53200f04d483bbab30022d58d01c 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h
@@ -90,14 +90,24 @@ class CORE_EXPORT SerializedScriptValue
// has been the cause of at least one bug in the past.
static constexpr uint32_t kWireFormatVersion = 17;
+ // This enumeration specifies whether we're serializing a value for storage;
+ // e.g. when writing to IndexedDB.
+ enum class SerializeForStorage {
+ kNo,
jbroman 2017/05/08 14:34:01 nit: I'd prefer to call these something besides "y
jsbell 2017/05/08 19:27:03 We should note (via comment) that this flag - what
binji 2017/05/09 01:07:08 Done.
+ kYes,
+ };
+
struct SerializeOptions {
STACK_ALLOCATED();
+
+ SerializeOptions() {}
+ explicit SerializeOptions(SerializeForStorage for_storage)
+ : for_storage(for_storage) {}
+
Transferables* transferables = nullptr;
WebBlobInfoArray* blob_info = nullptr;
bool write_wasm_to_stream = false;
- // Set when serializing a value for storage; e.g. when writing to
- // IndexedDB.
- bool for_storage = false;
+ SerializeForStorage for_storage = SerializeForStorage::kNo;
};
static PassRefPtr<SerializedScriptValue> Serialize(v8::Isolate*,
v8::Local<v8::Value>,
@@ -231,10 +241,10 @@ struct NativeValueTraits<SerializedScriptValue>
CORE_EXPORT static inline PassRefPtr<SerializedScriptValue> NativeValue(
v8::Isolate* isolate,
v8::Local<v8::Value> value,
+ const SerializedScriptValue::SerializeOptions& options,
ExceptionState& exception_state) {
- return SerializedScriptValue::Serialize(
- isolate, value, SerializedScriptValue::SerializeOptions(),
- exception_state);
+ return SerializedScriptValue::Serialize(isolate, value, options,
+ exception_state);
}
};

Powered by Google App Engine
This is Rietveld 408576698