Expose the ValueSerializer data format version as a compile-time constant.

BUG=chromium:704293

Review-Url: https://codereview.chromium.org/2804643006
Cr-Commit-Position: refs/heads/master@{#44945}
This commit is contained in:
jbroman 2017-04-27 08:14:41 -07:00 committed by Commit bot
parent 5317d43e0c
commit a16c3c9105
7 changed files with 29 additions and 14 deletions

View File

@ -1012,6 +1012,7 @@ v8_header_set("v8_version") {
configs = [ ":internal_config" ]
sources = [
"include/v8-value-serializer-version.h",
"include/v8-version-string.h",
"include/v8-version.h",
]

View File

@ -0,0 +1,24 @@
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* Compile-time constants.
*
* This header provides access to information about the value serializer at
* compile time, without declaring or defining any symbols that require linking
* to V8.
*/
#ifndef INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_
#define INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_
#include <stdint.h>
namespace v8 {
constexpr uint32_t CurrentValueSerializerFormatVersion() { return 13; }
} // namespace v8
#endif // INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_

View File

@ -1793,8 +1793,6 @@ class V8_EXPORT ValueSerializer {
virtual void FreeBufferMemory(void* buffer);
};
static uint32_t GetCurrentDataFormatVersion();
explicit ValueSerializer(Isolate* isolate);
ValueSerializer(Isolate* isolate, Delegate* delegate);
~ValueSerializer();

View File

@ -3215,11 +3215,6 @@ struct ValueSerializer::PrivateData {
i::ValueSerializer serializer;
};
// static
uint32_t ValueSerializer::GetCurrentDataFormatVersion() {
return i::ValueSerializer::GetCurrentDataFormatVersion();
}
ValueSerializer::ValueSerializer(Isolate* isolate)
: ValueSerializer(isolate, nullptr) {}

View File

@ -389,6 +389,7 @@
'../include/v8-profiler.h',
'../include/v8-testing.h',
'../include/v8-util.h',
'../include/v8-value-serializer-version.h',
'../include/v8-version-string.h',
'../include/v8-version.h',
'../include/v8.h',

View File

@ -6,6 +6,7 @@
#include <type_traits>
#include "include/v8-value-serializer-version.h"
#include "src/base/logging.h"
#include "src/conversions.h"
#include "src/factory.h"
@ -30,6 +31,8 @@ namespace internal {
// Version 13: host objects have an explicit tag (rather than handling all
// unknown tags)
static const uint32_t kLatestVersion = 13;
static_assert(kLatestVersion == v8::CurrentValueSerializerFormatVersion(),
"Exported format version must match latest version.");
static const int kPretenureThreshold = 100 * KB;
@ -154,11 +157,6 @@ enum class WasmEncodingTag : uint8_t {
} // namespace
// static
uint32_t ValueSerializer::GetCurrentDataFormatVersion() {
return kLatestVersion;
}
ValueSerializer::ValueSerializer(Isolate* isolate,
v8::ValueSerializer::Delegate* delegate)
: isolate_(isolate),

View File

@ -43,8 +43,6 @@ enum class SerializationTag : uint8_t;
*/
class ValueSerializer {
public:
static uint32_t GetCurrentDataFormatVersion();
ValueSerializer(Isolate* isolate, v8::ValueSerializer::Delegate* delegate);
~ValueSerializer();