# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/cast.gni")
import("//build/config/chrome_build.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/dcheck_always_on.gni")
import("//build/config/features.gni")
import("//build/config/ios/config.gni")

declare_args() {
  # Specify the current PGO phase.
  # Here's the different values that can be used:
  #     0 : Means that PGO is turned off.
  #     1 : Used during the PGI (instrumentation) phase.
  #     2 : Used during the PGO (optimization) phase.
  # PGO profiles are generated from `dcheck_always_on = false` builds. Mixing
  # those profiles with `dcheck_always_on = true` builds can cause the compiler
  # to think some code is hotter than it actually is, potentially causing very
  # bad compile times.
  chrome_pgo_phase = 0
  if (!dcheck_always_on && is_official_build &&
      # TODO(crbug.com/1336055): Update this now-outdated condition with regard
      # to chromecast and determine whether chromeos_is_browser_only is
      # obsolete.
      (is_high_end_android || is_win || is_mac || is_fuchsia ||
       (is_linux && !is_castos) ||
       (is_ios && use_blink && target_environment == "device") ||
       (is_chromeos_lacros && is_chromeos_device))) {
    chrome_pgo_phase = 2
  }

  # When using chrome_pgo_phase = 2, read profile data from this path.
  pgo_data_path = ""
}