Title: [102024] trunk/Source
Revision
102024
Author
jer.no...@apple.com
Date
2011-12-05 11:47:19 -0800 (Mon, 05 Dec 2011)

Log Message

<video> elements should disable the system and display sleep when playing on OS X.
https://bugs.webkit.org/show_bug.cgi?id=73730
<rdar://problem/9502155>

Reviewed by Alexey Proskuryakov.

Source/WebCore:

No new tests; platform specific system behavior only.

Create a new DisplaySleepDisabler object when the playback rate becomes non-zero, and destroy
that object when the playback rate drops back to zero.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaPlayerRateChanged):
* html/HTMLMediaElement.h:

Source/WebKit2:

Allow the WebProcess to make connections to the PowerManagement control mach server.

* WebProcess/com.apple.WebProcess.sb:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102023 => 102024)


--- trunk/Source/WebCore/ChangeLog	2011-12-05 19:33:12 UTC (rev 102023)
+++ trunk/Source/WebCore/ChangeLog	2011-12-05 19:47:19 UTC (rev 102024)
@@ -1,3 +1,20 @@
+2011-12-02  Jer Noble  <jer.no...@apple.com>
+
+        <video> elements should disable the system and display sleep when playing on OS X.
+        https://bugs.webkit.org/show_bug.cgi?id=73730
+        <rdar://problem/9502155>
+
+        Reviewed by Alexey Proskuryakov.
+
+        No new tests; platform specific system behavior only.
+
+        Create a new DisplaySleepDisabler object when the playback rate becomes non-zero, and destroy
+        that object when the playback rate drops back to zero.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::mediaPlayerRateChanged):
+        * html/HTMLMediaElement.h:
+
 2011-12-05  Peter Beverloo  <pe...@chromium.org>
 
         [Chromium] Add Android keycodes and build Linux clipboard/filesystem files.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (102023 => 102024)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2011-12-05 19:33:12 UTC (rev 102023)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2011-12-05 19:47:19 UTC (rev 102024)
@@ -99,6 +99,10 @@
 #include "MediaElementAudioSourceNode.h"
 #endif
 
+#if PLATFORM(MAC)
+#include "DisplaySleepDisabler.h"
+#endif
+
 using namespace std;
 
 namespace WebCore {
@@ -2496,6 +2500,14 @@
     m_playbackRate = m_player->rate();
     if (m_playing)
         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");
+#endif
+
     endProcessingMediaPlayerCallback();
 }
 

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (102023 => 102024)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2011-12-05 19:33:12 UTC (rev 102023)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2011-12-05 19:47:19 UTC (rev 102024)
@@ -62,6 +62,9 @@
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
 class Widget;
 #endif
+#if PLATFORM(MAC)
+class DisplaySleepDisabler;
+#endif
 
 // FIXME: The inheritance from MediaPlayerClient here should be private inheritance.
 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it
@@ -557,6 +560,10 @@
     String m_mediaGroup;
     friend class MediaController;
     RefPtr<MediaController> m_mediaController;
+
+#if PLATFORM(MAC)
+    OwnPtr<DisplaySleepDisabler> m_sleepDisabler;
+#endif
 };
 
 #if ENABLE(VIDEO_TRACK)

Modified: trunk/Source/WebKit2/ChangeLog (102023 => 102024)


--- trunk/Source/WebKit2/ChangeLog	2011-12-05 19:33:12 UTC (rev 102023)
+++ trunk/Source/WebKit2/ChangeLog	2011-12-05 19:47:19 UTC (rev 102024)
@@ -1,3 +1,15 @@
+2011-12-03  Jer Noble  <jer.no...@apple.com>
+
+        <video> elements should disable the system and display sleep when playing on OS X.
+        https://bugs.webkit.org/show_bug.cgi?id=73730
+        <rdar://problem/9502155>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Allow the WebProcess to make connections to the PowerManagement control mach server.
+
+        * WebProcess/com.apple.WebProcess.sb:
+
 2011-12-04  Sam Weinig  <s...@webkit.org>
 
         Move code for connections to/from the UIProcess/WebProcess into WebConnection subclasses

Modified: trunk/Source/WebKit2/WebProcess/com.apple.WebProcess.sb (102023 => 102024)


--- trunk/Source/WebKit2/WebProcess/com.apple.WebProcess.sb	2011-12-05 19:33:12 UTC (rev 102023)
+++ trunk/Source/WebKit2/WebProcess/com.apple.WebProcess.sb	2011-12-05 19:47:19 UTC (rev 102024)
@@ -163,6 +163,7 @@
        (global-name "com.apple.window_proxies")
        (global-name "com.apple.windowserver.active")
        (global-name "com.apple.cfnetwork.AuthBrokerAgent")
+       (global-name "com.apple.PowerManagement.control")
 
        ;; FIXME: This should be removed when <rdar://problem/9276393> is fixed.
        (global-name "com.apple.metadata.mds"))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to