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

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

Issue 2803593005: Avoid unnecessary byte-swapping in blink's SerializedScriptValue. (Closed)
Patch Set: Correct handling for SSV version 0. 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // Version 3: Switched to using uuids as blob data identifiers. 68 // Version 3: Switched to using uuids as blob data identifiers.
69 // Version 4: Extended File serialization to be complete. 69 // Version 4: Extended File serialization to be complete.
70 // Version 5: Added CryptoKeyTag for Key objects. 70 // Version 5: Added CryptoKeyTag for Key objects.
71 // Version 6: Added indexed serialization for File, Blob, and FileList. 71 // Version 6: Added indexed serialization for File, Blob, and FileList.
72 // Version 7: Extended File serialization with user visibility. 72 // Version 7: Extended File serialization with user visibility.
73 // Version 8: File.lastModified in milliseconds (seconds-based in earlier 73 // Version 8: File.lastModified in milliseconds (seconds-based in earlier
74 // versions.) 74 // versions.)
75 // Version 9: Added Map and Set support. 75 // Version 9: Added Map and Set support.
76 // [versions skipped] 76 // [versions skipped]
77 // Version 16: Separate versioning between V8 and Blink. 77 // Version 16: Separate versioning between V8 and Blink.
78 static const uint32_t wireFormatVersion = 16; 78 // Version 17: Remove unnecessary byte flipping in wire format.
79 //
80 // The following versions cannot be used, in order to be able to
81 // deserialize version 0 SSVs. The class implementation has details.
82 // DO NOT USE: 35, 64, 68, 73, 78, 82, 83, 85, 91, 98, 102, 108, 123.
jsbell 2017/04/07 23:40:34 static_assert() please!
pwnall 2017/04/08 01:09:08 Done. Thanks for the suggestion! That's a great id
83 static const uint32_t wireFormatVersion = 17;
79 84
80 struct SerializeOptions { 85 struct SerializeOptions {
81 STACK_ALLOCATED(); 86 STACK_ALLOCATED();
82 Transferables* transferables = nullptr; 87 Transferables* transferables = nullptr;
83 WebBlobInfoArray* blobInfo = nullptr; 88 WebBlobInfoArray* blobInfo = nullptr;
84 bool writeWasmToStream = false; 89 bool writeWasmToStream = false;
85 }; 90 };
86 static PassRefPtr<SerializedScriptValue> serialize(v8::Isolate*, 91 static PassRefPtr<SerializedScriptValue> serialize(v8::Isolate*,
87 v8::Local<v8::Value>, 92 v8::Local<v8::Value>,
88 const SerializeOptions&, 93 const SerializeOptions&,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 ExceptionState& exceptionState) { 223 ExceptionState& exceptionState) {
219 return SerializedScriptValue::serialize( 224 return SerializedScriptValue::serialize(
220 isolate, value, SerializedScriptValue::SerializeOptions(), 225 isolate, value, SerializedScriptValue::SerializeOptions(),
221 exceptionState); 226 exceptionState);
222 } 227 }
223 }; 228 };
224 229
225 } // namespace blink 230 } // namespace blink
226 231
227 #endif // SerializedScriptValue_h 232 #endif // SerializedScriptValue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698