Reland "[android] Re-adds ability to include both v8 snapshot types"
This is a reland of commit 87a4a1df82
The reland adds a dependency on v8_context_snapshot:buildflags in NaCL,
to fix lacros build issues.
Original change's description:
> [android] Re-adds ability to include both v8 snapshot types
>
> A reland of https://crrev.com/c/3209682, which allows selecting at
> runtime whether V8 uses the blink-generated context snapshot or not.
> This reland is both a rebase and an update, and as such has some
> mechanical differences with the original patch -- in particular, it
> switches to using BUILDFLAGS over `#if defined`.
>
> We're relanding this because we want to retry the experiment with
> various new differences (e.g. trying out enabling for just high-end
> Android, collecting metrics from partners rather than aggregated whole
> web performance, looking at metrics outside of CWV, experimenting with
> the impact on the trade-off space of alternative compression schemes
> for the snapshot).
>
> Original description:
>
> > And adds feature as to which one is used at runtime. Specific
> > parts:
> > . adds gn arg: include_both_v8_snapshots. At this time this is
> > only supported on android. I will likely make it work on chromeos
> > next.
> > . Adds feature kUseContextSnapshot. This feature is available if
> > include_both_v8_snapshots is set.
> > . Adds switch kUseContextSnapshotSwitch. This is passed from browser
> > to renderer if kUseContextSnapshot is enabled. A separate switch is
> > used as at the time the v8 snapshot is loaded features have not been
> > loaded.
> > And this updates a bunch of build targets accordingly.
>
> Bug: 40200623, 40539769
> Change-Id: I4e82581809321ec143b3c1484af4267279aa1e2f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5482109
> Reviewed-by: Richard (Torne) Coles <torne@chromium.org>
> Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
> Reviewed-by: John Abd-El-Malek <jam@chromium.org>
> Auto-Submit: Leszek Swirski <leszeks@chromium.org>
> Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
> Commit-Queue: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1293558}
Bug: 40200623, 40539769
Cq-Include-Trybots: luci.chrome.try:linux-lacros-chrome
Change-Id: I5141e1a1ea488ffc3f539f941bf0c52297378e99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5491087
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Derek Schuff <dschuff@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1295360}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
f86d026307
commit
c062a07fbb
android_webview/lib
chrome
components/nacl/common
content
DEPS
app
browser
public
common
shell
gin
headless
tools/v8_context_snapshot
@ -160,18 +160,26 @@ std::optional<int> AwMainDelegate::BasicStartupComplete() {
|
||||
cl->AppendSwitch(switches::kWebViewDrawFunctorUsesVulkan);
|
||||
|
||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||
#if BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
|
||||
const gin::V8SnapshotFileType file_type =
|
||||
gin::V8SnapshotFileType::kWithAdditionalContext;
|
||||
#else
|
||||
const gin::V8SnapshotFileType file_type = gin::V8SnapshotFileType::kDefault;
|
||||
#endif
|
||||
#if !BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT) || BUILDFLAG(INCLUDE_BOTH_V8_SNAPSHOTS)
|
||||
base::android::RegisterApkAssetWithFileDescriptorStore(
|
||||
content::kV8Snapshot32DataDescriptor,
|
||||
gin::V8Initializer::GetSnapshotFilePath(true, file_type));
|
||||
gin::V8Initializer::GetSnapshotFilePath(
|
||||
true, gin::V8SnapshotFileType::kDefault));
|
||||
base::android::RegisterApkAssetWithFileDescriptorStore(
|
||||
content::kV8Snapshot64DataDescriptor,
|
||||
gin::V8Initializer::GetSnapshotFilePath(false, file_type));
|
||||
gin::V8Initializer::GetSnapshotFilePath(
|
||||
false, gin::V8SnapshotFileType::kDefault));
|
||||
#endif
|
||||
#if BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
|
||||
base::android::RegisterApkAssetWithFileDescriptorStore(
|
||||
content::kV8ContextSnapshot32DataDescriptor,
|
||||
gin::V8Initializer::GetSnapshotFilePath(
|
||||
true, gin::V8SnapshotFileType::kWithAdditionalContext));
|
||||
base::android::RegisterApkAssetWithFileDescriptorStore(
|
||||
content::kV8ContextSnapshot64DataDescriptor,
|
||||
gin::V8Initializer::GetSnapshotFilePath(
|
||||
false, gin::V8SnapshotFileType::kWithAdditionalContext));
|
||||
#endif
|
||||
#endif // V8_USE_EXTERNAL_STARTUP_DATA
|
||||
}
|
||||
|
||||
|
@ -969,7 +969,8 @@ if (is_win) {
|
||||
if (use_v8_context_snapshot) {
|
||||
sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
|
||||
public_deps += [ "//tools/v8_context_snapshot" ]
|
||||
} else {
|
||||
}
|
||||
if (!use_v8_context_snapshot || include_both_v8_snapshots) {
|
||||
sources += [ "$root_out_dir/snapshot_blob.bin" ]
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +232,8 @@ action("mini_installer_archive") {
|
||||
if (use_v8_context_snapshot) {
|
||||
inputs += [ "$root_out_dir/$v8_context_snapshot_filename" ]
|
||||
deps += [ "//tools/v8_context_snapshot" ]
|
||||
} else {
|
||||
}
|
||||
if (!use_v8_context_snapshot || include_both_v8_snapshots) {
|
||||
inputs += [ "$root_out_dir/snapshot_blob.bin" ]
|
||||
args += [ "--include_snapshotblob=1" ]
|
||||
}
|
||||
|
@ -56,7 +56,10 @@ if (enable_nacl) {
|
||||
]
|
||||
|
||||
# Deps required by the above headers.
|
||||
deps = [ "//media:media_buildflags" ]
|
||||
deps = [
|
||||
"//media:media_buildflags",
|
||||
"//tools/v8_context_snapshot:buildflags",
|
||||
]
|
||||
}
|
||||
|
||||
static_library("common") {
|
||||
|
@ -133,4 +133,8 @@ specific_include_rules = {
|
||||
"+content/shell/browser",
|
||||
"+content/shell/common",
|
||||
],
|
||||
"content_(features|switches).h": [
|
||||
# content -> tools dependency is disallowed, except buildflags for switches.
|
||||
"+tools/v8_context_snapshot/buildflags.h",
|
||||
],
|
||||
}
|
||||
|
@ -224,15 +224,22 @@ namespace {
|
||||
#if defined(V8_USE_EXTERNAL_STARTUP_DATA) && BUILDFLAG(IS_ANDROID)
|
||||
#if defined __LP64__
|
||||
#define kV8SnapshotDataDescriptor kV8Snapshot64DataDescriptor
|
||||
#define kV8ContextSnapshotDataDescriptor kV8ContextSnapshot64DataDescriptor
|
||||
#else
|
||||
#define kV8SnapshotDataDescriptor kV8Snapshot32DataDescriptor
|
||||
#define kV8ContextSnapshotDataDescriptor kV8ContextSnapshot32DataDescriptor
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(V8_USE_EXTERNAL_STARTUP_DATA)
|
||||
|
||||
gin::V8SnapshotFileType GetSnapshotType(const base::CommandLine& command_line) {
|
||||
#if BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
|
||||
#if BUILDFLAG(IS_ANDROID) && BUILDFLAG(INCLUDE_BOTH_V8_SNAPSHOTS)
|
||||
if (command_line.HasSwitch(switches::kUseContextSnapshotSwitch)) {
|
||||
return gin::V8SnapshotFileType::kWithAdditionalContext;
|
||||
}
|
||||
return gin::V8SnapshotFileType::kDefault;
|
||||
#elif BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
|
||||
return gin::V8SnapshotFileType::kWithAdditionalContext;
|
||||
#else
|
||||
return gin::V8SnapshotFileType::kDefault;
|
||||
@ -241,13 +248,13 @@ gin::V8SnapshotFileType GetSnapshotType(const base::CommandLine& command_line) {
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
std::string GetSnapshotDataDescriptor(const base::CommandLine& command_line) {
|
||||
#if BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// On android, the renderer loads the context snapshot directly.
|
||||
return std::string();
|
||||
#else
|
||||
#if BUILDFLAG(IS_ANDROID) && BUILDFLAG(INCLUDE_BOTH_V8_SNAPSHOTS)
|
||||
if (command_line.HasSwitch(switches::kUseContextSnapshotSwitch)) {
|
||||
return kV8ContextSnapshotDataDescriptor;
|
||||
}
|
||||
return kV8SnapshotDataDescriptor;
|
||||
#elif BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
|
||||
return kV8ContextSnapshotDataDescriptor;
|
||||
#endif
|
||||
#else
|
||||
return kV8SnapshotDataDescriptor;
|
||||
#endif
|
||||
|
@ -1736,7 +1736,7 @@ bool RenderProcessHostImpl::Init() {
|
||||
|
||||
auto file_data = std::make_unique<ChildProcessLauncherFileData>();
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
file_data->files_to_preload = GetV8SnapshotFilesToPreload();
|
||||
file_data->files_to_preload = GetV8SnapshotFilesToPreload(*cmd_line);
|
||||
#endif
|
||||
|
||||
// Spawn the child process asynchronously to avoid blocking the UI thread.
|
||||
|
@ -406,7 +406,7 @@ bool UtilityProcessHost::StartProcess() {
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
file_data_->files_to_preload.merge(GetV8SnapshotFilesToPreload());
|
||||
file_data_->files_to_preload.merge(GetV8SnapshotFilesToPreload(*cmd_line));
|
||||
#endif // BUILDFLAG(IS_POSIX)
|
||||
|
||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
|
@ -4,14 +4,18 @@
|
||||
|
||||
#include "content/browser/v8_snapshot_files.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/public/common/content_descriptor_keys.h"
|
||||
#include "content/public/common/content_features.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "tools/v8_context_snapshot/buildflags.h"
|
||||
|
||||
namespace content {
|
||||
|
||||
std::map<std::string, absl::variant<base::FilePath, base::ScopedFD>>
|
||||
GetV8SnapshotFilesToPreload() {
|
||||
GetV8SnapshotFilesToPreload(base::CommandLine& process_command_line) {
|
||||
std::map<std::string, absl::variant<base::FilePath, base::ScopedFD>> files;
|
||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
#if BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
|
||||
@ -22,13 +26,21 @@ GetV8SnapshotFilesToPreload() {
|
||||
base::FilePath(FILE_PATH_LITERAL("snapshot_blob.bin"));
|
||||
#endif
|
||||
#elif BUILDFLAG(IS_ANDROID)
|
||||
#if !BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
|
||||
#if !BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT) || BUILDFLAG(INCLUDE_BOTH_V8_SNAPSHOTS)
|
||||
#if BUILDFLAG(INCLUDE_BOTH_V8_SNAPSHOTS)
|
||||
if (base::FeatureList::IsEnabled(features::kUseContextSnapshot)) {
|
||||
process_command_line.AppendSwitch(switches::kUseContextSnapshotSwitch);
|
||||
files[kV8ContextSnapshotDataDescriptor] = base::FilePath(
|
||||
FILE_PATH_LITERAL(BUILDFLAG(V8_CONTEXT_SNAPSHOT_FILENAME)));
|
||||
}
|
||||
#endif // BUILDFLAG(INCLUDE_BOTH_V8_SNAPSHOTS)
|
||||
files[kV8Snapshot64DataDescriptor] =
|
||||
base::FilePath(FILE_PATH_LITERAL("assets/snapshot_blob_64.bin"));
|
||||
files[kV8Snapshot32DataDescriptor] =
|
||||
base::FilePath(FILE_PATH_LITERAL("assets/snapshot_blob_32.bin"));
|
||||
#elif BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
|
||||
// For USE_V8_CONTEXT_SNAPSHOT, the renderer reads the files directly.
|
||||
files[kV8ContextSnapshotDataDescriptor] = base::FilePath(
|
||||
FILE_PATH_LITERAL(BUILDFLAG(V8_CONTEXT_SNAPSHOT_FILENAME)));
|
||||
#endif
|
||||
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
return files;
|
||||
|
@ -12,6 +12,10 @@
|
||||
#include "base/files/scoped_file.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
|
||||
namespace base {
|
||||
class CommandLine;
|
||||
}
|
||||
|
||||
namespace content {
|
||||
|
||||
// Returns a mapping of V8 snapshot files to be preloaded for child processes
|
||||
@ -21,7 +25,7 @@ namespace content {
|
||||
// This mapping can be used in `content::ChildProcessLauncherFileData` when
|
||||
// constructing a ChildProcessLauncher.
|
||||
std::map<std::string, absl::variant<base::FilePath, base::ScopedFD>>
|
||||
GetV8SnapshotFilesToPreload();
|
||||
GetV8SnapshotFilesToPreload(base::CommandLine& process_command_line);
|
||||
|
||||
} // namespace content
|
||||
|
||||
|
@ -89,6 +89,7 @@ source_set("static_switches") {
|
||||
deps = [
|
||||
"//build:chromeos_buildflags",
|
||||
"//media:media_buildflags",
|
||||
"//tools/v8_context_snapshot:buildflags",
|
||||
]
|
||||
}
|
||||
|
||||
@ -107,6 +108,7 @@ source_set("switches") {
|
||||
deps = [
|
||||
"//build:chromeos_buildflags",
|
||||
"//media:media_buildflags",
|
||||
"//tools/v8_context_snapshot:buildflags",
|
||||
]
|
||||
|
||||
configs += [ "//content:content_implementation" ]
|
||||
@ -255,6 +257,7 @@ source_set("common_sources") {
|
||||
"//services/service_manager/public/mojom",
|
||||
"//third_party/blink/public:blink_headers",
|
||||
"//third_party/blink/public/mojom:mojom_platform_headers",
|
||||
"//tools/v8_context_snapshot:buildflags",
|
||||
"//ui/accessibility",
|
||||
"//ui/base/cursor/mojom:cursor_type",
|
||||
"//ui/gfx/geometry",
|
||||
|
@ -14,6 +14,10 @@ const char kV8Snapshot64DataDescriptor[] = "v8_snapshot_64_data";
|
||||
|
||||
const char kV8ContextSnapshotDataDescriptor[] = "v8_context_snapshot_data";
|
||||
|
||||
const char kV8ContextSnapshot32DataDescriptor[] = "v8_context_snapshot_32_data";
|
||||
|
||||
const char kV8ContextSnapshot64DataDescriptor[] = "v8_context_snapshot_64_data";
|
||||
|
||||
const char kNetworkContextParentDirsDescriptor[] = "network_parent_dirs_pipe";
|
||||
|
||||
} // namespace content
|
||||
|
@ -14,6 +14,8 @@ extern const char kV8SnapshotDataDescriptor[];
|
||||
extern const char kV8Snapshot32DataDescriptor[];
|
||||
extern const char kV8Snapshot64DataDescriptor[];
|
||||
extern const char kV8ContextSnapshotDataDescriptor[];
|
||||
extern const char kV8ContextSnapshot32DataDescriptor[];
|
||||
extern const char kV8ContextSnapshot64DataDescriptor[];
|
||||
|
||||
// A list of directories the network service needs (recursive) access to in
|
||||
// order to function.
|
||||
|
@ -1028,6 +1028,13 @@ BASE_FEATURE(kUnrestrictedSharedArrayBuffer,
|
||||
"UnrestrictedSharedArrayBuffer",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID) && BUILDFLAG(INCLUDE_BOTH_V8_SNAPSHOTS)
|
||||
// If enabled, blink's context snapshot is used rather than the v8 snapshot.
|
||||
BASE_FEATURE(kUseContextSnapshot,
|
||||
"UseContextSnapshot",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
#endif
|
||||
|
||||
// Allows user activation propagation to all frames having the same origin as
|
||||
// the activation notifier frame. This is an intermediate measure before we
|
||||
// have an iframe attribute to declaratively allow user activation propagation
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "content/common/content_export.h"
|
||||
#include "content/public/common/dips_utils.h"
|
||||
#include "tools/v8_context_snapshot/buildflags.h"
|
||||
|
||||
namespace features {
|
||||
|
||||
@ -216,6 +217,9 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kTouchDragAndContextMenu);
|
||||
CONTENT_EXPORT extern const base::FeatureParam<int>
|
||||
kTouchDragMovementThresholdDip;
|
||||
#endif
|
||||
#if BUILDFLAG(IS_ANDROID) && BUILDFLAG(INCLUDE_BOTH_V8_SNAPSHOTS)
|
||||
CONTENT_EXPORT BASE_DECLARE_FEATURE(kUseContextSnapshot);
|
||||
#endif
|
||||
CONTENT_EXPORT BASE_DECLARE_FEATURE(kUnrestrictedSharedArrayBuffer);
|
||||
CONTENT_EXPORT BASE_DECLARE_FEATURE(kUserActivationSameOriginVisibility);
|
||||
CONTENT_EXPORT BASE_DECLARE_FEATURE(kVerifyDidCommitParams);
|
||||
|
@ -812,6 +812,13 @@ const char kUseFakeUIForMediaStream[] = "use-fake-ui-for-media-stream";
|
||||
// Texture target for CHROMIUM_image backed video frame textures.
|
||||
const char kVideoImageTextureTarget[] = "video-image-texture-target";
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID) && BUILDFLAG(INCLUDE_BOTH_V8_SNAPSHOTS)
|
||||
// Switch supplied to the renderer if the feature `kUseContextSnapshot` is
|
||||
// enabled. A switch is used as at the time the renderer needs this information
|
||||
// features have not yet been loaded.
|
||||
const char kUseContextSnapshotSwitch[] = "use-context-snapshot";
|
||||
#endif
|
||||
|
||||
// Set when Chromium should use a mobile user agent.
|
||||
const char kUseMobileUserAgent[] = "use-mobile-user-agent";
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "build/chromeos_buildflags.h"
|
||||
#include "content/common/content_export.h"
|
||||
#include "media/media_buildflags.h"
|
||||
#include "tools/v8_context_snapshot/buildflags.h"
|
||||
|
||||
namespace switches {
|
||||
|
||||
@ -216,6 +217,9 @@ CONTENT_EXPORT extern const char kUseFakeUIForDigitalIdentity[];
|
||||
CONTENT_EXPORT extern const char kUseFakeUIForFedCM[];
|
||||
CONTENT_EXPORT extern const char kUseFakeUIForMediaStream[];
|
||||
CONTENT_EXPORT extern const char kVideoImageTextureTarget[];
|
||||
#if BUILDFLAG(IS_ANDROID) && BUILDFLAG(INCLUDE_BOTH_V8_SNAPSHOTS)
|
||||
CONTENT_EXPORT extern const char kUseContextSnapshotSwitch[];
|
||||
#endif
|
||||
CONTENT_EXPORT extern const char kUseMobileUserAgent[];
|
||||
CONTENT_EXPORT extern const char kUseMockCertVerifierForTesting[];
|
||||
extern const char kUtilityCmdPrefix[];
|
||||
|
@ -811,7 +811,8 @@ if (is_apple) {
|
||||
if (use_v8_context_snapshot) {
|
||||
sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
|
||||
public_deps += [ "//tools/v8_context_snapshot" ]
|
||||
} else {
|
||||
}
|
||||
if (!use_v8_context_snapshot || include_both_v8_snapshots) {
|
||||
sources += [ "$root_out_dir/snapshot_blob.bin" ]
|
||||
}
|
||||
}
|
||||
|
22
gin/BUILD.gn
22
gin/BUILD.gn
@ -135,10 +135,13 @@ if (is_android && enable_java_templates &&
|
||||
android_assets("v8_snapshot_assets") {
|
||||
if (v8_use_external_startup_data) {
|
||||
disable_compression = true
|
||||
sources = []
|
||||
deps = []
|
||||
if (use_v8_context_snapshot) {
|
||||
deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
|
||||
sources = [ "$root_build_dir/$v8_context_snapshot_filename" ]
|
||||
} else {
|
||||
deps += [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
|
||||
sources += [ "$root_build_dir/$v8_context_snapshot_filename" ]
|
||||
}
|
||||
if (!use_v8_context_snapshot || include_both_v8_snapshots) {
|
||||
if (current_cpu == "arm" || current_cpu == "x86") {
|
||||
_arch_suffix = "32"
|
||||
} else {
|
||||
@ -146,7 +149,7 @@ if (is_android && enable_java_templates &&
|
||||
}
|
||||
renaming_sources = [ "$root_build_dir/snapshot_blob.bin" ]
|
||||
renaming_destinations = [ "snapshot_blob_$_arch_suffix.bin" ]
|
||||
deps = [ "//v8:run_mksnapshot_default" ]
|
||||
deps += [ "//v8:run_mksnapshot_default" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -159,18 +162,21 @@ if (is_android && enable_java_templates &&
|
||||
assert(android_64bit_target_cpu,
|
||||
"32-bit targets shouldn't have secondary abi")
|
||||
disable_compression = true
|
||||
sources = []
|
||||
deps = []
|
||||
if (use_v8_context_snapshot) {
|
||||
sources = [ "$root_out_dir/v8_context_snapshot_32.bin" ]
|
||||
deps = [
|
||||
sources += [ "$root_out_dir/v8_context_snapshot_32.bin" ]
|
||||
deps += [
|
||||
"//tools/v8_context_snapshot($android_secondary_abi_toolchain)",
|
||||
]
|
||||
} else {
|
||||
}
|
||||
if (!use_v8_context_snapshot || include_both_v8_snapshots) {
|
||||
_secondary_abi_out_dir =
|
||||
get_label_info("//v8($android_secondary_abi_toolchain)",
|
||||
"root_out_dir")
|
||||
renaming_sources = [ "$_secondary_abi_out_dir/snapshot_blob.bin" ]
|
||||
renaming_destinations = [ "snapshot_blob_32.bin" ]
|
||||
deps = [
|
||||
deps += [
|
||||
"//v8:run_mksnapshot_default($android_secondary_abi_toolchain)",
|
||||
]
|
||||
}
|
||||
|
@ -464,7 +464,8 @@ component("headless_non_renderer") {
|
||||
if (use_v8_context_snapshot) {
|
||||
data += [ "$root_out_dir/$v8_context_snapshot_filename" ]
|
||||
data_deps += [ "//tools/v8_context_snapshot" ]
|
||||
} else {
|
||||
}
|
||||
if (!use_v8_context_snapshot || include_both_v8_snapshots) {
|
||||
data += [ "$root_out_dir/snapshot_blob.bin" ]
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ buildflag_header("buildflags") {
|
||||
header = "buildflags.h"
|
||||
flags = [
|
||||
"USE_V8_CONTEXT_SNAPSHOT=$use_v8_context_snapshot",
|
||||
"INCLUDE_BOTH_V8_SNAPSHOTS=$include_both_v8_snapshots",
|
||||
"V8_CONTEXT_SNAPSHOT_FILENAME=\"$v8_context_snapshot_filename\"",
|
||||
]
|
||||
}
|
||||
|
@ -12,17 +12,24 @@ import("//build/config/chromeos/ui_mode.gni")
|
||||
import("//build/config/v8_target_cpu.gni")
|
||||
import("//v8/gni/v8.gni")
|
||||
|
||||
declare_args() {
|
||||
# If set, both snapshots are included. At this time, this only applicable to
|
||||
# android. In other words, it will not work correctly on other platforms.
|
||||
include_both_v8_snapshots = false
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
# TODO(crbug.com/40539769): Enable the feature on more environments.
|
||||
# Disable in mac and win cross builds since building Blink twice is slow.
|
||||
use_v8_context_snapshot =
|
||||
!is_chromeos && !is_android && !is_castos && !is_fuchsia &&
|
||||
# Android may build for both 64 bit and 32bit. When this happens, the
|
||||
# v8_target_cpu will not equal the target_cpu (for example,
|
||||
# v8_target_cpu == "arm" but target_os == "arm64").
|
||||
(v8_target_cpu == target_cpu || target_os == "android") &&
|
||||
!(host_toolchain == default_toolchain && is_msan) &&
|
||||
!(is_win && host_os != "win") && !(is_mac && host_os != "mac")
|
||||
include_both_v8_snapshots ||
|
||||
(!is_chromeos && !is_android && !is_castos && !is_fuchsia &&
|
||||
# Android may build for both 64 bit and 32bit. When this happens, the
|
||||
# v8_target_cpu will not equal the target_cpu (for example,
|
||||
# v8_target_cpu == "arm" but target_os == "arm64").
|
||||
(v8_target_cpu == target_cpu || target_os == "android") &&
|
||||
!(host_toolchain == default_toolchain && is_msan) &&
|
||||
!(is_win && host_os != "win") && !(is_mac && host_os != "mac"))
|
||||
|
||||
# We use a different filename for arm64 macOS builds so that the arm64 and
|
||||
# x64 snapshots can live side-by-side in a universal macOS app.
|
||||
|
Reference in New Issue
Block a user