e23acaaf90
Test Plan: Make vm-kernel-precomp-obfuscate-linux-release-x64-try green, ensuring status file changes reflect design gaps and not bugs. Tested locally that obfuscated Flutter Gallery runs. Change-Id: Ifcdc334de58f43c310e15b58dbcf6fe1597206f2 Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-obfuscate-linux-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/81009 Commit-Queue: Samir Jindel <sjindel@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
50 lines
1.5 KiB
Dart
50 lines
1.5 KiB
Dart
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
library vm.metadata.obfuscation_prohibitions;
|
|
|
|
import 'package:kernel/ast.dart';
|
|
|
|
class ObfuscationProhibitionsMetadata {
|
|
final Set<String> protectedNames = Set<String>();
|
|
|
|
ObfuscationProhibitionsMetadata();
|
|
|
|
@override
|
|
String toString() => protectedNames.toString();
|
|
}
|
|
|
|
/// Repository for [ObfuscationProhibitionsMetadata].
|
|
class ObfuscationProhibitionsMetadataRepository
|
|
extends MetadataRepository<ObfuscationProhibitionsMetadata> {
|
|
static final repositoryTag = 'vm.obfuscation-prohibitions.metadata';
|
|
|
|
@override
|
|
final String tag = repositoryTag;
|
|
|
|
@override
|
|
final Map<TreeNode, ObfuscationProhibitionsMetadata> mapping =
|
|
<TreeNode, ObfuscationProhibitionsMetadata>{};
|
|
|
|
@override
|
|
void writeToBinary(
|
|
ObfuscationProhibitionsMetadata metadata, Node node, BinarySink sink) {
|
|
sink.writeUInt32(metadata.protectedNames.length);
|
|
for (String name in metadata.protectedNames) {
|
|
sink.writeStringReference(name);
|
|
}
|
|
}
|
|
|
|
@override
|
|
ObfuscationProhibitionsMetadata readFromBinary(
|
|
Node node, BinarySource source) {
|
|
final metadata = ObfuscationProhibitionsMetadata();
|
|
int length = source.readUint32();
|
|
for (int i = 0; i < length; ++i) {
|
|
metadata.protectedNames.add(source.readStringReference());
|
|
}
|
|
return metadata;
|
|
}
|
|
}
|