media: Use BUILDFLAG for OS checking

Use BUILDFLAG(IS_XXX) instead of defined(OS_XXX).

Generated by `os_buildflag_migration.py` (https://crrev.com/c/3311983).

Bug: 1234043
Test: No functionality change
Change-Id: I5f992512001e4e00ff46d534faa9f0217d37a523
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3373744
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Owners-Override: Xiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#959535}
NOKEYCHECK=True
GitOrigin-RevId: d4983e89a3c08a7a597160cff1b15313d5e93bb3
diff --git a/midi_manager.cc b/midi_manager.cc
index ffcc612..a53c1b2 100644
--- a/midi_manager.cc
+++ b/midi_manager.cc
@@ -80,8 +80,8 @@
       static_cast<Sample>(SendReceiveUsage::MAX) + 1);
 }
 
-#if !defined(OS_MAC) && !defined(OS_WIN) && \
-    !(defined(USE_ALSA) && defined(USE_UDEV)) && !defined(OS_ANDROID)
+#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_WIN) && \
+    !(defined(USE_ALSA) && defined(USE_UDEV)) && !BUILDFLAG(IS_ANDROID)
 MidiManager* MidiManager::Create(MidiService* service) {
   ReportUsage(Usage::CREATED_ON_UNSUPPORTED_PLATFORMS);
   return new MidiManager(service);
diff --git a/midi_manager_unittest.cc b/midi_manager_unittest.cc
index 054d14d..859f8e5 100644
--- a/midi_manager_unittest.cc
+++ b/midi_manager_unittest.cc
@@ -21,9 +21,9 @@
 #include "media/midi/task_service.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
 #include "media/midi/midi_manager_win.h"
-#endif  // defined(OS_WIN)
+#endif  // BUILDFLAG(IS_WIN)
 
 namespace midi {
 
@@ -93,7 +93,7 @@
   }
 
   base::WeakPtr<FakeMidiManager> manager() {
-#if defined(OS_MAC)
+#if BUILDFLAG(IS_MAC)
     // To avoid Core MIDI issues, MidiManager won't be destructed on macOS.
     // See https://crbug.com/718140.
     if (!manager_ ||
@@ -350,8 +350,8 @@
   // This #ifdef needs to be identical to the one in media/midi/midi_manager.cc.
   // Do not change the condition for disabling this test.
   bool IsSupported() {
-#if !defined(OS_MAC) && !defined(OS_WIN) && \
-    !(defined(USE_ALSA) && defined(USE_UDEV)) && !defined(OS_ANDROID)
+#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_WIN) && \
+    !(defined(USE_ALSA) && defined(USE_UDEV)) && !BUILDFLAG(IS_ANDROID)
     return false;
 #else
     return true;
@@ -368,7 +368,7 @@
   std::unique_ptr<MidiService> service_;
 };
 
-#if defined(OS_ANDROID)
+#if BUILDFLAG(IS_ANDROID)
 // The test sometimes fails on Android. https://crbug.com/844027
 #define MAYBE_CreatePlatformMidiManager DISABLED_CreatePlatformMidiManager
 #else
@@ -388,9 +388,9 @@
 
 TEST_F(PlatformMidiManagerTest, InstanceIdOverflow) {
   service()->task_service()->OverflowInstanceIdForTesting();
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
   MidiManagerWin::OverflowInstanceIdForTesting();
-#endif  // defined(OS_WIN)
+#endif  // BUILDFLAG(IS_WIN)
 
   StartSession();
   EXPECT_EQ(
diff --git a/midi_service.cc b/midi_service.cc
index 25b1ec3..4fb02d9 100644
--- a/midi_service.cc
+++ b/midi_service.cc
@@ -70,7 +70,7 @@
 // MIDIClientCreate starts failing with the OSStatus -50 after repeated calls
 // of MIDIClientDispose. It rarely happens, but once it starts, it will never
 // get back to be sane. See https://crbug.com/718140.
-#if !defined(OS_MAC)
+#if !BUILDFLAG(IS_MAC)
   if (!manager_->HasOpenSession()) {
     // MidiManager for each platform should be able to shutdown correctly even
     // if following destruction happens in the middle of StartInitialization().
@@ -103,7 +103,7 @@
   if (!threads_[runner_id]) {
     threads_[runner_id] = std::make_unique<base::Thread>(
         base::StringPrintf("MidiServiceThread(%zu)", runner_id));
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
     threads_[runner_id]->init_com_with_mta(true);
 #endif
     threads_[runner_id]->Start();
diff --git a/midi_switches.cc b/midi_switches.cc
index 08df596..72aa948 100644
--- a/midi_switches.cc
+++ b/midi_switches.cc
@@ -8,7 +8,7 @@
 namespace midi {
 namespace features {
 
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
 const base::Feature kMidiManagerWinrt{"MidiManagerWinrt",
                                       base::FEATURE_DISABLED_BY_DEFAULT};
 #endif
diff --git a/midi_switches.h b/midi_switches.h
index 1c0dbb1..f9abb13 100644
--- a/midi_switches.h
+++ b/midi_switches.h
@@ -14,7 +14,7 @@
 namespace midi {
 namespace features {
 
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
 MIDI_EXPORT extern const base::Feature kMidiManagerWinrt;
 #endif
 
diff --git a/task_service.cc b/task_service.cc
index 21bb8dc..e2a7b57 100644
--- a/task_service.cc
+++ b/task_service.cc
@@ -146,9 +146,9 @@
     threads_[thread] = std::make_unique<base::Thread>(
         base::StringPrintf("MidiService_TaskService_Thread(%zu)", runner_id));
     base::Thread::Options options;
-#if defined(OS_WIN)
+#if BUILDFLAG(IS_WIN)
     threads_[thread]->init_com_with_mta(true);
-#elif defined(OS_MAC)
+#elif BUILDFLAG(IS_MAC)
     options.message_pump_type = base::MessagePumpType::UI;
 #endif
     threads_[thread]->StartWithOptions(std::move(options));