misc2: Use BUILDFLAG for OS checking
Use #if BUILDFLAG(IS_XXX) instead of #ifdef OS_XXX.
Generated by `os_buildflag_migration.py` (https://crrev.com/c/3311983)
with modifications to handle #ifdef and #ifndef.
R=thakis@chromium.org
Bug: 1234043
Test: No functionality change
Change-Id: Id37dfaac94ba86eaa96a95b0fb07a6931c1b4975
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3405419
Reviewed-by: Nico Weber <thakis@chromium.org>
Owners-Override: Nico Weber <thakis@chromium.org>
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#962122}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
d4fe744248
commit
00d05a0406
base/threading
chromeos/services/secure_channel
components
content_settings
core
browser
omnibox
reading_list
soda
content
browser
accessibility
devtools
prerender
renderer_host
screen_orientation
web_contents
renderer
device/bluetooth
net
url
@ -982,7 +982,7 @@ HangWatchState::HangWatchState(HangWatcher::ThreadType thread_type)
|
||||
// On macOS the thread ids used by CrashPad are not the same as the ones
|
||||
// provided by PlatformThread. Make sure to use the same for correct
|
||||
// attribution.
|
||||
#ifdef OS_MAC
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
pthread_threadid_np(pthread_self(), &thread_id_);
|
||||
#else
|
||||
thread_id_ = PlatformThread::CurrentId();
|
||||
|
@ -5,15 +5,18 @@
|
||||
#include "chromeos/services/secure_channel/ble_weave_packet_generator.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
#ifdef OS_WIN
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "build/build_config.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "base/check_op.h"
|
||||
|
||||
namespace chromeos {
|
||||
|
||||
namespace secure_channel {
|
||||
|
@ -4,7 +4,9 @@
|
||||
|
||||
#include "chromeos/services/secure_channel/ble_weave_packet_receiver.h"
|
||||
|
||||
#ifdef OS_WIN
|
||||
#include "build/build_config.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
|
@ -86,7 +86,7 @@ class CookieSettingsTest : public testing::Test {
|
||||
kHttpsSubdomainSite("https://www.example.com"),
|
||||
kHttpsSite8080("https://example.com:8080"),
|
||||
kAllHttpsSitesPattern(ContentSettingsPattern::FromString("https://*")) {
|
||||
#ifdef OS_IOS
|
||||
#if BUILDFLAG(IS_IOS)
|
||||
feature_list_.InitAndEnableFeature(kImprovedCookieControls);
|
||||
#else
|
||||
feature_list_.Init();
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "net/base/escape.h"
|
||||
#include "url/url_constants.h"
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
#include "base/android/jni_string.h"
|
||||
#include "components/omnibox/browser/jni_headers/SuggestionAnswer_jni.h"
|
||||
|
||||
@ -420,7 +420,7 @@ void SuggestionAnswer::LogAnswerUsed(
|
||||
const char SuggestionAnswer::kAnswerUsedUmaHistogramName[] =
|
||||
"Omnibox.SuggestionUsed.AnswerInSuggest";
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
namespace {
|
||||
|
||||
ScopedJavaLocalRef<jobject> CreateJavaTextField(
|
||||
|
@ -11,10 +11,11 @@
|
||||
|
||||
#include "base/gtest_prod_util.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "build/build_config.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
#include "base/android/scoped_java_ref.h"
|
||||
#endif
|
||||
|
||||
@ -259,7 +260,7 @@ class SuggestionAnswer {
|
||||
// omnibox to go somewhere.
|
||||
static void LogAnswerUsed(const absl::optional<SuggestionAnswer>& answer);
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
base::android::ScopedJavaLocalRef<jobject> CreateJavaObject() const;
|
||||
#endif
|
||||
|
||||
|
@ -40,7 +40,7 @@ bool IsReadingListEnabled() {
|
||||
const base::Feature kReadLaterBackendMigration{
|
||||
"ReadLaterBackendMigration", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Feature flag used for enabling read later reminder notification.
|
||||
const base::Feature kReadLaterReminderNotification{
|
||||
"ReadLaterReminderNotification", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
@ -39,7 +39,7 @@ bool IsReadingListEnabled();
|
||||
// details.
|
||||
extern const base::Feature kReadLaterBackendMigration;
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Feature flag used for enabling read later reminder notification.
|
||||
extern const base::Feature kReadLaterReminderNotification;
|
||||
#endif
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "base/notreached.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/strcat.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/component_updater/component_updater_paths.h"
|
||||
#include "components/crx_file/id_util.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
@ -29,7 +30,7 @@ const char kSodaBinaryInstallationSuccessTimeTaken[] =
|
||||
const char kSodaBinaryInstallationFailureTimeTaken[] =
|
||||
"SodaInstaller.BinaryInstallationFailureTime";
|
||||
|
||||
#ifdef OS_WIN
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
constexpr base::FilePath::CharType kSodaBinaryRelativePath[] =
|
||||
FILE_PATH_LITERAL("SODAFiles/SODA.dll");
|
||||
#else
|
||||
|
@ -335,7 +335,7 @@ TEST_F(BrowserAccessibilityTest, GetInnerTextRangeBoundsRect) {
|
||||
root_accessible->PlatformGetChild(0);
|
||||
ASSERT_NE(nullptr, static_text_accessible);
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Android disallows getting inner text from root accessibility nodes.
|
||||
EXPECT_EQ(gfx::Rect(0, 0, 0, 0).ToString(),
|
||||
root_accessible
|
||||
@ -377,7 +377,7 @@ TEST_F(BrowserAccessibilityTest, GetInnerTextRangeBoundsRect) {
|
||||
ui::AXClippingBehavior::kUnclipped)
|
||||
.ToString());
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Android disallows getting inner text from root accessibility nodes.
|
||||
EXPECT_EQ(gfx::Rect(0, 0, 0, 0).ToString(),
|
||||
root_accessible
|
||||
@ -548,7 +548,7 @@ TEST_F(BrowserAccessibilityTest, GetInnerTextRangeBoundsRectMultiElement) {
|
||||
ui::AXClippingBehavior::kUnclipped)
|
||||
.ToString());
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Android disallows getting inner text from accessibility root nodes.
|
||||
EXPECT_EQ(gfx::Rect(0, 0, 0, 0).ToString(),
|
||||
root_accessible
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "build/build_config.h"
|
||||
#include "content/browser/accessibility/browser_accessibility.h"
|
||||
#include "content/browser/accessibility/browser_accessibility_manager.h"
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
#include "content/browser/accessibility/browser_accessibility_manager_android.h"
|
||||
#elif OS_FUCHSIA
|
||||
#include "content/browser/accessibility/browser_accessibility_manager_fuchsia.h"
|
||||
@ -21,7 +21,7 @@ namespace content {
|
||||
|
||||
namespace {
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
class TestBrowserAccessibilityManager
|
||||
: public BrowserAccessibilityManagerAndroid {
|
||||
public:
|
||||
|
@ -69,7 +69,7 @@
|
||||
#include "ui/gfx/skbitmap_operations.h"
|
||||
#include "ui/snapshot/snapshot.h"
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
#include "content/browser/renderer_host/compositor_impl_android.h"
|
||||
#endif
|
||||
|
||||
@ -218,7 +218,7 @@ PageHandler::PageHandler(
|
||||
emulation_handler_(emulation_handler),
|
||||
browser_handler_(browser_handler) {
|
||||
bool create_video_consumer = true;
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
constexpr auto kScreencastPixelFormat = media::PIXEL_FORMAT_I420;
|
||||
// Video capture doesn't work on Android WebView. Use CopyFromSurface instead.
|
||||
if (!CompositorImpl::IsInitialized())
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/inspector_protocol/crdtp/json.h"
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
#include "content/browser/renderer_host/compositor_impl_android.h"
|
||||
#endif
|
||||
|
||||
@ -512,7 +512,7 @@ TracingHandler::TracingHandler(DevToolsIOContext* io_context)
|
||||
gzip_compression_(false),
|
||||
buffer_usage_reporting_interval_(0) {
|
||||
bool use_video_capture_api = true;
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Video capture API cannot be used on Android WebView.
|
||||
if (!CompositorImpl::IsInitialized())
|
||||
use_video_capture_api = false;
|
||||
|
@ -369,7 +369,7 @@ bool RenderFrameDevToolsAgentHost::AttachSession(DevToolsSession* session,
|
||||
#endif // !BUILDFLAG(IS_ANDROID)
|
||||
|
||||
if (sessions().empty()) {
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// With video capture API snapshots happen in TracingHandler. However, the
|
||||
// video capture API cannot be used with Android WebView so
|
||||
// DevToolsFrameTraceRecorder takes snapshots.
|
||||
|
@ -296,7 +296,7 @@ IN_PROC_BROWSER_TEST_P(PrerenderOriginTrialBrowserTest, WithoutTrialToken) {
|
||||
case FeatureEnabledType::kDefault:
|
||||
// Currently blink::features::kPrerender2 is default-enabled only on
|
||||
// Android.
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
if (testing::get<1>(GetParam()) == BlinkFeatureEnabledType::kEnabled) {
|
||||
CheckFeatureEnabled(true);
|
||||
} else {
|
||||
@ -328,7 +328,7 @@ IN_PROC_BROWSER_TEST_P(PrerenderOriginTrialBrowserTest, WithTrialToken) {
|
||||
case FeatureEnabledType::kEnabled:
|
||||
if (testing::get<1>(GetParam()) == BlinkFeatureEnabledType::kDisabled) {
|
||||
// Currently Origin Trial for Prerender2 is available only on Android.
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
CheckFeatureEnabled(false);
|
||||
#else // BUILDFLAG(IS_ANDROID)
|
||||
CheckFeatureDisabled();
|
||||
@ -339,7 +339,7 @@ IN_PROC_BROWSER_TEST_P(PrerenderOriginTrialBrowserTest, WithTrialToken) {
|
||||
break;
|
||||
case FeatureEnabledType::kDefault:
|
||||
// Currently Origin Trial for Prerender2 is available only on Android.
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
if (testing::get<1>(GetParam()) == BlinkFeatureEnabledType::kEnabled) {
|
||||
CheckFeatureEnabled(true);
|
||||
} else {
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "base/observer_list.h"
|
||||
#include "base/win/windows_version.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/browser/accessibility/browser_accessibility.h"
|
||||
#include "content/browser/accessibility/browser_accessibility_manager.h"
|
||||
#include "content/browser/renderer_host/delegated_frame_host.h"
|
||||
@ -195,7 +196,7 @@ class RenderWidgetHostViewAuraBrowserMockIMETest : public ContentBrowserTest {
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef OS_WIN
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewAuraBrowserMockIMETest,
|
||||
VirtualKeyboardAccessibilityFocusTest) {
|
||||
// The keyboard input pane events are not supported on Win7.
|
||||
@ -418,6 +419,6 @@ IN_PROC_BROWSER_TEST_F(RenderWidgetHostViewAuraBrowserMockIMETest,
|
||||
SimulateTapAt(web_contents, gfx::Point(left + 1, top + 1));
|
||||
type_observer_none.Wait();
|
||||
}
|
||||
#endif // #ifdef OS_WIN
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
} // namespace content
|
||||
|
@ -378,7 +378,7 @@ IN_PROC_BROWSER_TEST_F(ScreenOrientationOOPIFBrowserTest,
|
||||
EvalJs(root->current_frame_host(), "screen.orientation.angle"));
|
||||
}
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// This test is disabled because th trybots run in system portrait lock, which
|
||||
// prevents the test from changing the screen orientation.
|
||||
IN_PROC_BROWSER_TEST_F(ScreenOrientationOOPIFBrowserTest,
|
||||
|
@ -4263,7 +4263,7 @@ bool WebContentsImpl::ShouldIgnoreUnresponsiveRenderer() {
|
||||
// Ignore unresponsive renderers if the debugger is attached to them since the
|
||||
// unresponsiveness might be a result of the renderer sitting on a breakpoint.
|
||||
//
|
||||
#ifdef OS_WIN
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Check if a windows debugger is attached to the renderer process.
|
||||
base::ProcessHandle process_handle =
|
||||
GetMainFrame()->GetProcess()->GetProcess().Handle();
|
||||
|
@ -5175,7 +5175,7 @@ void RenderFrameImpl::BeginNavigation(
|
||||
!url.SchemeIs(url::kDataScheme);
|
||||
DCHECK(!(use_archive && IsMainFrame()));
|
||||
|
||||
#ifdef OS_ANDROID
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
bool render_view_was_created_by_renderer =
|
||||
render_view_->was_created_by_renderer_;
|
||||
// The handlenavigation API is deprecated and will be removed once
|
||||
|
@ -317,7 +317,7 @@ TEST_F(BluetoothTest, LowEnergyDeviceProperties) {
|
||||
BluetoothDevice* device = SimulateLowEnergyDevice(1);
|
||||
ASSERT_TRUE(device);
|
||||
// Bluetooth class information for BLE device is not available on Windows.
|
||||
#ifndef OS_WIN
|
||||
#if !BUILDFLAG(IS_WIN)
|
||||
EXPECT_EQ(0x1F00u, device->GetBluetoothClass());
|
||||
#endif
|
||||
EXPECT_EQ(kTestDeviceAddress1, device->GetAddress());
|
||||
|
@ -309,7 +309,7 @@ std::unique_ptr<DnsConfigService> DnsConfigService::CreateSystemService() {
|
||||
// DnsConfigService on iOS doesn't watch the config so its result can become
|
||||
// inaccurate at any time. Disable it to prevent promulgation of inaccurate
|
||||
// DnsConfigs.
|
||||
#ifdef OS_IOS
|
||||
#if BUILDFLAG(IS_IOS)
|
||||
return nullptr;
|
||||
#else // BUILDFLAG(IS_IOS)
|
||||
return std::unique_ptr<DnsConfigService>(
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/strings/abseil_string_conversions.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "build/build_config.h"
|
||||
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
@ -67,7 +68,7 @@ void QuicRecordTraceImpl(absl::string_view identifier, absl::string_view data) {
|
||||
// TODO(vasilvv): replace this with absl::Time once it's usable in Chromium.
|
||||
time_t now_ts = time(nullptr);
|
||||
tm now;
|
||||
#ifdef OS_WIN
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
gmtime_s(&now, &now_ts);
|
||||
#else
|
||||
gmtime_r(&now_ts, &now);
|
||||
|
@ -2,10 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "url/url_util.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "base/cxx17_backports.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "build/build_config.h"
|
||||
#include "testing/gtest/include/gtest/gtest-message.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
@ -13,7 +16,6 @@
|
||||
#include "url/url_canon.h"
|
||||
#include "url/url_canon_stdstring.h"
|
||||
#include "url/url_test_utils.h"
|
||||
#include "url/url_util.h"
|
||||
|
||||
namespace url {
|
||||
|
||||
@ -574,7 +576,7 @@ absl::optional<std::string> CanonicalizeSpec(base::StringPiece spec,
|
||||
}
|
||||
} // namespace
|
||||
|
||||
#ifdef OS_WIN
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// Regression test for https://crbug.com/1252658.
|
||||
TEST_F(URLUtilTest, TestCanonicalizeWindowsPathWithLeadingNUL) {
|
||||
auto PrefixWithNUL = [](std::string&& s) -> std::string { return '\0' + s; };
|
||||
|
Reference in New Issue
Block a user