[Build] Make optimize_for_size assignable via args.gn.

Previously the build variable optimize_for_size was hard-coded as

  optimize_for_size = is_android || is_chromecast || is_fuchsia || is_ios

This CL makes the flag assignable via args.gn (with the above as
default), to support builds for high-end devices.

Bug: 1291808
Change-Id: Icfe4faf97b9ab92e361a2ea32628f90664153e22
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3667786
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Samuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1007429}
NOKEYCHECK=True
GitOrigin-RevId: 67f5e400bdd9526a3686e103a55775b97b9eb8b0
diff --git a/compiler/compiler.gni b/compiler/compiler.gni
index 0567598..36108aa 100644
--- a/compiler/compiler.gni
+++ b/compiler/compiler.gni
@@ -129,16 +129,16 @@
   # performed as mitigation against Return-oriented programming (ROP).
   # https://chromium.googlesource.com/chromium/src/+/main/docs/design/sandbox.md#cet-shadow-stack
   enable_cet_shadow_stack = target_cpu == "x64"
+
+  # If true, optimize for size. Does not affect windows builds.
+  # Linux & Mac favor speed over size.
+  # TODO(brettw) it's weird that Mac and desktop Linux are different. We should
+  # explore favoring size over speed in this case as well.
+  optimize_for_size = is_android || is_chromecast || is_fuchsia || is_ios
 }
 
 assert(!is_cfi || use_thin_lto, "CFI requires ThinLTO")
 
-# If true, optimize for size. Does not affect windows builds.
-# Linux & Mac favor speed over size.
-# TODO(brettw) it's weird that Mac and desktop Linux are different. We should
-# explore favoring size over speed in this case as well.
-optimize_for_size = is_android || is_chromecast || is_fuchsia || is_ios
-
 declare_args() {
   # Whether we should consider the profile we're using to be accurate. Accurate
   # profiles have the benefit of (potentially substantial) binary size