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..1e09ddd3f0da0d2ded6ff213af7b084936014fd4 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,18 @@ AppNapActivity::~AppNapActivity() { |
DCHECK(!assertion_->obj.get()); |
}; |
+void AppNapActivity::InitializeAppNapSupport() { |
+ // Reason strings are the same as |
+ // what macOS sends in the corresponding call. |
+ // |
+ // Normally happens during launch services check-in. |
+ __CFRunLoopSetOptionsReason( |
+ 1, @"Finished checking in as application - waiting for events", 0); |
+ // Normally happens in a dispatch_once in the NSApplication event loop. |
+ __CFRunLoopSetOptionsReason( |
+ 0x3b000000, @"Finished delay after app launch and bundle check", 0); |
shrike
2017/06/02 19:57:53
Can 0x3b000000 be defined as a constant with a rea
lgrey
2017/06/05 14:49:43
It's magic to us, unfortunately (as is the "1" in
shrike
2017/06/05 15:29:36
So is it an "or" of NSActivity flags? If so, can y
|
+} |
+ |
void AppNapActivity::Begin() { |
DCHECK(!assertion_->obj.get()); |
id assertion = |