fix: check DCHECK_IS_ON() instead of #ifdef DCHECK_IS_ON (#29620)
This commit is contained in:
		
					parent
					
						
							
								fed5ad5303
							
						
					
				
			
			
				commit
				
					
						34a4e26b24
					
				
			
		
					 6 changed files with 8 additions and 8 deletions
				
			
		|  | @ -236,7 +236,7 @@ std::u16string Menu::GetToolTipAt(int index) const { | ||||||
|   return model_->GetToolTipAt(index); |   return model_->GetToolTipAt(index); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef DCHECK_IS_ON | #if DCHECK_IS_ON() | ||||||
| std::u16string Menu::GetAcceleratorTextAtForTesting(int index) const { | std::u16string Menu::GetAcceleratorTextAtForTesting(int index) const { | ||||||
|   ui::Accelerator accelerator; |   ui::Accelerator accelerator; | ||||||
|   model_->GetAcceleratorAtWithParams(index, true, &accelerator); |   model_->GetAcceleratorAtWithParams(index, true, &accelerator); | ||||||
|  | @ -297,7 +297,7 @@ v8::Local<v8::ObjectTemplate> Menu::FillObjectTemplate( | ||||||
|       .SetMethod("isVisibleAt", &Menu::IsVisibleAt) |       .SetMethod("isVisibleAt", &Menu::IsVisibleAt) | ||||||
|       .SetMethod("popupAt", &Menu::PopupAt) |       .SetMethod("popupAt", &Menu::PopupAt) | ||||||
|       .SetMethod("closePopupAt", &Menu::ClosePopupAt) |       .SetMethod("closePopupAt", &Menu::ClosePopupAt) | ||||||
| #ifdef DCHECK_IS_ON | #if DCHECK_IS_ON() | ||||||
|       .SetMethod("getAcceleratorTextAt", &Menu::GetAcceleratorTextAtForTesting) |       .SetMethod("getAcceleratorTextAt", &Menu::GetAcceleratorTextAtForTesting) | ||||||
| #endif | #endif | ||||||
|       .Build(); |       .Build(); | ||||||
|  |  | ||||||
|  | @ -78,7 +78,7 @@ class Menu : public gin::Wrappable<Menu>, | ||||||
|                        int positioning_item, |                        int positioning_item, | ||||||
|                        base::OnceClosure callback) = 0; |                        base::OnceClosure callback) = 0; | ||||||
|   virtual void ClosePopupAt(int32_t window_id) = 0; |   virtual void ClosePopupAt(int32_t window_id) = 0; | ||||||
| #ifdef DCHECK_IS_ON | #if DCHECK_IS_ON() | ||||||
|   virtual std::u16string GetAcceleratorTextAtForTesting(int index) const; |   virtual std::u16string GetAcceleratorTextAtForTesting(int index) const; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -34,7 +34,7 @@ class MenuMac : public Menu { | ||||||
|                  int positioning_item, |                  int positioning_item, | ||||||
|                  base::OnceClosure callback); |                  base::OnceClosure callback); | ||||||
|   void ClosePopupAt(int32_t window_id) override; |   void ClosePopupAt(int32_t window_id) override; | ||||||
| #ifdef DCHECK_IS_ON | #if DCHECK_IS_ON() | ||||||
|   std::u16string GetAcceleratorTextAtForTesting(int index) const override; |   std::u16string GetAcceleratorTextAtForTesting(int index) const override; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -127,7 +127,7 @@ void MenuMac::ClosePopupAt(int32_t window_id) { | ||||||
|                                                    std::move(close_popup)); |                                                    std::move(close_popup)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifdef DCHECK_IS_ON | #if DCHECK_IS_ON() | ||||||
| std::u16string MenuMac::GetAcceleratorTextAtForTesting(int index) const { | std::u16string MenuMac::GetAcceleratorTextAtForTesting(int index) const { | ||||||
|   // A least effort to get the real shortcut text of NSMenuItem, the code does |   // A least effort to get the real shortcut text of NSMenuItem, the code does | ||||||
|   // not need to be perfect since it is test only. |   // not need to be perfect since it is test only. | ||||||
|  |  | ||||||
|  | @ -106,7 +106,7 @@ bool IsSameOrigin(const GURL& l, const GURL& r) { | ||||||
|   return url::Origin::Create(l).IsSameOriginWith(url::Origin::Create(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; | std::vector<v8::Global<v8::Value>> weakly_tracked_values; | ||||||
| 
 | 
 | ||||||
| void WeaklyTrackValue(v8::Isolate* isolate, v8::Local<v8::Value> value) { | void WeaklyTrackValue(v8::Isolate* isolate, v8::Local<v8::Value> value) { | ||||||
|  | @ -156,7 +156,7 @@ void Initialize(v8::Local<v8::Object> exports, | ||||||
|   dict.SetMethod("requestGarbageCollectionForTesting", |   dict.SetMethod("requestGarbageCollectionForTesting", | ||||||
|                  &RequestGarbageCollectionForTesting); |                  &RequestGarbageCollectionForTesting); | ||||||
|   dict.SetMethod("isSameOrigin", &IsSameOrigin); |   dict.SetMethod("isSameOrigin", &IsSameOrigin); | ||||||
| #ifdef DCHECK_IS_ON | #if DCHECK_IS_ON() | ||||||
|   dict.SetMethod("triggerFatalErrorForTesting", &TriggerFatalErrorForTesting); |   dict.SetMethod("triggerFatalErrorForTesting", &TriggerFatalErrorForTesting); | ||||||
|   dict.SetMethod("getWeaklyTrackedValues", &GetWeaklyTrackedValues); |   dict.SetMethod("getWeaklyTrackedValues", &GetWeaklyTrackedValues); | ||||||
|   dict.SetMethod("clearWeaklyTrackedValues", &ClearWeaklyTrackedValues); |   dict.SetMethod("clearWeaklyTrackedValues", &ClearWeaklyTrackedValues); | ||||||
|  |  | ||||||
|  | @ -723,7 +723,7 @@ void Initialize(v8::Local<v8::Object> exports, | ||||||
|                  &electron::api::OverrideGlobalPropertyFromIsolatedWorld); |                  &electron::api::OverrideGlobalPropertyFromIsolatedWorld); | ||||||
|   dict.SetMethod("_isCalledFromMainWorld", |   dict.SetMethod("_isCalledFromMainWorld", | ||||||
|                  &electron::api::IsCalledFromMainWorld); |                  &electron::api::IsCalledFromMainWorld); | ||||||
| #ifdef DCHECK_IS_ON | #if DCHECK_IS_ON() | ||||||
|   dict.Set("_isDebug", true); |   dict.Set("_isDebug", true); | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jeremy Rose
				Jeremy Rose