Title: [166247] trunk/Source/WebCore
Revision
166247
Author
jer.no...@apple.com
Date
2014-03-25 13:25:52 -0700 (Tue, 25 Mar 2014)

Log Message

[iOS] Playing video does not disable display sleep.
https://bugs.webkit.org/show_bug.cgi?id=130729

Reviewed by Eric Carlson.

DisplaySleepDisabler was broken by r161589, which replaced the iOS implementation with
an empty one. Make a platform independent version with a Cocoa-platform subclass. Update
the APIs to non-deprecated ones.

* platform/DisplaySleepDisabler.cpp: Added.
(WebCore::DisplaySleepDisabler::create):
* platform/DisplaySleepDisabler.h: Added.
(WebCore::DisplaySleepDisabler::~DisplaySleepDisabler):
(WebCore::DisplaySleepDisabler::DisplaySleepDisabler):
* platform/cocoa/DisplaySleepDisablerCocoa.cpp: Renamed from Source/WebCore/platform/mac/DisplaySleepDisabler.cpp.
(WebCore::DisplaySleepDisabler::create):
(WebCore::DisplaySleepDisablerCocoa::DisplaySleepDisablerCocoa):
(WebCore::DisplaySleepDisablerCocoa::~DisplaySleepDisablerCocoa):
* platform/cocoa/DisplaySleepDisablerCocoa.h: Renamed from Source/WebCore/platform/mac/DisplaySleepDisabler.h.

Update m_sleepDisabler to be a std::unique_ptr, and unprotect the definition of methods which use it.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::updateSleepDisabling):
(WebCore::HTMLMediaElement::shouldDisableSleep):
* html/HTMLMediaElement.h:

Add the new and renamed files to the project:
* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (166246 => 166247)


--- trunk/Source/WebCore/CMakeLists.txt	2014-03-25 20:24:14 UTC (rev 166246)
+++ trunk/Source/WebCore/CMakeLists.txt	2014-03-25 20:25:52 UTC (rev 166247)
@@ -1788,6 +1788,7 @@
     platform/DatabaseStrategy.cpp
     platform/DateComponents.cpp
     platform/Decimal.cpp
+    platform/DisplaySleepDisabler.cpp
     platform/DragData.cpp
     platform/DragImage.cpp
     platform/FileChooser.cpp

Modified: trunk/Source/WebCore/ChangeLog (166246 => 166247)


--- trunk/Source/WebCore/ChangeLog	2014-03-25 20:24:14 UTC (rev 166246)
+++ trunk/Source/WebCore/ChangeLog	2014-03-25 20:25:52 UTC (rev 166247)
@@ -1,3 +1,36 @@
+2014-03-25  Jer Noble  <jer.no...@apple.com>
+
+        [iOS] Playing video does not disable display sleep.
+        https://bugs.webkit.org/show_bug.cgi?id=130729
+
+        Reviewed by Eric Carlson.
+
+        DisplaySleepDisabler was broken by r161589, which replaced the iOS implementation with
+        an empty one. Make a platform independent version with a Cocoa-platform subclass. Update
+        the APIs to non-deprecated ones.
+
+        * platform/DisplaySleepDisabler.cpp: Added.
+        (WebCore::DisplaySleepDisabler::create):
+        * platform/DisplaySleepDisabler.h: Added.
+        (WebCore::DisplaySleepDisabler::~DisplaySleepDisabler):
+        (WebCore::DisplaySleepDisabler::DisplaySleepDisabler):
+        * platform/cocoa/DisplaySleepDisablerCocoa.cpp: Renamed from Source/WebCore/platform/mac/DisplaySleepDisabler.cpp.
+        (WebCore::DisplaySleepDisabler::create):
+        (WebCore::DisplaySleepDisablerCocoa::DisplaySleepDisablerCocoa):
+        (WebCore::DisplaySleepDisablerCocoa::~DisplaySleepDisablerCocoa):
+        * platform/cocoa/DisplaySleepDisablerCocoa.h: Renamed from Source/WebCore/platform/mac/DisplaySleepDisabler.h.
+
+        Update m_sleepDisabler to be a std::unique_ptr, and unprotect the definition of methods which use it.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::updateSleepDisabling):
+        (WebCore::HTMLMediaElement::shouldDisableSleep):
+        * html/HTMLMediaElement.h:
+
+        Add the new and renamed files to the project:
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * WebCore.xcodeproj/project.pbxproj:
+
 2014-03-25  Dirk Schulze  <k...@webkit.org>
 
         Implement ImageData constructors and WebWorkers exposure

Modified: trunk/Source/WebCore/GNUmakefile.list.am (166246 => 166247)


--- trunk/Source/WebCore/GNUmakefile.list.am	2014-03-25 20:24:14 UTC (rev 166246)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2014-03-25 20:25:52 UTC (rev 166247)
@@ -5326,6 +5326,8 @@
 	Source/WebCore/platform/CrossThreadCopier.h \
 	Source/WebCore/platform/DatabaseStrategy.cpp \
 	Source/WebCore/platform/DatabaseStrategy.h \
+	Source/WebCore/platform/DisplaySleepDisabler.cpp \
+	Source/WebCore/platform/DisplaySleepDisabler.h \
 	Source/WebCore/platform/DragData.cpp \
 	Source/WebCore/platform/DragData.h \
 	Source/WebCore/platform/DragImage.cpp \

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (166246 => 166247)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-03-25 20:24:14 UTC (rev 166246)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2014-03-25 20:25:52 UTC (rev 166247)
@@ -2036,8 +2036,8 @@
 		5D21A80313ECE5DF00BB7064 /* WebVTTParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D21A80113ECE5DF00BB7064 /* WebVTTParser.h */; };
 		5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DD0AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp */; };
 		5D87BB8311E3ED8600702B6F /* ExportFileGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D87BB8211E3ED8600702B6F /* ExportFileGenerator.cpp */; };
-		5D8C4DBF1428222C0026CE72 /* DisplaySleepDisabler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D8C4DBD1428222C0026CE72 /* DisplaySleepDisabler.cpp */; };
-		5D8C4DC01428222C0026CE72 /* DisplaySleepDisabler.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D8C4DBE1428222C0026CE72 /* DisplaySleepDisabler.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		5D8C4DBF1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D8C4DBD1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp */; };
+		5D8C4DC01428222C0026CE72 /* DisplaySleepDisablerCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D8C4DBE1428222C0026CE72 /* DisplaySleepDisablerCocoa.h */; };
 		5D925B670F64D4DD00B847F0 /* ScrollBehavior.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */; };
 		5D925B680F64D4DD00B847F0 /* ScrollBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D925B660F64D4DD00B847F0 /* ScrollBehavior.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5DA5E0FC102B953800088CF9 /* JSWebSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5DA5E0FA102B953800088CF9 /* JSWebSocket.cpp */; };
@@ -5521,6 +5521,8 @@
 		CD3E252318046BCD00E27F56 /* CSSGridTemplateAreasValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD3E252118046BCD00E27F56 /* CSSGridTemplateAreasValue.cpp */; };
 		CD3E252418046BCD00E27F56 /* CSSGridTemplateAreasValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3E252218046BCD00E27F56 /* CSSGridTemplateAreasValue.h */; };
 		CD4AC52A1496AE9A0087C4EF /* Composite.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD4AC5281496AE2F0087C4EF /* Composite.wav */; };
+		CD52481A18E200ED0008A07D /* DisplaySleepDisabler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD52481818E200ED0008A07D /* DisplaySleepDisabler.cpp */; };
+		CD52481B18E200ED0008A07D /* DisplaySleepDisabler.h in Headers */ = {isa = PBXBuildFile; fileRef = CD52481918E200ED0008A07D /* DisplaySleepDisabler.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		CD5393D3175E018600C07123 /* JSMemoryInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5393D1175E018600C07123 /* JSMemoryInfo.cpp */; };
 		CD5393D4175E018600C07123 /* JSMemoryInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5393D2175E018600C07123 /* JSMemoryInfo.h */; };
 		CD54A762180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD54A760180F9F7000B076C9 /* AudioTrackPrivateMediaSourceAVFObjC.cpp */; };
@@ -9024,8 +9026,8 @@
 		5D4B8C5211E52C8B00BBB62F /* WebCore.exp.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebCore.exp.in; sourceTree = "<group>"; };
 		5D87BB4F11E3EAEB00702B6F /* WebCoreExportFileGenerator */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WebCoreExportFileGenerator; sourceTree = BUILT_PRODUCTS_DIR; };
 		5D87BB8211E3ED8600702B6F /* ExportFileGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExportFileGenerator.cpp; path = DerivedSources/WebCore/ExportFileGenerator.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
-		5D8C4DBD1428222C0026CE72 /* DisplaySleepDisabler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplaySleepDisabler.cpp; sourceTree = "<group>"; };
-		5D8C4DBE1428222C0026CE72 /* DisplaySleepDisabler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplaySleepDisabler.h; sourceTree = "<group>"; };
+		5D8C4DBD1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplaySleepDisablerCocoa.cpp; sourceTree = "<group>"; };
+		5D8C4DBE1428222C0026CE72 /* DisplaySleepDisablerCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplaySleepDisablerCocoa.h; sourceTree = "<group>"; };
 		5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollBehavior.cpp; sourceTree = "<group>"; };
 		5D925B660F64D4DD00B847F0 /* ScrollBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollBehavior.h; sourceTree = "<group>"; };
 		5DA5E0FA102B953800088CF9 /* JSWebSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebSocket.cpp; sourceTree = "<group>"; };
@@ -12823,6 +12825,8 @@
 		CD3E252218046BCD00E27F56 /* CSSGridTemplateAreasValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSGridTemplateAreasValue.h; sourceTree = "<group>"; };
 		CD4AC5281496AE2F0087C4EF /* Composite.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = Composite.wav; path = platform/audio/resources/Composite.wav; sourceTree = SOURCE_ROOT; };
 		CD4E0AFA11F7BC27009D3811 /* fullscreen.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreen.css; sourceTree = "<group>"; };
+		CD52481818E200ED0008A07D /* DisplaySleepDisabler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplaySleepDisabler.cpp; sourceTree = "<group>"; };
+		CD52481918E200ED0008A07D /* DisplaySleepDisabler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplaySleepDisabler.h; sourceTree = "<group>"; };
 		CD5393CB175DCCE600C07123 /* MemoryInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInfo.h; sourceTree = "<group>"; };
 		CD5393CC175DCCE600C07123 /* MemoryInfo.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MemoryInfo.idl; sourceTree = "<group>"; };
 		CD5393D1175E018600C07123 /* JSMemoryInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMemoryInfo.cpp; sourceTree = "<group>"; };
@@ -16071,8 +16075,6 @@
 				06027CB20B1CC03D00884B2D /* ContextMenuItemMac.mm */,
 				93B6A0E90B0BCA8400F5027A /* ContextMenuMac.mm */,
 				F58784F002DE375901EA4122 /* CursorMac.mm */,
-				5D8C4DBD1428222C0026CE72 /* DisplaySleepDisabler.cpp */,
-				5D8C4DBE1428222C0026CE72 /* DisplaySleepDisabler.h */,
 				A795463D0B5C4C80007B438F /* DragDataMac.mm */,
 				A7CFB3D40B7ED1180070C32D /* DragImageMac.mm */,
 				E1BA66F01742BD8600C20251 /* DynamicLinkerInterposing.h */,
@@ -18157,6 +18159,8 @@
 		A5C974CE11485FDA0066F2AB /* cocoa */ = {
 			isa = PBXGroup;
 			children = (
+				5D8C4DBD1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp */,
+				5D8C4DBE1428222C0026CE72 /* DisplaySleepDisablerCocoa.h */,
 				A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */,
 				A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */,
 				7CC564B918BAC720001B9652 /* TelephoneNumberDetectorCocoa.cpp */,
@@ -20909,6 +20913,8 @@
 				A5732B09136A161D005C8D7C /* DateComponents.h */,
 				45FEA5CD156DDE8C00654101 /* Decimal.cpp */,
 				45FEA5CE156DDE8C00654101 /* Decimal.h */,
+				CD52481818E200ED0008A07D /* DisplaySleepDisabler.cpp */,
+				CD52481918E200ED0008A07D /* DisplaySleepDisabler.h */,
 				A79546420B5C4CB4007B438F /* DragData.cpp */,
 				A7B6E69D0B291A9600D0529F /* DragData.h */,
 				A7CFB3CF0B7ED10A0070C32D /* DragImage.cpp */,
@@ -23312,7 +23318,7 @@
 				A5C566AB127A3AAD00E8A3FF /* DiskImageCacheClientIOS.h in Headers */,
 				A5F9EF711266750D00FCCF52 /* DiskImageCacheIOS.h in Headers */,
 				49AF2D6914435D050016A784 /* DisplayRefreshMonitor.h in Headers */,
-				5D8C4DC01428222C0026CE72 /* DisplaySleepDisabler.h in Headers */,
+				5D8C4DC01428222C0026CE72 /* DisplaySleepDisablerCocoa.h in Headers */,
 				FD31609112B026F700C1A359 /* Distance.h in Headers */,
 				84730D771248F0B300D3A9C9 /* DistantLightSource.h in Headers */,
 				B2F34FE60E82F81400F627CD /* DNS.h in Headers */,
@@ -26170,6 +26176,7 @@
 				18F831B80FD48C7800D8C56B /* WorkerLoaderProxy.h in Headers */,
 				2E43464D0F546A8200B0F1BA /* WorkerLocation.h in Headers */,
 				2E4346500F546A8200B0F1BA /* WorkerMessagingProxy.h in Headers */,
+				CD52481B18E200ED0008A07D /* DisplaySleepDisabler.h in Headers */,
 				E1271A0B0EEEC77A00F61213 /* WorkerNavigator.h in Headers */,
 				1ABC7109170E5E1B00F9A9D6 /* WorkerNavigatorStorageQuota.h in Headers */,
 				2E4346510F546A8200B0F1BA /* WorkerObjectProxy.h in Headers */,
@@ -26926,7 +26933,7 @@
 				49FC7A501444AF5F00A5D864 /* DisplayRefreshMonitor.cpp in Sources */,
 				0F97A658155DA81E00FADD4C /* DisplayRefreshMonitorIOS.mm in Sources */,
 				49AF2D6C14435D210016A784 /* DisplayRefreshMonitorMac.cpp in Sources */,
-				5D8C4DBF1428222C0026CE72 /* DisplaySleepDisabler.cpp in Sources */,
+				5D8C4DBF1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp in Sources */,
 				FD31609012B026F700C1A359 /* Distance.cpp in Sources */,
 				A1E1154413015C3D0054AC8C /* DistantLightSource.cpp in Sources */,
 				B2F34FE90E82F82700F627CD /* DNSCFNet.cpp in Sources */,
@@ -27438,6 +27445,7 @@
 				97E4028F13A696ED00913D67 /* IconController.cpp in Sources */,
 				5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */,
 				516953971329A3C800B92D04 /* IconDatabaseBase.cpp in Sources */,
+				CD52481A18E200ED0008A07D /* DisplaySleepDisabler.cpp in Sources */,
 				FED13D400CEA939400D89466 /* IconIOS.mm in Sources */,
 				513F14530AB634C400094DDF /* IconLoader.cpp in Sources */,
 				B275358E0B053A66002CE64F /* IconMac.mm in Sources */,

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (166246 => 166247)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-03-25 20:24:14 UTC (rev 166246)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2014-03-25 20:25:52 UTC (rev 166247)
@@ -5639,17 +5639,19 @@
 
 void HTMLMediaElement::updateSleepDisabling()
 {
-#if PLATFORM(COCOA)
     if (!shouldDisableSleep() && m_sleepDisabler)
         m_sleepDisabler = nullptr;
     else if (shouldDisableSleep() && !m_sleepDisabler)
         m_sleepDisabler = DisplaySleepDisabler::create("com.apple.WebCore: HTMLMediaElement playback");
-#endif
 }
 
 #if PLATFORM(COCOA)
 bool HTMLMediaElement::shouldDisableSleep() const
 {
+#if !PLATFORM(COCOA)
+    return false;
+#endif
+
 #if ENABLE(PAGE_VISIBILITY_API)
     if (m_isDisplaySleepDisablingSuspended)
         return false;

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (166246 => 166247)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2014-03-25 20:24:14 UTC (rev 166246)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2014-03-25 20:25:52 UTC (rev 166247)
@@ -62,6 +62,7 @@
 class AudioSourceProvider;
 class MediaElementAudioSourceNode;
 #endif
+class DisplaySleepDisabler;
 class Event;
 class HTMLSourceElement;
 class HTMLTrackElement;
@@ -75,9 +76,6 @@
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
 class Widget;
 #endif
-#if PLATFORM(COCOA)
-class DisplaySleepDisabler;
-#endif
 #if ENABLE(ENCRYPTED_MEDIA_V2)
 class MediaKeys;
 #endif
@@ -864,9 +862,7 @@
     friend class MediaController;
     RefPtr<MediaController> m_mediaController;
 
-#if PLATFORM(COCOA)
-    OwnPtr<DisplaySleepDisabler> m_sleepDisabler;
-#endif
+    std::unique_ptr<DisplaySleepDisabler> m_sleepDisabler;
 
     friend class TrackDisplayUpdateScope;
 

Added: trunk/Source/WebCore/platform/DisplaySleepDisabler.cpp (0 => 166247)


--- trunk/Source/WebCore/platform/DisplaySleepDisabler.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/DisplaySleepDisabler.cpp	2014-03-25 20:25:52 UTC (rev 166247)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "DisplaySleepDisabler.h"
+
+namespace WebCore {
+
+#if !PLATFORM(COCOA)
+std::unique_ptr<DisplaySleepDisabler> DisplaySleepDisabler::create(const char* reason)
+{
+    return std::unique_ptr<DisplaySleepDisabler>(new DisplaySleepDisabler(reason));
+}
+#endif // !PLATFORM(COCOA)
+
+}

Added: trunk/Source/WebCore/platform/DisplaySleepDisabler.h (0 => 166247)


--- trunk/Source/WebCore/platform/DisplaySleepDisabler.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/DisplaySleepDisabler.h	2014-03-25 20:25:52 UTC (rev 166247)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef DisplaySleepDisabler_h
+#define DisplaySleepDisabler_h
+
+namespace WebCore {
+
+class DisplaySleepDisabler {
+public:
+    static std::unique_ptr<DisplaySleepDisabler> create(const char*);
+    virtual ~DisplaySleepDisabler() { }
+
+protected:
+    DisplaySleepDisabler(const char*) { }
+};
+
+}
+
+#endif

Copied: trunk/Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.cpp (from rev 166246, trunk/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp) (0 => 166247)


--- trunk/Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.cpp	2014-03-25 20:25:52 UTC (rev 166247)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2011-2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DisplaySleepDisablerCocoa.h"
+
+#if PLATFORM(COCOA)
+
+#include <IOKit/pwr_mgt/IOPMLib.h>
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+std::unique_ptr<DisplaySleepDisabler> DisplaySleepDisabler::create(const char* reason)
+{
+    return std::unique_ptr<DisplaySleepDisabler>(new DisplaySleepDisabler(reason));
+}
+
+DisplaySleepDisablerCocoa::DisplaySleepDisablerCocoa(const char* reason)
+    : DisplaySleepDisabler(reason)
+    , m_disableDisplaySleepAssertion(0)
+{
+    RetainPtr<CFStringRef> reasonCF = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, reason, kCFStringEncodingUTF8));
+    IOPMAssertionCreateWithDescription(kIOPMAssertionTypePreventUserIdleDisplaySleep, reasonCF.get(), nullptr, nullptr, nullptr, 0, nullptr, &m_disableDisplaySleepAssertion);
+}
+
+DisplaySleepDisablerCocoa::~DisplaySleepDisablerCocoa()
+{
+    IOPMAssertionRelease(m_disableDisplaySleepAssertion);
+}
+
+}
+
+#endif // PLATFORM(COCOA)

Copied: trunk/Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.h (from rev 166246, trunk/Source/WebCore/platform/mac/DisplaySleepDisabler.h) (0 => 166247)


--- trunk/Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.h	2014-03-25 20:25:52 UTC (rev 166247)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DisplaySleepDisablerCocoa_h
+#define DisplaySleepDisablerCocoa_h
+
+#if PLATFORM(COCOA)
+
+#include "DisplaySleepDisabler.h"
+
+namespace WebCore {
+
+class DisplaySleepDisablerCocoa : public DisplaySleepDisabler {
+public:
+    virtual ~DisplaySleepDisablerCocoa();
+
+private:
+    DisplaySleepDisablerCocoa(const char*);
+
+    uint32_t m_disableDisplaySleepAssertion;
+};
+
+}
+
+#endif // PLATFORM(COCOA)
+
+#endif // DisplaySleepDisablerCocoa_h

Deleted: trunk/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp (166246 => 166247)


--- trunk/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp	2014-03-25 20:24:14 UTC (rev 166246)
+++ trunk/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp	2014-03-25 20:25:52 UTC (rev 166247)
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "DisplaySleepDisabler.h"
-
-#if !PLATFORM(IOS)
-
-#include <IOKit/pwr_mgt/IOPMLib.h>
-#include <wtf/RetainPtr.h>
-
-namespace WebCore {
-
-#if PLATFORM(IOS)
-static const double systemActivityInterval = 1;
-#endif
-
-DisplaySleepDisabler::DisplaySleepDisabler(const char* reason)
-    : m_disableDisplaySleepAssertion(0)
-{
-#if !PLATFORM(IOS)
-    RetainPtr<CFStringRef> reasonCF = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, reason, kCFStringEncodingUTF8));
-    IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonCF.get(), &m_disableDisplaySleepAssertion);
-#else
-    UNUSED_PARAM(reason);
-    IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &m_disableDisplaySleepAssertion);
-    m_systemActivityTimer.startRepeating(systemActivityInterval);
-#endif
-}
-
-DisplaySleepDisabler::~DisplaySleepDisabler()
-{
-    IOPMAssertionRelease(m_disableDisplaySleepAssertion);
-}
-
-}
-
-#else
-
-namespace WebCore {
-DisplaySleepDisabler::DisplaySleepDisabler(const char *) { }
-DisplaySleepDisabler::~DisplaySleepDisabler() { }
-}
-
-#endif // !PLATFORM(IOS)

Deleted: trunk/Source/WebCore/platform/mac/DisplaySleepDisabler.h (166246 => 166247)


--- trunk/Source/WebCore/platform/mac/DisplaySleepDisabler.h	2014-03-25 20:24:14 UTC (rev 166246)
+++ trunk/Source/WebCore/platform/mac/DisplaySleepDisabler.h	2014-03-25 20:25:52 UTC (rev 166247)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DisplaySleepDisabler_h
-#define DisplaySleepDisabler_h
-
-#include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace WebCore {
-
-class DisplaySleepDisabler {
-    WTF_MAKE_NONCOPYABLE(DisplaySleepDisabler);
-public:
-    static PassOwnPtr<DisplaySleepDisabler> create(const char* reason) { return adoptPtr(new DisplaySleepDisabler(reason)); }
-    ~DisplaySleepDisabler();
-    
-private:
-    DisplaySleepDisabler(const char* reason);
-    
-#if !PLATFORM(IOS)
-    uint32_t m_disableDisplaySleepAssertion;
-#endif // !PLATFORM(IOS)
-};
-
-}
-
-#endif // DisplaySleepDisabler_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to