fix: check DCHECK_IS_ON() instead of #ifdef DCHECK_IS_ON (#29674) (#30504)

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
This commit is contained in:
Jeremy Rose
2021-08-12 11:50:16 -07:00
committed by GitHub
parent 56cb0d52b9
commit 1c927dbbe8
6 changed files with 8 additions and 8 deletions

View File

@@ -236,7 +236,7 @@ base::string16 Menu::GetToolTipAt(int index) const {
return model_->GetToolTipAt(index);
}
#ifdef DCHECK_IS_ON
#if DCHECK_IS_ON()
base::string16 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 base::string16 GetAcceleratorTextAtForTesting(int index) const;
#endif

View File

@@ -35,7 +35,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()
base::string16 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()
base::string16 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.

View File

@@ -107,7 +107,7 @@ bool IsSameOrigin(const GURL& l, const GURL& r) {
return url::Origin::Create(l).IsSameOriginWith(url::Origin::Create(r));
}
#ifdef DCHECK_IS_ON
#if DCHECK_IS_ON()
std::vector<v8::Global<v8::Value>> weakly_tracked_values;
void WeaklyTrackValue(v8::Isolate* isolate, v8::Local<v8::Value> value) {
@@ -157,7 +157,7 @@ void Initialize(v8::Local<v8::Object> exports,
dict.SetMethod("requestGarbageCollectionForTesting",
&RequestGarbageCollectionForTesting);
dict.SetMethod("isSameOrigin", &IsSameOrigin);
#ifdef DCHECK_IS_ON
#if DCHECK_IS_ON()
dict.SetMethod("triggerFatalErrorForTesting", &TriggerFatalErrorForTesting);
dict.SetMethod("getWeaklyTrackedValues", &GetWeaklyTrackedValues);
dict.SetMethod("clearWeaklyTrackedValues", &ClearWeaklyTrackedValues);

View File

@@ -678,7 +678,7 @@ void Initialize(v8::Local<v8::Object> exports,
&electron::api::OverrideGlobalPropertyFromIsolatedWorld);
dict.SetMethod("_isCalledFromMainWorld",
&electron::api::IsCalledFromMainWorld);
#ifdef DCHECK_IS_ON
#if DCHECK_IS_ON()
dict.Set("_isDebug", true);
#endif
}