fix: check DCHECK_IS_ON() instead of #ifdef DCHECK_IS_ON (#29620)

This commit is contained in:
Jeremy Rose 2021-06-13 19:06:09 -07:00 committed by GitHub
parent fed5ad5303
commit 34a4e26b24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 8 deletions

View file

@ -236,7 +236,7 @@ std::u16string Menu::GetToolTipAt(int index) const {
return model_->GetToolTipAt(index);
}
#ifdef DCHECK_IS_ON
#if DCHECK_IS_ON()
std::u16string Menu::GetAcceleratorTextAtForTesting(int index) const {
ui::Accelerator accelerator;
model_->GetAcceleratorAtWithParams(index, true, &accelerator);
@ -297,7 +297,7 @@ v8::Local<v8::ObjectTemplate> Menu::FillObjectTemplate(
.SetMethod("isVisibleAt", &Menu::IsVisibleAt)
.SetMethod("popupAt", &Menu::PopupAt)
.SetMethod("closePopupAt", &Menu::ClosePopupAt)
#ifdef DCHECK_IS_ON
#if DCHECK_IS_ON()
.SetMethod("getAcceleratorTextAt", &Menu::GetAcceleratorTextAtForTesting)
#endif
.Build();

View file

@ -78,7 +78,7 @@ class Menu : public gin::Wrappable<Menu>,
int positioning_item,
base::OnceClosure callback) = 0;
virtual void ClosePopupAt(int32_t window_id) = 0;
#ifdef DCHECK_IS_ON
#if DCHECK_IS_ON()
virtual std::u16string GetAcceleratorTextAtForTesting(int index) const;
#endif

View file

@ -34,7 +34,7 @@ class MenuMac : public Menu {
int positioning_item,
base::OnceClosure callback);
void ClosePopupAt(int32_t window_id) override;
#ifdef DCHECK_IS_ON
#if DCHECK_IS_ON()
std::u16string GetAcceleratorTextAtForTesting(int index) const override;
#endif

View file

@ -127,7 +127,7 @@ void MenuMac::ClosePopupAt(int32_t window_id) {
std::move(close_popup));
}
#ifdef DCHECK_IS_ON
#if DCHECK_IS_ON()
std::u16string MenuMac::GetAcceleratorTextAtForTesting(int index) const {
// A least effort to get the real shortcut text of NSMenuItem, the code does
// not need to be perfect since it is test only.