Index: content/common/mac/app_nap_activity.mm |
diff --git a/content/common/mac/app_nap_activity.mm b/content/common/mac/app_nap_activity.mm |
index d2c82e80a8687d31ee4bbf1d4df96694d84facaf..4fa7b581e375ed305f04d38b5d76af622f81f475 100644 |
--- a/content/common/mac/app_nap_activity.mm |
+++ b/content/common/mac/app_nap_activity.mm |
@@ -8,6 +8,12 @@ |
#include "base/mac/scoped_nsobject.h" |
+extern "C" { |
+void __CFRunLoopSetOptionsReason(uint64_t options, |
+ NSString* reason, |
+ int unused); |
+} |
+ |
namespace content { |
namespace { |
@@ -33,6 +39,21 @@ AppNapActivity::~AppNapActivity() { |
DCHECK(!assertion_->obj.get()); |
}; |
+void AppNapActivity::InitializeAppNapSupport() { |
+ // Reason strings are the same as |
+ // what macOS sends in the corresponding call. |
+ // |options| (argument 1) are magic numbers as found in the |
+ // callsites mentioned above. |
+ // |
+ // Normally happens during launch services check-in. (HIToolbox) |
+ __CFRunLoopSetOptionsReason( |
+ 1, @"Finished checking in as application - waiting for events", 0); |
+ // Normally happens in a dispatch_once in the NSApplication event loop. |
+ // (CoreFoundation). |
+ __CFRunLoopSetOptionsReason( |
+ 0x3b000000, @"Finished delay after app launch and bundle check", 0); |
+} |
+ |
void AppNapActivity::Begin() { |
DCHECK(!assertion_->obj.get()); |
id assertion = |