New issue
Advanced search Search tips

Issue 650797 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2016
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug

Blocking:
issue 622481



Sign in to add a comment

Prepare chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc for 10.8 deployment target.

Project Member Reported by erikc...@chromium.org, Sep 27 2016

Issue description

UpdateSystemActivity has been deprecated since 10.8. It looks like it's used to disable sleep, and that IOKit should be able to do similar.

http://stackoverflow.com/a/27426333
 
[23921/38611] CXX obj/chrome/browser/browser/pepper_flash_browser_host.o
../../chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc:92:3: warning: 'UpdateSystemActivity' is deprecated: first deprecated in macOS 10.8 [-Wdeprecated-declarations]
  UpdateSystemActivity(OverallAct);
  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/Power.h:367:1: note: 'UpdateSystemActivity' has been explicitly marked deprecated here
UpdateSystemActivity(UInt8 activity)                          __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_8,__IPHONE_NA,__IPHONE_NA);
^
1 warning generated.

Labels: OS-Mac
Status: Available (was: Untriaged)
I looked into the documentation. UpdateSystemActivity() prevented sleep if it was called every 30 seconds. It looks like the IOKit function IOPMAssertionDeclareUserActivity (https://developer.apple.com/reference/iokit/1557127-iopmassertiondeclareuseractivity) is the most suitable replacement. 

I think pmset -g assertions should show an assertion named com.apple.system.powermanagement.disableappsleep.PID if this succeeds.
It looks like the assertion is set with the new API:

 pid 16125(Google Chrome): [0x000fac650009269f] 00:00:02 UserIsActive named: "PepperFlashBrowserHost preventing screensaver." 
Presumably we're disabling sleep for non-Pepper video, so we just need to unify the two calls.
device/power_save_blocker/power_save_blocker_mac.cc
Good point, would that be this code that uses the PowerSaveBlocker which seems to have abstracted out the implementation details across platforms?

https://cs.chromium.org/chromium/src/content/browser/media/media_web_contents_observer.cc?q=PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep&sq=package:chromium&dr=C&l=190
Owner: ccameron@chromium.org
Status: Assigned (was: Available)
Yup, exactly.

The interface from Flash is ill-defined because it just says "call this function 'pretty often' and things should be okay".

I'll create something that creates one of those objects and keeps it alive for another 30 (or maybe 60) seconds every time it's called.
Thanks. I did notice that the flash interface was odd, and I'll leave this to you now.
(looks like this might be the last remaining blocker for bumping up the deployment target)
yeah, I've been pinging ccameron and bbudge to try to get it moving.
Project Member

Comment 12 by bugdroid1@chromium.org, Oct 18 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/04c2bac53d96749f85f9046d9923810df58d41c1

commit 04c2bac53d96749f85f9046d9923810df58d41c1
Author: ccameron <ccameron@chromium.org>
Date: Tue Oct 18 01:06:27 2016

Flash: Use better APIs for preventing sleep

The API that this was using on Mac has been deprecated, and is
preventing us from upgrading our SDK version. We have a cross-platform
sleep-preventation API. Use that instead.

The Flash API for preventing power is a bit idiosyncratic in that it
doesn't create and destroy power blockers, but rather says "please don't
go to sleep for a while", where "a while" is not defined. Empirically,
twitch.tv called this method every 10 seconds. Use a timeout of 45
seconds to be safe.

BUG= 650797 

Review-Url: https://codereview.chromium.org/2388313004
Cr-Commit-Position: refs/heads/master@{#425843}

[modify] https://crrev.com/04c2bac53d96749f85f9046d9923810df58d41c1/chrome/browser/BUILD.gn
[modify] https://crrev.com/04c2bac53d96749f85f9046d9923810df58d41c1/chrome/browser/DEPS
[modify] https://crrev.com/04c2bac53d96749f85f9046d9923810df58d41c1/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc
[modify] https://crrev.com/04c2bac53d96749f85f9046d9923810df58d41c1/chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h

Status: Fixed (was: Assigned)

Sign in to add a comment