Remove all infrastructure for the V8 natives blob
The V8 natives blob (natives_blob.bin) is unused and will shortly be removed in V8. This CL removes all related infrastructure in chromium. Specifically, this means that natives_blob.bin is no longer 1. generated during the build process, 2. installed on the target system, 3. loaded by chrome at runtime, and 4. passed to V8. Tbr: oksamyt@chromium.org Bug: v8:7624 Change-Id: I535d4308a8aa539c354a212174d47ade411bc89d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847217 Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Reviewed-by: Greg Thompson <grt@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#708094}
This commit is contained in:
android_webview
build/android/pylib/utils
chrome
content
app
ppapi_plugin
public
app
common
test
shell
test
extensions
gin
headless
media/blink
net/proxy_resolution
pdf
ppapi
c
private
cpp
proxy
tests
thunk
services/data_decoder
tools
binary_size
libsupersize
bisect_repackage
determinism
v8_context_snapshot
ui/android/java/src/org/chromium/ui/resources
@ -403,9 +403,6 @@ if (android_64bit_target_cpu) {
|
||||
renaming_sources = [ "$_secondary_abi_out_dir/v8_context_snapshot.bin" ]
|
||||
renaming_destinations = [ "v8_context_snapshot_$arch_suffix.bin" ]
|
||||
} else {
|
||||
sources = [
|
||||
"$root_out_dir/natives_blob.bin",
|
||||
]
|
||||
renaming_sources = [ "$_secondary_abi_out_dir/snapshot_blob.bin" ]
|
||||
renaming_destinations = [ "snapshot_blob_$arch_suffix.bin" ]
|
||||
}
|
||||
|
@ -141,9 +141,6 @@ bool AwMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
ui::GestureConfiguration::GetInstance()
|
||||
->set_fling_touchscreen_tap_suppression_enabled(false);
|
||||
|
||||
base::android::RegisterApkAssetWithFileDescriptorStore(
|
||||
content::kV8NativesDataDescriptor,
|
||||
gin::V8Initializer::GetNativesFilePath());
|
||||
#if defined(USE_V8_CONTEXT_SNAPSHOT)
|
||||
gin::V8Initializer::V8SnapshotFileType file_type =
|
||||
gin::V8Initializer::V8SnapshotFileType::kWithAdditionalContext;
|
||||
|
@ -27,7 +27,6 @@ _BLACKLIST = [
|
||||
re.compile(r'.*jni_generator_tests'),
|
||||
|
||||
# v8's blobs and icu data get packaged into APKs.
|
||||
re.compile(r'.*natives_blob.*\.bin'),
|
||||
re.compile(r'.*snapshot_blob.*\.bin'),
|
||||
re.compile(r'.*icudtl.bin'),
|
||||
|
||||
|
@ -894,7 +894,6 @@ if (is_win) {
|
||||
}
|
||||
|
||||
if (v8_use_external_startup_data) {
|
||||
sources += [ "$root_out_dir/natives_blob.bin" ]
|
||||
public_deps += [ "//v8" ]
|
||||
if (use_v8_context_snapshot) {
|
||||
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
|
@ -166,7 +166,6 @@ stage_install_common() {
|
||||
|
||||
# V8 snapshot files; Necessary when the GN v8_use_external_startup_data flag
|
||||
# is true.
|
||||
install -m 644 "${BUILDDIR}/natives_blob.bin" "${STAGEDIR}/${INSTALLDIR}/"
|
||||
# Use v8_context_snapshot.bin instead of snapshot_blob.bin if it is available.
|
||||
# TODO(crbug.com/764576): Unship snapshot_blob.bin on ChromeOS and drop this branch
|
||||
if [ -f "${BUILDDIR}/v8_context_snapshot.bin" ]; then
|
||||
|
@ -219,7 +219,6 @@ template("generate_mini_installer") {
|
||||
}
|
||||
|
||||
if (v8_use_external_startup_data) {
|
||||
inputs += [ "$root_out_dir/natives_blob.bin" ]
|
||||
deps += [ "//v8" ]
|
||||
if (use_v8_context_snapshot) {
|
||||
inputs += [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
|
@ -33,7 +33,6 @@ libGLESv2.dll: %(VersionDir)s\
|
||||
nacl64.exe: %(VersionDir)s\
|
||||
nacl_irt_x86_32.nexe: %(VersionDir)s\
|
||||
nacl_irt_x86_64.nexe: %(VersionDir)s\
|
||||
natives_blob.bin: %(VersionDir)s\
|
||||
notification_helper.exe: %(VersionDir)s\
|
||||
resources.pak: %(VersionDir)s\
|
||||
v8_context_snapshot.bin: %(VersionDir)s\
|
||||
|
@ -64,10 +64,6 @@ FILES = [
|
||||
'filename': 'locales',
|
||||
'buildtype': ['dev', 'official'],
|
||||
},
|
||||
{
|
||||
'filename': 'natives_blob.bin',
|
||||
'buildtype': ['dev', 'official'],
|
||||
},
|
||||
{
|
||||
'filename': 'snapshot_blob.bin',
|
||||
'buildtype': ['dev', 'official'],
|
||||
|
@ -63,10 +63,6 @@ FILES = [
|
||||
'filename': 'locales',
|
||||
'buildtype': ['dev', 'official'],
|
||||
},
|
||||
{
|
||||
'filename': 'natives_blob.bin',
|
||||
'buildtype': ['dev', 'official'],
|
||||
},
|
||||
{
|
||||
'filename': 'product_logo_48.png',
|
||||
'buildtype': ['dev', 'official'],
|
||||
@ -267,12 +263,6 @@ FILES = [
|
||||
'archive': 'content-shell.zip',
|
||||
'optional': ['dev'],
|
||||
},
|
||||
{
|
||||
'filename': 'natives_blob.bin',
|
||||
'buildtype': ['dev'],
|
||||
'archive': 'content-shell.zip',
|
||||
'optional': ['dev'],
|
||||
},
|
||||
{
|
||||
'filename': 'v8_context_snapshot.bin',
|
||||
'buildtype': ['dev'],
|
||||
|
@ -104,12 +104,6 @@ FILES = [
|
||||
'archive': 'content-shell.zip',
|
||||
'optional': ['dev'],
|
||||
},
|
||||
{
|
||||
'filename': 'natives_blob.bin',
|
||||
'buildtype': ['dev'],
|
||||
'archive': 'content-shell.zip',
|
||||
'optional': ['dev'],
|
||||
},
|
||||
{
|
||||
'filename': 'v8_context_snapshot.bin',
|
||||
'buildtype': ['dev'],
|
||||
|
@ -107,11 +107,6 @@ FILES = [
|
||||
'buildtype': ['dev', 'official'],
|
||||
'optional': ['dev', 'official'],
|
||||
},
|
||||
{
|
||||
'filename': 'natives_blob.bin',
|
||||
'buildtype': ['dev', 'official'],
|
||||
'optional': ['dev', 'official'],
|
||||
},
|
||||
{
|
||||
'filename': 'v8_context_snapshot.bin',
|
||||
'buildtype': ['dev', 'official'],
|
||||
@ -787,12 +782,6 @@ FILES = [
|
||||
'archive': 'content-shell.zip',
|
||||
'optional': ['dev'],
|
||||
},
|
||||
{
|
||||
'filename': 'natives_blob.bin',
|
||||
'buildtype': ['dev'],
|
||||
'archive': 'content-shell.zip',
|
||||
'optional': ['dev'],
|
||||
},
|
||||
{
|
||||
'filename': 'v8_context_snapshot.bin',
|
||||
'buildtype': ['dev'],
|
||||
|
@ -223,24 +223,6 @@ void LoadV8SnapshotFile() {
|
||||
gin::V8Initializer::LoadV8Snapshot(kSnapshotType);
|
||||
#endif // !CHROME_MULTIPLE_DLL_BROWSER
|
||||
}
|
||||
|
||||
void LoadV8NativesFile() {
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
base::FileDescriptorStore& file_descriptor_store =
|
||||
base::FileDescriptorStore::GetInstance();
|
||||
base::MemoryMappedFile::Region region;
|
||||
base::ScopedFD fd =
|
||||
file_descriptor_store.MaybeTakeFD(kV8NativesDataDescriptor, ®ion);
|
||||
if (fd.is_valid()) {
|
||||
base::File file(fd.release());
|
||||
gin::V8Initializer::LoadV8NativesFromFile(std::move(file), ®ion);
|
||||
return;
|
||||
}
|
||||
#endif // OS_POSIX && !OS_MACOSX
|
||||
#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif // !CHROME_MULTIPLE_DLL_BROWSER
|
||||
}
|
||||
#endif // V8_USE_EXTERNAL_STARTUP_DATA
|
||||
|
||||
void InitializeV8IfNeeded(const base::CommandLine& command_line,
|
||||
@ -250,7 +232,6 @@ void InitializeV8IfNeeded(const base::CommandLine& command_line,
|
||||
|
||||
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
|
||||
LoadV8SnapshotFile();
|
||||
LoadV8NativesFile();
|
||||
#endif // V8_USE_EXTERNAL_STARTUP_DATA
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,6 @@ int PpapiPluginMain(const MainFunctionParams& parameters) {
|
||||
|
||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||
gin::V8Initializer::LoadV8Snapshot();
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
|
@ -16,8 +16,6 @@ const service_manager::Manifest& GetV8SnapshotOverlayManifest() {
|
||||
static base::NoDestructor<service_manager::Manifest> manifest {
|
||||
service_manager::ManifestBuilder()
|
||||
#if defined(OS_LINUX)
|
||||
.PreloadFile(kV8NativesDataDescriptor,
|
||||
base::FilePath(FILE_PATH_LITERAL("natives_blob.bin")))
|
||||
#if defined(USE_V8_CONTEXT_SNAPSHOT)
|
||||
.PreloadFile(
|
||||
kV8ContextSnapshotDataDescriptor,
|
||||
@ -27,9 +25,6 @@ const service_manager::Manifest& GetV8SnapshotOverlayManifest() {
|
||||
base::FilePath(FILE_PATH_LITERAL("snapshot_blob.bin")))
|
||||
#endif // defined(USE_V8_CONTEXT_SNAPSHOT)
|
||||
#elif defined(OS_ANDROID)
|
||||
.PreloadFile(
|
||||
kV8NativesDataDescriptor,
|
||||
base::FilePath(FILE_PATH_LITERAL("assets/natives_blob.bin")))
|
||||
#if defined(USE_V8_CONTEXT_SNAPSHOT)
|
||||
#if defined(ARCH_CPU_64_BITS)
|
||||
.PreloadFile(kV8Snapshot64DataDescriptor,
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
namespace content {
|
||||
|
||||
const char kV8NativesDataDescriptor[] = "v8_natives_data";
|
||||
|
||||
const char kV8SnapshotDataDescriptor[] = "v8_snapshot_data";
|
||||
|
||||
const char kV8Snapshot32DataDescriptor[] = "v8_snapshot_32_data";
|
||||
|
@ -10,7 +10,6 @@ namespace content {
|
||||
// This is a list of global descriptor keys to be used with the
|
||||
// base::FileDescriptorStore object (see base/file_descriptor_store.h)
|
||||
|
||||
extern const char kV8NativesDataDescriptor[];
|
||||
extern const char kV8SnapshotDataDescriptor[];
|
||||
extern const char kV8Snapshot32DataDescriptor[];
|
||||
extern const char kV8Snapshot64DataDescriptor[];
|
||||
|
@ -383,7 +383,6 @@ void BrowserTestBase::SetUp() {
|
||||
|
||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||
gin::V8Initializer::LoadV8Snapshot();
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
|
||||
ContentMainDelegate* delegate = GetContentMainDelegateForTesting();
|
||||
|
@ -69,7 +69,6 @@ void ContentTestSuiteBase::Initialize() {
|
||||
|
||||
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
|
||||
gin::V8Initializer::LoadV8Snapshot(kSnapshotType);
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
|
||||
ui::MaterialDesignController::Initialize();
|
||||
|
@ -678,7 +678,6 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
if (v8_use_external_startup_data) {
|
||||
sources += [ "$root_out_dir/natives_blob.bin" ]
|
||||
public_deps += [ "//v8" ]
|
||||
if (use_v8_context_snapshot) {
|
||||
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
|
@ -42,7 +42,6 @@ Env::Env() {
|
||||
|
||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||
gin::V8Initializer::LoadV8Snapshot(kSnapshotType);
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
|
||||
gin::ArrayBufferAllocator::SharedInstance());
|
||||
|
@ -138,7 +138,6 @@ TestBlinkWebUnitTestSupport::TestBlinkWebUnitTestSupport(
|
||||
|
||||
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
|
||||
gin::V8Initializer::LoadV8Snapshot(kSnapshotType);
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
|
||||
scoped_refptr<base::SingleThreadTaskRunner> dummy_task_runner;
|
||||
|
@ -26,7 +26,6 @@ void APIBindingTest::SetUp() {
|
||||
// gin::V8Test.
|
||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||
gin::V8Initializer::LoadV8Snapshot();
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
|
||||
gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
|
||||
|
@ -290,8 +290,6 @@ test("app_shell_unittests") {
|
||||
data = [
|
||||
"//extensions/test/data/",
|
||||
"$root_out_dir/extensions_shell_and_test.pak",
|
||||
|
||||
#"$root_out_dir/natives_blob.bin", # move to gin
|
||||
]
|
||||
|
||||
deps = [
|
||||
|
@ -70,7 +70,6 @@ component("gin") {
|
||||
|
||||
if (v8_use_external_startup_data) {
|
||||
data = [
|
||||
"$root_out_dir/natives_blob.bin",
|
||||
"$root_out_dir/snapshot_blob.bin",
|
||||
]
|
||||
}
|
||||
|
@ -80,10 +80,7 @@ class GIN_EXPORT IsolateHolder {
|
||||
|
||||
// Should be invoked once before creating IsolateHolder instances to
|
||||
// initialize V8 and Gin. In case V8_USE_EXTERNAL_STARTUP_DATA is
|
||||
// defined, V8's initial natives should be loaded (by calling
|
||||
// V8Initializer::LoadV8NativesFromFD or
|
||||
// V8Initializer::LoadV8Natives) before calling this method. If the
|
||||
// snapshot file is available, it should also be loaded (by calling
|
||||
// defined and the snapshot file is available, it should be loaded (by calling
|
||||
// V8Initializer::LoadV8SnapshotFromFD or
|
||||
// V8Initializer::LoadV8Snapshot) before calling this method.
|
||||
// If the snapshot file contains customised contexts which have static
|
||||
|
@ -71,7 +71,6 @@ int main(int argc, char** argv) {
|
||||
base::i18n::InitializeICU();
|
||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||
gin::V8Initializer::LoadV8Snapshot();
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
|
||||
base::SingleThreadTaskExecutor main_thread_task_executor;
|
||||
|
@ -30,7 +30,6 @@ TEST(RunnerTest, Run) {
|
||||
|
||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||
gin::V8Initializer::LoadV8Snapshot();
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
|
||||
gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
|
||||
|
@ -23,7 +23,6 @@ V8Test::~V8Test() = default;
|
||||
void V8Test::SetUp() {
|
||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||
gin::V8Initializer::LoadV8Snapshot();
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
|
||||
gin::ArrayBufferAllocator::SharedInstance());
|
||||
|
@ -39,8 +39,7 @@ namespace gin {
|
||||
|
||||
namespace {
|
||||
|
||||
// None of these globals are ever freed nor closed.
|
||||
base::MemoryMappedFile* g_mapped_natives = nullptr;
|
||||
// This global is never freed nor closed.
|
||||
base::MemoryMappedFile* g_mapped_snapshot = nullptr;
|
||||
|
||||
bool GenerateEntropy(unsigned char* buffer, size_t amount) {
|
||||
@ -61,8 +60,6 @@ void GetMappedFileData(base::MemoryMappedFile* mapped_file,
|
||||
|
||||
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
|
||||
|
||||
const char kNativesFileName[] = "natives_blob.bin";
|
||||
|
||||
#if defined(OS_ANDROID)
|
||||
const char kV8ContextSnapshotFileName64[] = "v8_context_snapshot_64.bin";
|
||||
const char kV8ContextSnapshotFileName32[] = "v8_context_snapshot_32.bin";
|
||||
@ -100,9 +97,9 @@ void GetV8FilePath(const char* file_name, base::FilePath* path_out) {
|
||||
*path_out =
|
||||
base::FilePath(FILE_PATH_LITERAL("assets")).AppendASCII(file_name);
|
||||
#elif defined(OS_MACOSX)
|
||||
base::ScopedCFTypeRef<CFStringRef> natives_file_name(
|
||||
base::ScopedCFTypeRef<CFStringRef> bundle_resource(
|
||||
base::SysUTF8ToCFStringRef(file_name));
|
||||
*path_out = base::mac::PathForFrameworkBundleResource(natives_file_name);
|
||||
*path_out = base::mac::PathForFrameworkBundleResource(bundle_resource);
|
||||
#else
|
||||
base::FilePath data_path;
|
||||
bool r = base::PathService::Get(base::DIR_ASSETS, &data_path);
|
||||
@ -166,17 +163,6 @@ base::File OpenV8File(const char* file_name,
|
||||
}
|
||||
} else if (file.error_details() != base::File::FILE_ERROR_IN_USE) {
|
||||
result = OpenV8FileResult::FAILED_OTHER;
|
||||
#ifdef OS_WIN
|
||||
// TODO(oth): temporary diagnostics for http://crbug.com/479537
|
||||
std::string narrow(kNativesFileName);
|
||||
base::FilePath::StringType nativesBlob(narrow.begin(), narrow.end());
|
||||
if (path.BaseName().value() == nativesBlob) {
|
||||
base::File::Error file_error = file.error_details();
|
||||
base::debug::Alias(&file_error);
|
||||
LOG(FATAL) << "Failed to open V8 file '" << path.value()
|
||||
<< "' (reason: " << file.error_details() << ")";
|
||||
}
|
||||
#endif // OS_WIN
|
||||
break;
|
||||
} else if (kMaxOpenAttempts - 1 != attempt) {
|
||||
base::PlatformThread::Sleep(
|
||||
@ -266,10 +252,6 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) {
|
||||
}
|
||||
|
||||
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
|
||||
// TODO(v8:7624): Remove natives and all remaining infrastructure.
|
||||
v8::StartupData natives;
|
||||
GetMappedFileData(g_mapped_natives, &natives);
|
||||
|
||||
if (g_mapped_snapshot) {
|
||||
v8::StartupData snapshot;
|
||||
GetMappedFileData(g_mapped_snapshot, &snapshot);
|
||||
@ -284,22 +266,15 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) {
|
||||
}
|
||||
|
||||
// static
|
||||
void V8Initializer::GetV8ExternalSnapshotData(v8::StartupData* natives,
|
||||
v8::StartupData* snapshot) {
|
||||
GetMappedFileData(g_mapped_natives, natives);
|
||||
void V8Initializer::GetV8ExternalSnapshotData(v8::StartupData* snapshot) {
|
||||
GetMappedFileData(g_mapped_snapshot, snapshot);
|
||||
}
|
||||
|
||||
// static
|
||||
void V8Initializer::GetV8ExternalSnapshotData(const char** natives_data_out,
|
||||
int* natives_size_out,
|
||||
const char** snapshot_data_out,
|
||||
void V8Initializer::GetV8ExternalSnapshotData(const char** snapshot_data_out,
|
||||
int* snapshot_size_out) {
|
||||
v8::StartupData natives;
|
||||
v8::StartupData snapshot;
|
||||
GetV8ExternalSnapshotData(&natives, &snapshot);
|
||||
*natives_data_out = natives.data;
|
||||
*natives_size_out = natives.raw_size;
|
||||
GetV8ExternalSnapshotData(&snapshot);
|
||||
*snapshot_data_out = snapshot.data;
|
||||
*snapshot_size_out = snapshot.raw_size;
|
||||
}
|
||||
@ -320,16 +295,6 @@ void V8Initializer::LoadV8Snapshot(V8SnapshotFileType snapshot_file_type) {
|
||||
LoadV8SnapshotFromFile(std::move(file), &file_region, snapshot_file_type);
|
||||
}
|
||||
|
||||
// static
|
||||
void V8Initializer::LoadV8Natives() {
|
||||
if (g_mapped_natives)
|
||||
return;
|
||||
|
||||
base::MemoryMappedFile::Region file_region;
|
||||
base::File file = OpenV8File(kNativesFileName, &file_region);
|
||||
LoadV8NativesFromFile(std::move(file), &file_region);
|
||||
}
|
||||
|
||||
// static
|
||||
void V8Initializer::LoadV8SnapshotFromFile(
|
||||
base::File snapshot_file,
|
||||
@ -357,34 +322,7 @@ void V8Initializer::LoadV8SnapshotFromFile(
|
||||
V8_LOAD_MAX_VALUE);
|
||||
}
|
||||
|
||||
// static
|
||||
void V8Initializer::LoadV8NativesFromFile(
|
||||
base::File natives_file,
|
||||
base::MemoryMappedFile::Region* natives_file_region) {
|
||||
if (g_mapped_natives)
|
||||
return;
|
||||
|
||||
CHECK(natives_file.IsValid());
|
||||
|
||||
base::MemoryMappedFile::Region region =
|
||||
base::MemoryMappedFile::Region::kWholeFile;
|
||||
if (natives_file_region) {
|
||||
region = *natives_file_region;
|
||||
}
|
||||
|
||||
if (!MapV8File(std::move(natives_file), region, &g_mapped_natives)) {
|
||||
LOG(FATAL) << "Couldn't mmap v8 natives data file";
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(OS_ANDROID)
|
||||
// static
|
||||
base::FilePath V8Initializer::GetNativesFilePath() {
|
||||
base::FilePath path;
|
||||
GetV8FilePath(kNativesFileName, &path);
|
||||
return path;
|
||||
}
|
||||
|
||||
// static
|
||||
base::FilePath V8Initializer::GetSnapshotFilePath(
|
||||
bool abi_32_bit,
|
||||
|
@ -25,11 +25,8 @@ class GIN_EXPORT V8Initializer {
|
||||
// Get address and size information for currently loaded snapshot.
|
||||
// If no snapshot is loaded, the return values are null for addresses
|
||||
// and 0 for sizes.
|
||||
static void GetV8ExternalSnapshotData(v8::StartupData* natives,
|
||||
v8::StartupData* snapshot);
|
||||
static void GetV8ExternalSnapshotData(const char** natives_data_out,
|
||||
int* natives_size_out,
|
||||
const char** snapshot_data_out,
|
||||
static void GetV8ExternalSnapshotData(v8::StartupData* snapshot);
|
||||
static void GetV8ExternalSnapshotData(const char** snapshot_data_out,
|
||||
int* snapshot_size_out);
|
||||
|
||||
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
|
||||
@ -45,9 +42,6 @@ class GIN_EXPORT V8Initializer {
|
||||
// Load V8 snapshot from default resources, if they are available.
|
||||
static void LoadV8Snapshot(
|
||||
V8SnapshotFileType snapshot_file_type = V8SnapshotFileType::kDefault);
|
||||
// Load V8 natives source from default resources. Contains asserts
|
||||
// so that it will not return if natives cannot be loaded.
|
||||
static void LoadV8Natives();
|
||||
|
||||
// Load V8 snapshot from user provided file.
|
||||
// The region argument, if non-zero, specifies the portions
|
||||
@ -57,15 +51,8 @@ class GIN_EXPORT V8Initializer {
|
||||
base::File snapshot_file,
|
||||
base::MemoryMappedFile::Region* snapshot_file_region,
|
||||
V8SnapshotFileType snapshot_file_type);
|
||||
// Similar to LoadV8SnapshotFromFile, but for the source of the natives.
|
||||
// Without the natives we cannot continue, so this function contains
|
||||
// release mode asserts and won't return if it fails.
|
||||
static void LoadV8NativesFromFile(
|
||||
base::File natives_file,
|
||||
base::MemoryMappedFile::Region* natives_file_region);
|
||||
|
||||
#if defined(OS_ANDROID)
|
||||
static base::FilePath GetNativesFilePath();
|
||||
static base::FilePath GetSnapshotFilePath(
|
||||
bool abi_32_bit,
|
||||
V8SnapshotFileType snapshot_file_type);
|
||||
|
@ -473,7 +473,6 @@ jumbo_component("headless_non_renderer") {
|
||||
# use external v8 startup data too.
|
||||
if ((is_win && is_component_build) || !is_win) {
|
||||
if (v8_use_external_startup_data) {
|
||||
data += [ "$root_out_dir/natives_blob.bin" ]
|
||||
public_deps += [ "//v8" ]
|
||||
if (use_v8_context_snapshot) {
|
||||
data += [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
|
@ -53,7 +53,6 @@ class MediaBlinkTestSuite : public base::TestSuite {
|
||||
|
||||
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
|
||||
gin::V8Initializer::LoadV8Snapshot(kSnapshotType);
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
|
||||
#if !defined(OS_IOS)
|
||||
|
@ -369,7 +369,6 @@ class SharedIsolateFactory {
|
||||
if (!has_initialized_v8_) {
|
||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||
gin::V8Initializer::LoadV8Snapshot();
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
|
||||
// The performance of the proxy resolver is limited by DNS resolution,
|
||||
|
@ -212,10 +212,7 @@ if (enable_pdf) {
|
||||
]
|
||||
|
||||
if (v8_use_external_startup_data) {
|
||||
data += [
|
||||
"$root_out_dir/natives_blob.bin",
|
||||
"$root_out_dir/snapshot_blob.bin",
|
||||
]
|
||||
data += [ "$root_out_dir/snapshot_blob.bin" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,15 +43,13 @@ bool PDFModule::Init() {
|
||||
|
||||
pp::Instance* PDFModule::CreateInstance(PP_Instance instance) {
|
||||
if (!g_sdk_initialized_via_pepper) {
|
||||
// TODO(v8:7624): Remove natives and all remaining infrastructure.
|
||||
v8::StartupData natives;
|
||||
v8::StartupData snapshot;
|
||||
pp::PDF::GetV8ExternalSnapshotData(pp::InstanceHandle(instance),
|
||||
&natives.data, &natives.raw_size,
|
||||
&snapshot.data, &snapshot.raw_size);
|
||||
if (natives.data) {
|
||||
if (snapshot.data) {
|
||||
v8::V8::SetSnapshotDataBlob(&snapshot);
|
||||
}
|
||||
|
||||
InitializeSDK(/*enable_v8=*/true);
|
||||
g_sdk_initialized_via_pepper = true;
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ void LoadV8SnapshotData() {
|
||||
if (!loaded) {
|
||||
loaded = true;
|
||||
gin::V8Initializer::LoadV8Snapshot();
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -183,11 +183,9 @@ struct PPB_PDF {
|
||||
// Sets the link currently under the cursor.
|
||||
void (*SetLinkUnderCursor)(PP_Instance instance, const char* url);
|
||||
|
||||
// Gets pointers to both the mmap'd V8 snapshot files and their sizes.
|
||||
// This is needed when loading V8's initial snapshot from external files.
|
||||
// Gets pointers to the mmap'd V8 snapshot file and its size.
|
||||
// This is needed when loading V8's initial snapshot from an external file.
|
||||
void (*GetV8ExternalSnapshotData)(PP_Instance instance,
|
||||
const char** natives_data_out,
|
||||
int* natives_size_out,
|
||||
const char** snapshot_data_out,
|
||||
int* snapshot_size_out);
|
||||
|
||||
|
@ -184,19 +184,14 @@ void PDF::SetLinkUnderCursor(const InstanceHandle& instance, const char* url) {
|
||||
|
||||
// static
|
||||
void PDF::GetV8ExternalSnapshotData(const InstanceHandle& instance,
|
||||
const char** natives_data_out,
|
||||
int* natives_size_out,
|
||||
const char** snapshot_data_out,
|
||||
int* snapshot_size_out) {
|
||||
if (has_interface<PPB_PDF>()) {
|
||||
get_interface<PPB_PDF>()->GetV8ExternalSnapshotData(instance.pp_instance(),
|
||||
natives_data_out, natives_size_out, snapshot_data_out,
|
||||
snapshot_size_out);
|
||||
get_interface<PPB_PDF>()->GetV8ExternalSnapshotData(
|
||||
instance.pp_instance(), snapshot_data_out, snapshot_size_out);
|
||||
return;
|
||||
}
|
||||
*natives_data_out = NULL;
|
||||
*snapshot_data_out = NULL;
|
||||
*natives_size_out = 0;
|
||||
*snapshot_size_out = 0;
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,6 @@ class PDF {
|
||||
static void SetLinkUnderCursor(const InstanceHandle& instance,
|
||||
const char* url);
|
||||
static void GetV8ExternalSnapshotData(const InstanceHandle& instance,
|
||||
const char** natives_data_out,
|
||||
int* natives_size_out,
|
||||
const char** snapshot_data_out,
|
||||
int* snapshot_size_out);
|
||||
static void SetAccessibilityViewportInfo(
|
||||
|
@ -196,12 +196,10 @@ void PDFResource::SetLinkUnderCursor(const char* url) {
|
||||
Post(RENDERER, PpapiHostMsg_PDF_SetLinkUnderCursor(url));
|
||||
}
|
||||
|
||||
void PDFResource::GetV8ExternalSnapshotData(const char** natives_data_out,
|
||||
int* natives_size_out,
|
||||
const char** snapshot_data_out,
|
||||
void PDFResource::GetV8ExternalSnapshotData(const char** snapshot_data_out,
|
||||
int* snapshot_size_out) {
|
||||
gin::V8Initializer::GetV8ExternalSnapshotData(
|
||||
natives_data_out, natives_size_out, snapshot_data_out, snapshot_size_out);
|
||||
gin::V8Initializer::GetV8ExternalSnapshotData(snapshot_data_out,
|
||||
snapshot_size_out);
|
||||
}
|
||||
|
||||
void PDFResource::SetAccessibilityDocInfo(
|
||||
|
@ -54,9 +54,7 @@ class PPAPI_PROXY_EXPORT PDFResource
|
||||
PP_Bool IsFeatureEnabled(PP_PDFFeature feature) override;
|
||||
void SetSelectedText(const char* selected_text) override;
|
||||
void SetLinkUnderCursor(const char* url) override;
|
||||
void GetV8ExternalSnapshotData(const char** natives_data_out,
|
||||
int* natives_size_out,
|
||||
const char** snapshot_data_out,
|
||||
void GetV8ExternalSnapshotData(const char** snapshot_data_out,
|
||||
int* snapshot_size_out) override;
|
||||
void SetAccessibilityViewportInfo(
|
||||
const PP_PrivateAccessibilityViewportInfo* viewport_info) override;
|
||||
|
@ -22,21 +22,14 @@ void TestPDF::RunTests(const std::string& filter) {
|
||||
}
|
||||
|
||||
std::string TestPDF::TestGetV8ExternalSnapshotData() {
|
||||
const char* natives_data;
|
||||
const char* snapshot_data;
|
||||
int natives_size;
|
||||
int snapshot_size;
|
||||
|
||||
pp::PDF::GetV8ExternalSnapshotData(instance_, &natives_data, &natives_size,
|
||||
&snapshot_data, &snapshot_size);
|
||||
pp::PDF::GetV8ExternalSnapshotData(instance_, &snapshot_data, &snapshot_size);
|
||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||
ASSERT_NE(natives_data, (char*) (NULL));
|
||||
ASSERT_NE(natives_size, 0);
|
||||
ASSERT_NE(snapshot_data, (char*) (NULL));
|
||||
ASSERT_NE(snapshot_size, 0);
|
||||
#else
|
||||
ASSERT_EQ(natives_data, (char*) (NULL));
|
||||
ASSERT_EQ(natives_size, 0);
|
||||
ASSERT_EQ(snapshot_data, (char*) (NULL));
|
||||
ASSERT_EQ(snapshot_size, 0);
|
||||
#endif
|
||||
|
@ -32,9 +32,7 @@ class PPB_PDF_API {
|
||||
virtual void Print() = 0;
|
||||
virtual void SetSelectedText(const char* selected_text) = 0;
|
||||
virtual void SetLinkUnderCursor(const char* url) = 0;
|
||||
virtual void GetV8ExternalSnapshotData(const char** natives_data_out,
|
||||
int* natives_size_out,
|
||||
const char** snapshot_data_out,
|
||||
virtual void GetV8ExternalSnapshotData(const char** snapshot_data_out,
|
||||
int* snapshot_size_out) = 0;
|
||||
virtual void SetAccessibilityViewportInfo(
|
||||
const PP_PrivateAccessibilityViewportInfo* viewport_info) = 0;
|
||||
|
@ -142,15 +142,13 @@ void SetLinkUnderCursor(PP_Instance instance, const char* url) {
|
||||
}
|
||||
|
||||
void GetV8ExternalSnapshotData(PP_Instance instance,
|
||||
const char** natives_data_out,
|
||||
int* natives_size_out,
|
||||
const char** snapshot_data_out,
|
||||
int* snapshot_size_out) {
|
||||
EnterInstanceAPI<PPB_PDF_API> enter(instance);
|
||||
if (enter.failed())
|
||||
return;
|
||||
enter.functions()->GetV8ExternalSnapshotData(natives_data_out,
|
||||
natives_size_out, snapshot_data_out, snapshot_size_out);
|
||||
enter.functions()->GetV8ExternalSnapshotData(snapshot_data_out,
|
||||
snapshot_size_out);
|
||||
}
|
||||
|
||||
void SetAccessibilityViewportInfo(
|
||||
|
@ -81,7 +81,6 @@ class BlinkInitializer : public blink::Platform {
|
||||
BlinkInitializer() {
|
||||
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
|
||||
gin::V8Initializer::LoadV8Snapshot(kSnapshotType);
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif // V8_USE_EXTERNAL_STARTUP_DATA
|
||||
|
||||
service_manager::BinderRegistry empty_registry;
|
||||
|
@ -90,7 +90,6 @@ class SectionSizeKnobs(object):
|
||||
'assets/icudtl.dat': '../../third_party/icu/android/icudtl.dat',
|
||||
'assets/snapshot_blob_32.bin': '../../v8/snapshot_blob_32.bin',
|
||||
'assets/snapshot_blob_64.bin': '../../v8/snapshot_blob_64.bin',
|
||||
'assets/natives_blob.bin': '../../v8/natives_blob.bin',
|
||||
'assets/unwind_cfi_32': '../../base/trace_event/cfi_backtrace_android.cc',
|
||||
'assets/webapk_dex_version.txt': (
|
||||
'../../chrome/android/webapk/libs/runtime_library_version.gni'),
|
||||
|
@ -55,7 +55,6 @@ CHROME_REQUIRED_FILES = {
|
||||
'nacl_helper_bootstrap',
|
||||
'nacl_helper_nonsfi',
|
||||
'nacl_irt_x86_64.nexe',
|
||||
'natives_blob.bin',
|
||||
'pnacl/',
|
||||
'product_logo_48.png',
|
||||
'resources/',
|
||||
@ -80,7 +79,6 @@ CHROME_REQUIRED_FILES = {
|
||||
'libGLESv2.dll',
|
||||
'locales',
|
||||
'nacl_irt_x86_64.nexe',
|
||||
'natives_blob.bin',
|
||||
'PepperFlash',
|
||||
'resources.pak',
|
||||
'SecondaryTile.png',
|
||||
|
@ -30,7 +30,7 @@ def get_files_to_compare(build_dir, recursive=False):
|
||||
'.aab',
|
||||
'.apk',
|
||||
'.app',
|
||||
'.bin', # V8 snapshot files natives_blob.bin, snapshot_blob.bin
|
||||
'.bin', # V8 snapshot file snapshot_blob.bin
|
||||
'.dll',
|
||||
'.dylib',
|
||||
'.exe',
|
||||
|
@ -42,9 +42,6 @@ if (use_v8_context_snapshot) {
|
||||
deps = [
|
||||
":v8_context_snapshot",
|
||||
]
|
||||
sources = [
|
||||
"$root_out_dir/natives_blob.bin",
|
||||
]
|
||||
renaming_sources = [ "$root_out_dir/v8_context_snapshot.bin" ]
|
||||
if (current_cpu == "arm" || current_cpu == "x86" ||
|
||||
current_cpu == "mipsel") {
|
||||
|
@ -37,7 +37,6 @@ int main(int argc, char** argv) {
|
||||
base::CommandLine::Init(argc, argv);
|
||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||
gin::V8Initializer::LoadV8Snapshot();
|
||||
gin::V8Initializer::LoadV8Natives();
|
||||
#endif
|
||||
|
||||
// Set up environment to make Blink and V8 workable.
|
||||
|
@ -35,7 +35,6 @@ import java.util.concurrent.CountDownLatch;
|
||||
public class ResourceExtractor {
|
||||
private static final String TAG = "ui";
|
||||
private static final String ICU_DATA_FILENAME = "icudtl.dat";
|
||||
private static final String V8_NATIVES_DATA_FILENAME = "natives_blob.bin";
|
||||
private static final String V8_SNAPSHOT_DATA_FILENAME = "snapshot_blob.bin";
|
||||
private static final String FALLBACK_LOCALE = "en-US";
|
||||
private static final String COMPRESSED_LOCALES_DIR = "locales";
|
||||
@ -342,7 +341,6 @@ public class ResourceExtractor {
|
||||
private void deleteFiles(String[] existingFileNames) {
|
||||
// These used to be extracted, but no longer are, so just clean them up.
|
||||
FileUtils.recursivelyDeleteFile(new File(getAppDataDir(), ICU_DATA_FILENAME));
|
||||
FileUtils.recursivelyDeleteFile(new File(getAppDataDir(), V8_NATIVES_DATA_FILENAME));
|
||||
FileUtils.recursivelyDeleteFile(new File(getAppDataDir(), V8_SNAPSHOT_DATA_FILENAME));
|
||||
|
||||
if (existingFileNames != null) {
|
||||
|
Reference in New Issue
Block a user