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

Unified Diff: third_party/WebKit/Source/bindings/modules/v8/V8BindingForModulesTest.cpp

Issue 2803593005: Avoid unnecessary byte-swapping in blink's SerializedScriptValue. (Closed)
Patch Set: Rebased past the Blink rename. 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/modules/v8/V8BindingForModulesTest.cpp
diff --git a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModulesTest.cpp b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModulesTest.cpp
index 41c3b52732e281091d09e7a597d702b6f68598d3..c871b236c4b9d2095d0ad2721f923d899c769c93 100644
--- a/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModulesTest.cpp
+++ b/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModulesTest.cpp
@@ -132,15 +132,10 @@ void CheckKeyPathNumberValue(v8::Isolate* isolate,
// SerializedScriptValue header format offsets are inferred from the Blink and
// V8 serialization code. The code below DCHECKs that
-constexpr static size_t kSSVHeaderBlinkVersionOffset = 0;
-constexpr static size_t kSSVHeaderBlinkVersionTagOffset = 1;
-constexpr static size_t kSSVHeaderV8VersionOffset = 2;
-constexpr static size_t kSSVHeaderV8VersionTagOffset = 3;
-
-// 13 is v8::internal::kLatestVersion in v8/src/value-serializer.cc at the
-// time when this test was written. Unlike Blink, V8 does not currently export
-// its serialization version, so this number might get stale.
-constexpr static unsigned char kV8LatestKnownVersion = 13;
+constexpr static size_t kSSVHeaderBlinkVersionTagOffset = 0;
+constexpr static size_t kSSVHeaderBlinkVersionOffset = 1;
jsbell 2017/04/10 22:49:39 Should we note that versions are (now) varints, so
pwnall 2017/04/11 19:10:55 Ack. The versions were always varints, at least as
jsbell 2017/04/11 20:37:36 SGTM. (I was just thinking about adding a comment,
+constexpr static size_t kSSVHeaderV8VersionTagOffset = 2;
+constexpr static size_t kSSVHeaderV8VersionOffset = 3;
// Follows the same steps as the IndexedDB value serialization code.
void SerializeV8Value(v8::Local<v8::Value> value,
@@ -162,16 +157,16 @@ void SerializeV8Value(v8::Local<v8::Value> value,
// 0xFF.
const unsigned char* wire_data =
reinterpret_cast<unsigned char*>(wire_bytes->Data());
+ ASSERT_EQ(static_cast<unsigned char>(kVersionTag),
+ wire_data[kSSVHeaderBlinkVersionTagOffset]);
ASSERT_EQ(
static_cast<unsigned char>(SerializedScriptValue::kWireFormatVersion),
wire_data[kSSVHeaderBlinkVersionOffset]);
- ASSERT_EQ(static_cast<unsigned char>(kVersionTag),
- wire_data[kSSVHeaderBlinkVersionTagOffset]);
- ASSERT_GE(static_cast<unsigned char>(kV8LatestKnownVersion),
- wire_data[kSSVHeaderV8VersionOffset]);
ASSERT_EQ(static_cast<unsigned char>(kVersionTag),
wire_data[kSSVHeaderV8VersionTagOffset]);
+ ASSERT_EQ(v8::ValueSerializer::GetCurrentDataFormatVersion(),
+ wire_data[kSSVHeaderV8VersionOffset]);
}
PassRefPtr<IDBValue> CreateIDBValue(v8::Isolate* isolate,

Powered by Google App Engine
This is Rietveld 408576698