[go: nahoru, domu]

LaCrOS: Replace defined(OS_CHROMEOS) with BUILDFLAG(IS_CHROMEOS_ASH)

The change is mostly mechanical replacing defined(OS_CHROMEOS) with
BUILDFLAG(IS_CHROMEOS_ASH) and GN variable is_chromeos with is_ash
with some special cases (For those cases please refer to
http://go/lacros-macros).

The patch is made in preparation to switching lacros build from
target_os=linux to target_os=chromeos. This will prevent lacros from
changing behaviour after the switch.

Bug: 1052397
Change-Id: I34cfe1a8d474a2b146138ce2502c4cb1875c37cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2494194
Reviewed-by: David Bokan <bokan@chromium.org>
Commit-Queue: Yuta Hijikata <ythjkt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825694}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 10078c6..3bb5e55 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -417,6 +417,7 @@
   deps = [
     "//base",
     "//base/third_party/dynamic_annotations",
+    "//build:chromeos_buildflags",
     "//components/viz/client",
     "//device/base/synchronization",
     "//gpu",
@@ -800,6 +801,7 @@
     ":cc",
     ":test_support",
     "//base/test:test_support",
+    "//build:chromeos_buildflags",
     "//cc/mojo_embedder",
     "//cc/paint",
     "//components/ukm:test_support",
diff --git a/cc/raster/gpu_raster_buffer_provider.cc b/cc/raster/gpu_raster_buffer_provider.cc
index 3d106918..76ecd0d 100644
--- a/cc/raster/gpu_raster_buffer_provider.cc
+++ b/cc/raster/gpu_raster_buffer_provider.cc
@@ -17,6 +17,7 @@
 #include "base/strings/stringprintf.h"
 #include "base/trace_event/process_memory_dump.h"
 #include "base/trace_event/trace_event.h"
+#include "build/chromeos_buildflags.h"
 #include "cc/base/histograms.h"
 #include "cc/paint/display_item_list.h"
 #include "cc/paint/paint_canvas.h"
@@ -310,7 +311,7 @@
       texture_target_(backing->texture_target),
       texture_is_overlay_candidate_(backing->overlay_candidate),
       mailbox_(backing->mailbox) {
-#if defined(OS_CHROMEOS)
+#if BUILDFLAG(IS_CHROMEOS_ASH)
   // Only do this in Chrome OS with OOP-R because:
   //   1) We will use this timestamp to measure raster scheduling delay and we
   //      only need to collect that data to assess the impact of hardware
@@ -554,7 +555,7 @@
       << "Why are we rastering a tile that's not dirty?";
 
   if (measure_raster_metric) {
-#if defined(OS_CHROMEOS)
+#if BUILDFLAG(IS_CHROMEOS_ASH)
     // Use a query to detect when the GPU side is ready to start issuing raster
     // work to the driver. We will use the resulting timestamp to measure raster
     // scheduling delay. We only care about this in Chrome OS and when OOP-R is
diff --git a/cc/raster/one_copy_raster_buffer_provider.cc b/cc/raster/one_copy_raster_buffer_provider.cc
index c14de08..191a1aa 100644
--- a/cc/raster/one_copy_raster_buffer_provider.cc
+++ b/cc/raster/one_copy_raster_buffer_provider.cc
@@ -16,6 +16,8 @@
 #include "base/strings/stringprintf.h"
 #include "base/trace_event/process_memory_dump.h"
 #include "base/trace_event/trace_event.h"
+#include "build/build_config.h"
+#include "build/chromeos_buildflags.h"
 #include "cc/base/histograms.h"
 #include "cc/base/math_util.h"
 #include "components/viz/common/gpu/context_provider.h"
@@ -423,7 +425,7 @@
     query_target = GL_COMMANDS_COMPLETED_CHROMIUM;
   }
 
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
+#if BUILDFLAG(IS_CHROMEOS_ASH) && defined(ARCH_CPU_ARM_FAMILY)
   // TODO(reveman): This avoids a performance problem on ARM ChromeOS devices.
   // https://crbug.com/580166
   query_target = GL_COMMANDS_ISSUED_CHROMIUM;
diff --git a/cc/raster/raster_buffer_provider_unittest.cc b/cc/raster/raster_buffer_provider_unittest.cc
index 9536912..42a99ba 100644
--- a/cc/raster/raster_buffer_provider_unittest.cc
+++ b/cc/raster/raster_buffer_provider_unittest.cc
@@ -29,6 +29,7 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "base/time/time.h"
 #include "build/build_config.h"
+#include "build/chromeos_buildflags.h"
 #include "cc/base/unique_notifier.h"
 #include "cc/paint/draw_image.h"
 #include "cc/raster/bitmap_raster_buffer_provider.h"
@@ -663,7 +664,7 @@
   base::HistogramBase::Count expected_delay_histogram_all_tiles_count = 0;
   base::HistogramBase::Count expected_delay_histogram_jpeg_tiles_count = 0;
   base::HistogramBase::Count expected_delay_histogram_webp_tiles_count = 0;
-#if defined(OS_CHROMEOS)
+#if BUILDFLAG(IS_CHROMEOS_ASH)
   if (GetParam() == RASTER_BUFFER_PROVIDER_TYPE_GPU_OOPR) {
     expected_delay_histogram_all_tiles_count = 5;
     expected_delay_histogram_jpeg_tiles_count = 3;
diff --git a/cc/trees/layer_tree_host_pixeltest_tiles.cc b/cc/trees/layer_tree_host_pixeltest_tiles.cc
index 3f84424c..d837df9 100644
--- a/cc/trees/layer_tree_host_pixeltest_tiles.cc
+++ b/cc/trees/layer_tree_host_pixeltest_tiles.cc
@@ -5,6 +5,7 @@
 #include <stddef.h>
 
 #include "build/build_config.h"
+#include "build/chromeos_buildflags.h"
 #include "cc/layers/content_layer_client.h"
 #include "cc/layers/picture_layer.h"
 #include "cc/paint/display_item_list.h"
@@ -239,7 +240,7 @@
                          ::testing::ValuesIn(kTestCases),
                          ::testing::PrintToStringParamName());
 
-#if defined(OS_CHROMEOS) || defined(MEMORY_SANITIZER) || \
+#if BUILDFLAG(IS_CHROMEOS_ASH) || defined(MEMORY_SANITIZER) || \
     defined(ADDRESS_SANITIZER) || defined(OS_FUCHSIA)
 // TODO(crbug.com/1045521): Flakes on all slower bots.
 #define MAYBE_PartialRaster DISABLED_PartialRaster
@@ -286,7 +287,7 @@
 #if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(THREAD_SANITIZER)
 // Flaky on Linux TSAN. https://crbug.com/707711
 #define MAYBE_PartialRaster DISABLED_PartialRaster
-#elif defined(OS_CHROMEOS) || defined(MEMORY_SANITIZER) || \
+#elif BUILDFLAG(IS_CHROMEOS_ASH) || defined(MEMORY_SANITIZER) || \
     defined(ADDRESS_SANITIZER) || defined(OS_FUCHSIA)
 // TODO(crbug.com/1045521): Flakes on all slower bots.
 #define MAYBE_PartialRaster DISABLED_PartialRaster