Skip to content

Commit

Permalink
chrome: Unship snapshot_blob.bin from Win/Mac/Linux
Browse files Browse the repository at this point in the history
We are shipping snapshot_blob.bin and v8_context_snapshot.bin with
Chrome for speed up of launching V8 environments.
Beside it, v8_context_snapshot.bin contains all information in
snapshot_blob.bin, and we no longer need snapshot_blob.bin if
v8_context_snapshot.bin is available.

This CL drops snapshot_blob.bin from Chrome for such platforms
to reduce the size of shipping binaries and memory usages.


Bug: 789964, 796127
Change-Id: I4c17f803212b845b2021936d7eb1eec913d76c68
Reviewed-on: https://chromium-review.googlesource.com/812587
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Greg Thompson <grt@chromium.org>
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531204}
  • Loading branch information
peria authored and Commit Bot committed Jan 23, 2018
1 parent bf779fc commit b550792
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 68 deletions.
14 changes: 8 additions & 6 deletions chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import("//ppapi/features/features.gni")
import("//third_party/WebKit/public/public_features.gni")
import("//third_party/widevine/cdm/widevine.gni")
import("//tools/resources/generate_resource_whitelist.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//v8/gni/v8.gni")

if (is_android) {
Expand Down Expand Up @@ -852,7 +853,6 @@ if (is_win) {
bundle_data("chrome_framework_resources") {
sources = [
"$root_out_dir/app_mode_loader.app",
"$root_out_dir/v8_context_snapshot.bin",

# This image is used to badge the lock icon in the
# authentication dialogs, such as those used for installation
Expand All @@ -872,7 +872,6 @@ if (is_win) {
public_deps = [
":packed_resources",
"//chrome/app_shim:app_mode_loader",
"//tools/v8_context_snapshot",
]

if (is_chrome_branded) {
Expand All @@ -888,11 +887,14 @@ if (is_win) {
}

if (v8_use_external_startup_data) {
sources += [
"$root_out_dir/natives_blob.bin",
"$root_out_dir/snapshot_blob.bin",
]
sources += [ "$root_out_dir/natives_blob.bin" ]
public_deps += [ "//v8" ]
if (use_v8_context_snapshot) {
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
public_deps += [ "//tools/v8_context_snapshot" ]
} else {
sources += [ "$root_out_dir/snapshot_blob.bin" ]
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions chrome/installer/linux/common/installer.include
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ 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}/"
install -m 644 "${BUILDDIR}/snapshot_blob.bin" "${STAGEDIR}/${INSTALLDIR}/"

# V8 context snapshot file; it will replace V8's snapshot_blob.bin
# TODO(peria): Remove snapshot_blob.bin when dependencies are resolved.
# 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
install -m 644 "${BUILDDIR}/v8_context_snapshot.bin" "${STAGEDIR}/${INSTALLDIR}/"
else
install -m 644 "${BUILDDIR}/snapshot_blob.bin" "${STAGEDIR}/${INSTALLDIR}/"
fi

# sandbox
Expand Down
13 changes: 8 additions & 5 deletions chrome/installer/mini_installer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import("//chrome/process_version_rc_template.gni")
import("//chrome/test/mini_installer/mini_installer_test.gni")
import("//components/nacl/features.gni")
import("//third_party/icu/config.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//ui/base/ui_features.gni")
import("//v8/gni/v8.gni")

Expand Down Expand Up @@ -180,7 +181,6 @@ template("generate_mini_installer") {
"//chrome/browser/extensions/default_extensions",
"//chrome/installer/setup",
"//third_party/icu:icudata",
"//tools/v8_context_snapshot",
chrome_dll_target,
]

Expand Down Expand Up @@ -212,11 +212,14 @@ template("generate_mini_installer") {
}

if (v8_use_external_startup_data) {
inputs += [
"$root_out_dir/natives_blob.bin",
"$root_out_dir/snapshot_blob.bin",
]
inputs += [ "$root_out_dir/natives_blob.bin" ]
deps += [ "//v8" ]
if (use_v8_context_snapshot) {
inputs += [ "$root_out_dir/v8_context_snapshot.bin" ]
deps += [ "//tools/v8_context_snapshot" ]
} else {
inputs += [ "$root_out_dir/snapshot_blob.bin" ]
}
}

depfile = "$target_gen_dir/archive.d"
Expand Down
1 change: 0 additions & 1 deletion chrome/installer/mini_installer/chrome.release
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ nacl_irt_x86_32.nexe: %(VersionDir)s\
nacl_irt_x86_64.nexe: %(VersionDir)s\
natives_blob.bin: %(VersionDir)s\
resources.pak: %(VersionDir)s\
snapshot_blob.bin: %(VersionDir)s\
syzyasan_rtl.dll: %(VersionDir)s\
v8_context_snapshot.bin: %(VersionDir)s\
#
Expand Down
10 changes: 0 additions & 10 deletions chrome/tools/build/linux/FILES.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ FILES = [
'filename': 'session',
'buildtype': ['dev'],
},
{
'filename': 'snapshot_blob.bin',
'buildtype': ['dev', 'official'],
},
{
'filename': 'v8_context_snapshot.bin',
'buildtype': ['dev', 'official'],
Expand Down Expand Up @@ -282,12 +278,6 @@ FILES = [
'archive': 'content-shell.zip',
'optional': ['dev'],
},
{
'filename': 'snapshot_blob.bin',
'buildtype': ['dev'],
'archive': 'content-shell.zip',
'optional': ['dev'],
},
{
'filename': 'v8_context_snapshot.bin',
'buildtype': ['dev'],
Expand Down
6 changes: 0 additions & 6 deletions chrome/tools/build/mac/FILES.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,6 @@ FILES = [
'archive': 'content-shell.zip',
'optional': ['dev'],
},
{
'filename': 'snapshot_blob.bin',
'buildtype': ['dev'],
'archive': 'content-shell.zip',
'optional': ['dev'],
},
{
'filename': 'v8_context_snapshot.bin',
'buildtype': ['dev'],
Expand Down
11 changes: 0 additions & 11 deletions chrome/tools/build/win/FILES.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ FILES = [
'buildtype': ['dev', 'official'],
'optional': ['dev', 'official'],
},
{
'filename': 'snapshot_blob.bin',
'buildtype': ['dev', 'official'],
'optional': ['dev', 'official'],
},
{
'filename': 'v8_context_snapshot.bin',
'buildtype': ['dev', 'official'],
Expand Down Expand Up @@ -819,12 +814,6 @@ FILES = [
'archive': 'content-shell.zip',
'optional': ['dev'],
},
{
'filename': 'snapshot_blob.bin',
'buildtype': ['dev'],
'archive': 'content-shell.zip',
'optional': ['dev'],
},
{
'filename': 'v8_context_snapshot.bin',
'buildtype': ['dev'],
Expand Down
2 changes: 1 addition & 1 deletion content/app/content_main_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ void InitializeFieldTrialAndFeatureList(
}

#if defined(V8_USE_EXTERNAL_STARTUP_DATA)

void LoadV8SnapshotFile() {
#if defined(USE_V8_CONTEXT_SNAPSHOT)
static constexpr gin::V8Initializer::V8SnapshotFileType kSnapshotType =
Expand All @@ -196,6 +195,7 @@ void LoadV8SnapshotFile() {
return;
}
#endif // OS_POSIX && !OS_MACOSX

#if !defined(CHROME_MULTIPLE_DLL_BROWSER)
gin::V8Initializer::LoadV8Snapshot(kSnapshotType);
#endif // !CHROME_MULTIPLE_DLL_BROWSER
Expand Down
4 changes: 0 additions & 4 deletions content/public/app/mojo/content_renderer_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@
"platform": "android"
}
],
"v8_snapshot_data" : [{
"path": "snapshot_blob.bin",
"platform": "linux"
}],
"v8_snapshot_32_data" : [{
"path": "assets/snapshot_blob_32.bin",
"platform": "android"
Expand Down
4 changes: 0 additions & 4 deletions content/public/app/mojo/content_utility_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@
"platform": "android"
}
],
"v8_snapshot_data" : [{
"path": "snapshot_blob.bin",
"platform": "linux"
}],
"v8_snapshot_32_data" : [{
"path": "assets/snapshot_blob_32.bin",
"platform": "android"
Expand Down
16 changes: 9 additions & 7 deletions content/shell/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//ppapi/features/features.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//tools/grit/repack.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
if (is_android) {
import("//build/config/android/config.gni")
} else if (is_mac) {
Expand Down Expand Up @@ -645,13 +646,11 @@ if (is_mac) {
bundle_data("content_shell_framework_resources") {
sources = [
"$root_out_dir/content_shell.pak",
"$root_out_dir/v8_context_snapshot.bin",
"resources/missingImage.png",
]

public_deps = [
":pak",
"//tools/v8_context_snapshot:v8_context_snapshot",
]

if (icu_use_data_file) {
Expand All @@ -662,11 +661,14 @@ if (is_mac) {
}

if (v8_use_external_startup_data) {
sources += [
"$root_out_dir/natives_blob.bin",
"$root_out_dir/snapshot_blob.bin",
]
sources += [ "$root_out_dir/natives_blob.bin" ]
public_deps += [ "//v8" ]
if (use_v8_context_snapshot) {
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
public_deps += [ "//tools/v8_context_snapshot" ]
} else {
sources += [ "$root_out_dir/snapshot_blob.bin" ]
}
}

outputs = [
Expand Down
15 changes: 8 additions & 7 deletions extensions/shell/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import("//components/nacl/features.gni")
import("//extensions/features/features.gni")
import("//testing/test.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
if (is_mac) {
import("//build/config/mac/rules.gni")
import("//third_party/icu/config.gni")
Expand Down Expand Up @@ -298,7 +299,6 @@ test("app_shell_unittests") {
"$root_out_dir/extensions_shell_and_test.pak",

#"$root_out_dir/natives_blob.bin", # move to gin
#"$root_out_dir/snapshot_blob.bin",
]

deps = [
Expand Down Expand Up @@ -363,23 +363,24 @@ if (is_mac) {
sources = [
"$root_gen_dir/extensions/shell/app_shell_resources.pak",
"$root_out_dir/extensions_shell_and_test.pak",
"$root_out_dir/v8_context_snapshot.bin",
]
public_deps = [
":resources_grit",
"//extensions:shell_and_test_pak",
"//tools/v8_context_snapshot:v8_context_snapshot",
]
if (icu_use_data_file) {
sources += [ "$root_out_dir/icudtl.dat" ]
public_deps += [ "//third_party/icu:icudata" ]
}
if (v8_use_external_startup_data) {
sources += [
"$root_out_dir/natives_blob.bin",
"$root_out_dir/snapshot_blob.bin",
]
sources += [ "$root_out_dir/natives_blob.bin" ]
public_deps += [ "//v8" ]
if (use_v8_context_snapshot) {
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
public_deps += [ "//tools/v8_context_snapshot" ]
} else {
sources += [ "$root_out_dir/snapshot_blob.bin" ]
}
}
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
Expand Down
10 changes: 8 additions & 2 deletions extensions/shell/installer/linux/common/installer.include
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,17 @@ stage_install_common() {
# ICU data file; Necessary when the GN icu_use_data_file flag is true.
install -m 644 "${BUILDDIR}/icudtl.dat" "${STAGEDIR}/${INSTALLDIR}/"

# V8 snapshot files; Necessary when the GN v8_use_external_startup_data flag
# V8 snapshot files; Necessary when the GN v8_use_external_startup_data flag
# is true.
if [ -f "${BUILDDIR}/natives_blob.bin" ]; then
install -m 644 "${BUILDDIR}/natives_blob.bin" "${STAGEDIR}/${INSTALLDIR}/"
install -m 644 "${BUILDDIR}/snapshot_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
install -m 644 "${BUILDDIR}/v8_context_snapshot.bin" "${STAGEDIR}/${INSTALLDIR}/"
else
install -m 644 "${BUILDDIR}/snapshot_blob.bin" "${STAGEDIR}/${INSTALLDIR}/"
fi
fi

# ANGLE
Expand Down

0 comments on commit b550792

Please sign in to comment.