Changeset 166247 in webkit
- Timestamp:
- Mar 25, 2014 1:25:52 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 6 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r166179 r166247 1789 1789 platform/DateComponents.cpp 1790 1790 platform/Decimal.cpp 1791 platform/DisplaySleepDisabler.cpp 1791 1792 platform/DragData.cpp 1792 1793 platform/DragImage.cpp -
trunk/Source/WebCore/ChangeLog
r166246 r166247 1 2014-03-25 Jer Noble <jer.noble@apple.com> 2 3 [iOS] Playing video does not disable display sleep. 4 https://bugs.webkit.org/show_bug.cgi?id=130729 5 6 Reviewed by Eric Carlson. 7 8 DisplaySleepDisabler was broken by r161589, which replaced the iOS implementation with 9 an empty one. Make a platform independent version with a Cocoa-platform subclass. Update 10 the APIs to non-deprecated ones. 11 12 * platform/DisplaySleepDisabler.cpp: Added. 13 (WebCore::DisplaySleepDisabler::create): 14 * platform/DisplaySleepDisabler.h: Added. 15 (WebCore::DisplaySleepDisabler::~DisplaySleepDisabler): 16 (WebCore::DisplaySleepDisabler::DisplaySleepDisabler): 17 * platform/cocoa/DisplaySleepDisablerCocoa.cpp: Renamed from Source/WebCore/platform/mac/DisplaySleepDisabler.cpp. 18 (WebCore::DisplaySleepDisabler::create): 19 (WebCore::DisplaySleepDisablerCocoa::DisplaySleepDisablerCocoa): 20 (WebCore::DisplaySleepDisablerCocoa::~DisplaySleepDisablerCocoa): 21 * platform/cocoa/DisplaySleepDisablerCocoa.h: Renamed from Source/WebCore/platform/mac/DisplaySleepDisabler.h. 22 23 Update m_sleepDisabler to be a std::unique_ptr, and unprotect the definition of methods which use it. 24 * html/HTMLMediaElement.cpp: 25 (WebCore::HTMLMediaElement::updateSleepDisabling): 26 (WebCore::HTMLMediaElement::shouldDisableSleep): 27 * html/HTMLMediaElement.h: 28 29 Add the new and renamed files to the project: 30 * CMakeLists.txt: 31 * GNUmakefile.list.am: 32 * WebCore.xcodeproj/project.pbxproj: 33 1 34 2014-03-25 Dirk Schulze <krit@webkit.org> 2 35 -
trunk/Source/WebCore/GNUmakefile.list.am
r166179 r166247 5327 5327 Source/WebCore/platform/DatabaseStrategy.cpp \ 5328 5328 Source/WebCore/platform/DatabaseStrategy.h \ 5329 Source/WebCore/platform/DisplaySleepDisabler.cpp \ 5330 Source/WebCore/platform/DisplaySleepDisabler.h \ 5329 5331 Source/WebCore/platform/DragData.cpp \ 5330 5332 Source/WebCore/platform/DragData.h \ -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r166179 r166247 2037 2037 5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DD0AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp */; }; 2038 2038 5D87BB8311E3ED8600702B6F /* ExportFileGenerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D87BB8211E3ED8600702B6F /* ExportFileGenerator.cpp */; }; 2039 5D8C4DBF1428222C0026CE72 /* DisplaySleepDisabler .cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D8C4DBD1428222C0026CE72 /* DisplaySleepDisabler.cpp */; };2040 5D8C4DC01428222C0026CE72 /* DisplaySleepDisabler .h in Headers */ = {isa = PBXBuildFile; fileRef = 5D8C4DBE1428222C0026CE72 /* DisplaySleepDisabler.h */; settings = {ATTRIBUTES = (Private, ); }; };2039 5D8C4DBF1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D8C4DBD1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp */; }; 2040 5D8C4DC01428222C0026CE72 /* DisplaySleepDisablerCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D8C4DBE1428222C0026CE72 /* DisplaySleepDisablerCocoa.h */; }; 2041 2041 5D925B670F64D4DD00B847F0 /* ScrollBehavior.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */; }; 2042 2042 5D925B680F64D4DD00B847F0 /* ScrollBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D925B660F64D4DD00B847F0 /* ScrollBehavior.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 5522 5522 CD3E252418046BCD00E27F56 /* CSSGridTemplateAreasValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CD3E252218046BCD00E27F56 /* CSSGridTemplateAreasValue.h */; }; 5523 5523 CD4AC52A1496AE9A0087C4EF /* Composite.wav in Copy Audio Resources */ = {isa = PBXBuildFile; fileRef = CD4AC5281496AE2F0087C4EF /* Composite.wav */; }; 5524 CD52481A18E200ED0008A07D /* DisplaySleepDisabler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD52481818E200ED0008A07D /* DisplaySleepDisabler.cpp */; }; 5525 CD52481B18E200ED0008A07D /* DisplaySleepDisabler.h in Headers */ = {isa = PBXBuildFile; fileRef = CD52481918E200ED0008A07D /* DisplaySleepDisabler.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5524 5526 CD5393D3175E018600C07123 /* JSMemoryInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5393D1175E018600C07123 /* JSMemoryInfo.cpp */; }; 5525 5527 CD5393D4175E018600C07123 /* JSMemoryInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5393D2175E018600C07123 /* JSMemoryInfo.h */; }; … … 9025 9027 5D87BB4F11E3EAEB00702B6F /* WebCoreExportFileGenerator */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WebCoreExportFileGenerator; sourceTree = BUILT_PRODUCTS_DIR; }; 9026 9028 5D87BB8211E3ED8600702B6F /* ExportFileGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExportFileGenerator.cpp; path = DerivedSources/WebCore/ExportFileGenerator.cpp; sourceTree = BUILT_PRODUCTS_DIR; }; 9027 5D8C4DBD1428222C0026CE72 /* DisplaySleepDisabler .cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplaySleepDisabler.cpp; sourceTree = "<group>"; };9028 5D8C4DBE1428222C0026CE72 /* DisplaySleepDisabler .h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplaySleepDisabler.h; sourceTree = "<group>"; };9029 5D8C4DBD1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplaySleepDisablerCocoa.cpp; sourceTree = "<group>"; }; 9030 5D8C4DBE1428222C0026CE72 /* DisplaySleepDisablerCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplaySleepDisablerCocoa.h; sourceTree = "<group>"; }; 9029 9031 5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollBehavior.cpp; sourceTree = "<group>"; }; 9030 9032 5D925B660F64D4DD00B847F0 /* ScrollBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollBehavior.h; sourceTree = "<group>"; }; … … 12824 12826 CD4AC5281496AE2F0087C4EF /* Composite.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = Composite.wav; path = platform/audio/resources/Composite.wav; sourceTree = SOURCE_ROOT; }; 12825 12827 CD4E0AFA11F7BC27009D3811 /* fullscreen.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreen.css; sourceTree = "<group>"; }; 12828 CD52481818E200ED0008A07D /* DisplaySleepDisabler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplaySleepDisabler.cpp; sourceTree = "<group>"; }; 12829 CD52481918E200ED0008A07D /* DisplaySleepDisabler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplaySleepDisabler.h; sourceTree = "<group>"; }; 12826 12830 CD5393CB175DCCE600C07123 /* MemoryInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInfo.h; sourceTree = "<group>"; }; 12827 12831 CD5393CC175DCCE600C07123 /* MemoryInfo.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MemoryInfo.idl; sourceTree = "<group>"; }; … … 16072 16076 93B6A0E90B0BCA8400F5027A /* ContextMenuMac.mm */, 16073 16077 F58784F002DE375901EA4122 /* CursorMac.mm */, 16074 5D8C4DBD1428222C0026CE72 /* DisplaySleepDisabler.cpp */,16075 5D8C4DBE1428222C0026CE72 /* DisplaySleepDisabler.h */,16076 16078 A795463D0B5C4C80007B438F /* DragDataMac.mm */, 16077 16079 A7CFB3D40B7ED1180070C32D /* DragImageMac.mm */, … … 18158 18160 isa = PBXGroup; 18159 18161 children = ( 18162 5D8C4DBD1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp */, 18163 5D8C4DBE1428222C0026CE72 /* DisplaySleepDisablerCocoa.h */, 18160 18164 A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */, 18161 18165 A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */, … … 20910 20914 45FEA5CD156DDE8C00654101 /* Decimal.cpp */, 20911 20915 45FEA5CE156DDE8C00654101 /* Decimal.h */, 20916 CD52481818E200ED0008A07D /* DisplaySleepDisabler.cpp */, 20917 CD52481918E200ED0008A07D /* DisplaySleepDisabler.h */, 20912 20918 A79546420B5C4CB4007B438F /* DragData.cpp */, 20913 20919 A7B6E69D0B291A9600D0529F /* DragData.h */, … … 23313 23319 A5F9EF711266750D00FCCF52 /* DiskImageCacheIOS.h in Headers */, 23314 23320 49AF2D6914435D050016A784 /* DisplayRefreshMonitor.h in Headers */, 23315 5D8C4DC01428222C0026CE72 /* DisplaySleepDisabler .h in Headers */,23321 5D8C4DC01428222C0026CE72 /* DisplaySleepDisablerCocoa.h in Headers */, 23316 23322 FD31609112B026F700C1A359 /* Distance.h in Headers */, 23317 23323 84730D771248F0B300D3A9C9 /* DistantLightSource.h in Headers */, … … 26171 26177 2E43464D0F546A8200B0F1BA /* WorkerLocation.h in Headers */, 26172 26178 2E4346500F546A8200B0F1BA /* WorkerMessagingProxy.h in Headers */, 26179 CD52481B18E200ED0008A07D /* DisplaySleepDisabler.h in Headers */, 26173 26180 E1271A0B0EEEC77A00F61213 /* WorkerNavigator.h in Headers */, 26174 26181 1ABC7109170E5E1B00F9A9D6 /* WorkerNavigatorStorageQuota.h in Headers */, … … 26927 26934 0F97A658155DA81E00FADD4C /* DisplayRefreshMonitorIOS.mm in Sources */, 26928 26935 49AF2D6C14435D210016A784 /* DisplayRefreshMonitorMac.cpp in Sources */, 26929 5D8C4DBF1428222C0026CE72 /* DisplaySleepDisabler .cpp in Sources */,26936 5D8C4DBF1428222C0026CE72 /* DisplaySleepDisablerCocoa.cpp in Sources */, 26930 26937 FD31609012B026F700C1A359 /* Distance.cpp in Sources */, 26931 26938 A1E1154413015C3D0054AC8C /* DistantLightSource.cpp in Sources */, … … 27439 27446 5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */, 27440 27447 516953971329A3C800B92D04 /* IconDatabaseBase.cpp in Sources */, 27448 CD52481A18E200ED0008A07D /* DisplaySleepDisabler.cpp in Sources */, 27441 27449 FED13D400CEA939400D89466 /* IconIOS.mm in Sources */, 27442 27450 513F14530AB634C400094DDF /* IconLoader.cpp in Sources */, -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r166238 r166247 5640 5640 void HTMLMediaElement::updateSleepDisabling() 5641 5641 { 5642 #if PLATFORM(COCOA)5643 5642 if (!shouldDisableSleep() && m_sleepDisabler) 5644 5643 m_sleepDisabler = nullptr; 5645 5644 else if (shouldDisableSleep() && !m_sleepDisabler) 5646 5645 m_sleepDisabler = DisplaySleepDisabler::create("com.apple.WebCore: HTMLMediaElement playback"); 5647 #endif5648 5646 } 5649 5647 … … 5651 5649 bool HTMLMediaElement::shouldDisableSleep() const 5652 5650 { 5651 #if !PLATFORM(COCOA) 5652 return false; 5653 #endif 5654 5653 5655 #if ENABLE(PAGE_VISIBILITY_API) 5654 5656 if (m_isDisplaySleepDisablingSuspended) -
trunk/Source/WebCore/html/HTMLMediaElement.h
r166238 r166247 63 63 class MediaElementAudioSourceNode; 64 64 #endif 65 class DisplaySleepDisabler; 65 66 class Event; 66 67 class HTMLSourceElement; … … 75 76 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) 76 77 class Widget; 77 #endif78 #if PLATFORM(COCOA)79 class DisplaySleepDisabler;80 78 #endif 81 79 #if ENABLE(ENCRYPTED_MEDIA_V2) … … 865 863 RefPtr<MediaController> m_mediaController; 866 864 867 #if PLATFORM(COCOA) 868 OwnPtr<DisplaySleepDisabler> m_sleepDisabler; 869 #endif 865 std::unique_ptr<DisplaySleepDisabler> m_sleepDisabler; 870 866 871 867 friend class TrackDisplayUpdateScope; -
trunk/Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.cpp
r166246 r166247 1 1 /* 2 * Copyright (C) 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2011-2014 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 25 25 26 26 #include "config.h" 27 #include "DisplaySleepDisabler .h"27 #include "DisplaySleepDisablerCocoa.h" 28 28 29 #if !PLATFORM(IOS)29 #if PLATFORM(COCOA) 30 30 31 31 #include <IOKit/pwr_mgt/IOPMLib.h> … … 34 34 namespace WebCore { 35 35 36 #if PLATFORM(IOS) 37 static const double systemActivityInterval = 1; 38 #endif 39 40 DisplaySleepDisabler::DisplaySleepDisabler(const char* reason) 41 : m_disableDisplaySleepAssertion(0) 36 std::unique_ptr<DisplaySleepDisabler> DisplaySleepDisabler::create(const char* reason) 42 37 { 43 #if !PLATFORM(IOS) 44 RetainPtr<CFStringRef> reasonCF = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, reason, kCFStringEncodingUTF8)); 45 IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonCF.get(), &m_disableDisplaySleepAssertion); 46 #else 47 UNUSED_PARAM(reason); 48 IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &m_disableDisplaySleepAssertion); 49 m_systemActivityTimer.startRepeating(systemActivityInterval); 50 #endif 38 return std::unique_ptr<DisplaySleepDisabler>(new DisplaySleepDisabler(reason)); 51 39 } 52 40 53 DisplaySleepDisabler::~DisplaySleepDisabler() 41 DisplaySleepDisablerCocoa::DisplaySleepDisablerCocoa(const char* reason) 42 : DisplaySleepDisabler(reason) 43 , m_disableDisplaySleepAssertion(0) 44 { 45 RetainPtr<CFStringRef> reasonCF = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, reason, kCFStringEncodingUTF8)); 46 IOPMAssertionCreateWithDescription(kIOPMAssertionTypePreventUserIdleDisplaySleep, reasonCF.get(), nullptr, nullptr, nullptr, 0, nullptr, &m_disableDisplaySleepAssertion); 47 } 48 49 DisplaySleepDisablerCocoa::~DisplaySleepDisablerCocoa() 54 50 { 55 51 IOPMAssertionRelease(m_disableDisplaySleepAssertion); … … 58 54 } 59 55 60 #else 61 62 namespace WebCore { 63 DisplaySleepDisabler::DisplaySleepDisabler(const char *) { } 64 DisplaySleepDisabler::~DisplaySleepDisabler() { } 65 } 66 67 #endif // !PLATFORM(IOS) 56 #endif // PLATFORM(COCOA) -
trunk/Source/WebCore/platform/cocoa/DisplaySleepDisablerCocoa.h
r166246 r166247 24 24 */ 25 25 26 #ifndef DisplaySleepDisabler _h27 #define DisplaySleepDisabler _h26 #ifndef DisplaySleepDisablerCocoa_h 27 #define DisplaySleepDisablerCocoa_h 28 28 29 #include <wtf/Noncopyable.h> 30 #include <wtf/PassOwnPtr.h> 29 #if PLATFORM(COCOA) 30 31 #include "DisplaySleepDisabler.h" 31 32 32 33 namespace WebCore { 33 34 34 class DisplaySleepDisabler { 35 WTF_MAKE_NONCOPYABLE(DisplaySleepDisabler); 35 class DisplaySleepDisablerCocoa : public DisplaySleepDisabler { 36 36 public: 37 static PassOwnPtr<DisplaySleepDisabler> create(const char* reason) { return adoptPtr(new DisplaySleepDisabler(reason)); } 38 ~DisplaySleepDisabler(); 39 37 virtual ~DisplaySleepDisablerCocoa(); 38 40 39 private: 41 DisplaySleepDisabler(const char* reason); 42 43 #if !PLATFORM(IOS) 40 DisplaySleepDisablerCocoa(const char*); 41 44 42 uint32_t m_disableDisplaySleepAssertion; 45 #endif // !PLATFORM(IOS)46 43 }; 47 44 48 45 } 49 46 50 #endif // DisplaySleepDisabler_h 47 #endif // PLATFORM(COCOA) 48 49 #endif // DisplaySleepDisablerCocoa_h
Note: See TracChangeset
for help on using the changeset viewer.