Bug 40939 - Full-screened content doesn't keep the display on: Safari not grabbing a power assertion?
Summary: Full-screened content doesn't keep the display on: Safari not grabbing a powe...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Jer Noble
URL:
Keywords: InRadar, PlatformOnly
Depends on:
Blocks:
 
Reported: 2010-06-21 13:43 PDT by Jer Noble
Modified: 2010-06-25 13:17 PDT (History)
2 users (show)

See Also:


Attachments
Patch (10.70 KB, patch)
2010-06-21 13:59 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (10.83 KB, patch)
2010-06-21 14:42 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (11.36 KB, patch)
2010-06-21 17:03 PDT, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (11.21 KB, patch)
2010-06-24 13:00 PDT, Jer Noble
eric.carlson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2010-06-21 13:43:56 PDT
Safari doesn't grab a power assertion from IOKit when doing full-screen video content.

See http://developer.apple.com/mac/library/releasenotes/Darwin/RN-IOKitPowerManagment/#//apple_ref/doc/uid/TP40006501-CH1-DontLinkElementID_4
Comment 1 Jer Noble 2010-06-21 13:44:08 PDT
rdar://problem/7996172
Comment 2 Jer Noble 2010-06-21 13:59:03 PDT
Created attachment 59285 [details]
Patch
Comment 3 WebKit Review Bot 2010-06-21 14:01:53 PDT
Attachment 59285 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
WebKit/mac/WebView/WebVideoFullscreenController.h:51:  _idleDisplaySleepAssertion is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit/mac/WebView/WebVideoFullscreenController.h:52:  _idleSystemSleepAssertion is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Eric Seidel (no email) 2010-06-21 14:07:22 PDT
Attachment 59285 [details] did not build on mac:
Build output: http://webkit-commit-queue.appspot.com/results/3303555
Comment 5 Jer Noble 2010-06-21 14:42:10 PDT
Created attachment 59294 [details]
Patch
Comment 6 WebKit Review Bot 2010-06-21 14:43:15 PDT
Attachment 59294 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
WebKit/mac/WebView/WebVideoFullscreenController.h:51:  _idleDisplaySleepAssertion is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit/mac/WebView/WebVideoFullscreenController.h:52:  _idleSystemSleepAssertion is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Eric Seidel (no email) 2010-06-21 14:50:00 PDT
Attachment 59294 [details] did not build on mac:
Build output: http://webkit-commit-queue.appspot.com/results/3341571
Comment 8 Jer Noble 2010-06-21 17:03:57 PDT
Created attachment 59315 [details]
Patch
Comment 9 WebKit Review Bot 2010-06-21 17:05:39 PDT
Attachment 59315 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
WebKit/mac/WebView/WebVideoFullscreenController.h:51:  _idleDisplaySleepAssertion is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit/mac/WebView/WebVideoFullscreenController.h:52:  _idleSystemSleepAssertion is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 Jer Noble 2010-06-24 13:00:08 PDT
Created attachment 59686 [details]
Patch
Comment 11 WebKit Review Bot 2010-06-24 13:05:47 PDT
Attachment 59686 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
WebKit/mac/WebView/WebVideoFullscreenController.h:51:  _idleDisplaySleepAssertion is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit/mac/WebView/WebVideoFullscreenController.h:52:  _idleSystemSleepAssertion is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 Eric Carlson 2010-06-24 13:32:40 PDT
Comment on attachment 59686 [details]
Patch


WebKit/WebKit.xcodeproj/project.pbxproj:777
 +  				CD8EAC7211CAC9A300774075 /* IOKit.framework */,
Should probably ask mrowe if it worth linking with the a Framework or if you should load it dynamically.


WebKit/mac/WebView/WebVideoFullscreenController.mm:235
 +     if (_mediaElement && _mediaElement->platformMedia().type == WebCore::PlatformMedia::QTMovieType)
 +          rate = [_mediaElement->platformMedia().media.qtMovie rate];
It might be worth having an accessor function for the QTMovie since "[_mediaElement->platformMedia().media.qtMovie" is used in the file in several places now

WebKit/mac/WebView/WebVideoFullscreenController.mm:238
 +      if (rate && !_isEndingFullscreen) {
 +          [self _disableIdleSystemSleep];
 +          [self _disableIdleDisplaySleep];
 +      } else {
 +          [self _enableIdleSystemSleep];
 +         [self _enableIdleDisplaySleep];
 +     }
  Is there any reason to have separate functions for system and display sleep? You always enabled or disabled so you may want to have just one function to disable and one to enable.
Comment 13 Jer Noble 2010-06-24 16:25:36 PDT
Committed r61796: <http://trac.webkit.org/changeset/61796>
Comment 14 Darin Adler 2010-06-25 13:11:30 PDT
Comment on attachment 59686 [details]
Patch

This should not statically link to the IOKit framework. We should soft link instead. Unless someone more expert than I on the Safari team said otherwise.
Comment 15 Jer Noble 2010-06-25 13:17:41 PDT
(In reply to comment #14)
> (From update of attachment 59686 [details])
> This should not statically link to the IOKit framework. We should soft link instead. Unless someone more expert than I on the Safari team said otherwise.

I talked this over with Eric and Mark before checking in;  AppKit.framework statically links against IOKit.framework, and WebKit.framework statically links against AppKit.framework.  So, it should be safe to link to this statically without affecting startup time, since we effectively already statically link against IOKit.framework.