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

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

Issue 2847463002: Comment out the single use of v8::ValueSerializer::GetCurrentDataFormatVersion while it changes. (Closed)
Patch Set: unused constant 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 ASSERT_TRUE(idb_key); 128 ASSERT_TRUE(idb_key);
129 ASSERT_EQ(IDBKey::kNumberType, idb_key->GetType()); 129 ASSERT_EQ(IDBKey::kNumberType, idb_key->GetType());
130 ASSERT_TRUE(expected == idb_key->Number()); 130 ASSERT_TRUE(expected == idb_key->Number());
131 } 131 }
132 132
133 // SerializedScriptValue header format offsets are inferred from the Blink and 133 // SerializedScriptValue header format offsets are inferred from the Blink and
134 // V8 serialization code. The code below DCHECKs that 134 // V8 serialization code. The code below DCHECKs that
135 constexpr static size_t kSSVHeaderBlinkVersionTagOffset = 0; 135 constexpr static size_t kSSVHeaderBlinkVersionTagOffset = 0;
136 constexpr static size_t kSSVHeaderBlinkVersionOffset = 1; 136 constexpr static size_t kSSVHeaderBlinkVersionOffset = 1;
137 constexpr static size_t kSSVHeaderV8VersionTagOffset = 2; 137 constexpr static size_t kSSVHeaderV8VersionTagOffset = 2;
138 constexpr static size_t kSSVHeaderV8VersionOffset = 3; 138 // constexpr static size_t kSSVHeaderV8VersionOffset = 3;
139 139
140 // Follows the same steps as the IndexedDB value serialization code. 140 // Follows the same steps as the IndexedDB value serialization code.
141 void SerializeV8Value(v8::Local<v8::Value> value, 141 void SerializeV8Value(v8::Local<v8::Value> value,
142 v8::Isolate* isolate, 142 v8::Isolate* isolate,
143 Vector<char>* wire_bytes) { 143 Vector<char>* wire_bytes) {
144 NonThrowableExceptionState non_throwable_exception_state; 144 NonThrowableExceptionState non_throwable_exception_state;
145 145
146 SerializedScriptValue::SerializeOptions options; 146 SerializedScriptValue::SerializeOptions options;
147 RefPtr<SerializedScriptValue> serialized_value = 147 RefPtr<SerializedScriptValue> serialized_value =
148 SerializedScriptValue::Serialize(isolate, value, options, 148 SerializedScriptValue::Serialize(isolate, value, options,
149 non_throwable_exception_state); 149 non_throwable_exception_state);
150 serialized_value->ToWireBytes(*wire_bytes); 150 serialized_value->ToWireBytes(*wire_bytes);
151 151
152 // Sanity check that the serialization header has not changed, as the tests 152 // Sanity check that the serialization header has not changed, as the tests
153 // that use this method rely on the header format. 153 // that use this method rely on the header format.
154 // 154 //
155 // The cast from char* to unsigned char* is necessary to avoid VS2015 warning 155 // The cast from char* to unsigned char* is necessary to avoid VS2015 warning
156 // C4309 (truncation of constant value). This happens because VersionTag is 156 // C4309 (truncation of constant value). This happens because VersionTag is
157 // 0xFF. 157 // 0xFF.
158 const unsigned char* wire_data = 158 const unsigned char* wire_data =
159 reinterpret_cast<unsigned char*>(wire_bytes->data()); 159 reinterpret_cast<unsigned char*>(wire_bytes->data());
160 ASSERT_EQ(static_cast<unsigned char>(kVersionTag), 160 ASSERT_EQ(static_cast<unsigned char>(kVersionTag),
161 wire_data[kSSVHeaderBlinkVersionTagOffset]); 161 wire_data[kSSVHeaderBlinkVersionTagOffset]);
162 ASSERT_EQ( 162 ASSERT_EQ(
163 static_cast<unsigned char>(SerializedScriptValue::kWireFormatVersion), 163 static_cast<unsigned char>(SerializedScriptValue::kWireFormatVersion),
164 wire_data[kSSVHeaderBlinkVersionOffset]); 164 wire_data[kSSVHeaderBlinkVersionOffset]);
165 165
166 ASSERT_EQ(static_cast<unsigned char>(kVersionTag), 166 ASSERT_EQ(static_cast<unsigned char>(kVersionTag),
167 wire_data[kSSVHeaderV8VersionTagOffset]); 167 wire_data[kSSVHeaderV8VersionTagOffset]);
168 ASSERT_EQ(v8::ValueSerializer::GetCurrentDataFormatVersion(), 168 // TODO(jbroman): Use the compile-time constant for V8 data format version.
169 wire_data[kSSVHeaderV8VersionOffset]); 169 // ASSERT_EQ(v8::ValueSerializer::GetCurrentDataFormatVersion(),
170 // wire_data[kSSVHeaderV8VersionOffset]);
170 } 171 }
171 172
172 PassRefPtr<IDBValue> CreateIDBValue(v8::Isolate* isolate, 173 PassRefPtr<IDBValue> CreateIDBValue(v8::Isolate* isolate,
173 Vector<char>& wire_bytes, 174 Vector<char>& wire_bytes,
174 double primary_key, 175 double primary_key,
175 const WebString& key_path) { 176 const WebString& key_path) {
176 WebData web_data(SharedBuffer::AdoptVector(wire_bytes)); 177 WebData web_data(SharedBuffer::AdoptVector(wire_bytes));
177 Vector<WebBlobInfo> web_blob_info; 178 Vector<WebBlobInfo> web_blob_info;
178 WebIDBKey web_idb_key = WebIDBKey::CreateNumber(primary_key); 179 WebIDBKey web_idb_key = WebIDBKey::CreateNumber(primary_key);
179 WebIDBKeyPath web_idb_key_path(key_path); 180 WebIDBKeyPath web_idb_key_path(key_path);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 388
388 v8::Local<v8::Value> v8_value = DeserializeIDBValue( 389 v8::Local<v8::Value> v8_value = DeserializeIDBValue(
389 isolate, scope.GetContext()->Global(), idb_value.Get()); 390 isolate, scope.GetContext()->Global(), idb_value.Get());
390 EXPECT_TRUE(!scope.GetExceptionState().HadException()); 391 EXPECT_TRUE(!scope.GetExceptionState().HadException());
391 ASSERT_TRUE(v8_value->IsNumber()); 392 ASSERT_TRUE(v8_value->IsNumber());
392 v8::Local<v8::Number> v8_number = v8_value.As<v8::Number>(); 393 v8::Local<v8::Number> v8_number = v8_value.As<v8::Number>();
393 EXPECT_EQ(v8_number->Value(), 42.0); 394 EXPECT_EQ(v8_number->Value(), 42.0);
394 } 395 }
395 396
396 } // namespace blink 397 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698