Browse Source

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

Co-authored-by: Jeremy Rose <[email protected]>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Jeremy Rose 3 years ago
parent
commit
1c927dbbe8

+ 2 - 2
shell/browser/api/electron_api_menu.cc

@@ -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();

+ 1 - 1
shell/browser/api/electron_api_menu.h

@@ -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
 

+ 1 - 1
shell/browser/api/electron_api_menu_mac.h

@@ -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
 

+ 1 - 1
shell/browser/api/electron_api_menu_mac.mm

@@ -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.

+ 2 - 2
shell/common/api/electron_api_v8_util.cc

@@ -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);

+ 1 - 1
shell/renderer/api/electron_api_context_bridge.cc

@@ -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
 }