Title: [104619] trunk/Source/WebCore
- Revision
- 104619
- Author
- jer.no...@apple.com
- Date
- 2012-01-10 12:43:20 -0800 (Tue, 10 Jan 2012)
Log Message
REGRESSION (r102024): Having the Bing homepage open prevents idle sleep
https://bugs.webkit.org/show_bug.cgi?id=75972
Reviewed by Oliver Hunt.
No new tests; no testing infrastructure exists to test display sleep assertions.
Only disable idle and display sleep when a video element is not paused, not looping, and
has both a video and audio track.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerRateChanged): Factor into updateDisableSleep() and
shouldDisplaySleep().
(WebCore::HTMLMediaElement::setLoop): Ditto.
(WebCore::HTMLMediaElement::attributeChanged): Ditto.
(WebCore::HTMLMediaElement::updateDisableSleep):
(WebCore::HTMLMediaElement::shouldDisableSleep):
* html/HTMLMediaElement.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (104618 => 104619)
--- trunk/Source/WebCore/ChangeLog 2012-01-10 20:42:41 UTC (rev 104618)
+++ trunk/Source/WebCore/ChangeLog 2012-01-10 20:43:20 UTC (rev 104619)
@@ -1,3 +1,24 @@
+2012-01-10 Jer Noble <jer.no...@apple.com>
+
+ REGRESSION (r102024): Having the Bing homepage open prevents idle sleep
+ https://bugs.webkit.org/show_bug.cgi?id=75972
+
+ Reviewed by Oliver Hunt.
+
+ No new tests; no testing infrastructure exists to test display sleep assertions.
+
+ Only disable idle and display sleep when a video element is not paused, not looping, and
+ has both a video and audio track.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaPlayerRateChanged): Factor into updateDisableSleep() and
+ shouldDisplaySleep().
+ (WebCore::HTMLMediaElement::setLoop): Ditto.
+ (WebCore::HTMLMediaElement::attributeChanged): Ditto.
+ (WebCore::HTMLMediaElement::updateDisableSleep):
+ (WebCore::HTMLMediaElement::shouldDisableSleep):
+ * html/HTMLMediaElement.h:
+
2012-01-09 Matthew Delaney <mdela...@apple.com>
[Mac] Accelerate canvas layers with the same logic as accelerating the canvas itself
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (104618 => 104619)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-01-10 20:42:41 UTC (rev 104618)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-01-10 20:43:20 UTC (rev 104619)
@@ -326,6 +326,10 @@
scheduleLoad(MediaResource);
} else if (attrName == controlsAttr)
configureMediaControls();
+#if PLATFORM(MAC)
+ else if (attrName == loopAttr)
+ updateDisableSleep();
+#endif
}
void HTMLMediaElement::parseMappedAttribute(Attribute* attr)
@@ -2006,6 +2010,9 @@
{
LOG(Media, "HTMLMediaElement::setLoop(%s)", boolString(b));
setBooleanAttribute(loopAttr, b);
+#if PLATFORM(MAC)
+ updateDisableSleep();
+#endif
}
bool HTMLMediaElement::controls() const
@@ -2737,10 +2744,7 @@
invalidateCachedTime();
#if PLATFORM(MAC)
- if (m_player->paused() && m_sleepDisabler)
- m_sleepDisabler = nullptr;
- else if (!m_player->paused() && !m_sleepDisabler)
- m_sleepDisabler = DisplaySleepDisabler::create("com.apple.WebCore: HTMLMediaElement playback");
+ updateDisableSleep();
#endif
endProcessingMediaPlayerCallback();
@@ -3736,6 +3740,21 @@
}
}
+#if PLATFORM(MAC)
+void HTMLMediaElement::updateDisableSleep()
+{
+ if (!shouldDisableSleep() && m_sleepDisabler)
+ m_sleepDisabler = nullptr;
+ else if (shouldDisableSleep() && !m_sleepDisabler)
+ m_sleepDisabler = DisplaySleepDisabler::create("com.apple.WebCore: HTMLMediaElement playback");
}
+bool HTMLMediaElement::shouldDisableSleep() const
+{
+ return !m_player->paused() && hasVideo() && hasAudio() && !loop();
+}
#endif
+
+}
+
+#endif
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (104618 => 104619)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2012-01-10 20:42:41 UTC (rev 104618)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2012-01-10 20:43:20 UTC (rev 104619)
@@ -461,6 +461,11 @@
bool isLiveStream() const { return movieLoadType() == MediaPlayer::LiveStream; }
bool isAutoplaying() const { return m_autoplaying; }
+#if PLATFORM(MAC)
+ void updateDisableSleep();
+ bool shouldDisableSleep() const;
+#endif
+
Timer<HTMLMediaElement> m_loadTimer;
Timer<HTMLMediaElement> m_asyncEventTimer;
Timer<HTMLMediaElement> m_progressEventTimer;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes