Title: [181923] trunk/Source/WebCore
Revision
181923
Author
[email protected]
Date
2015-03-24 17:55:11 -0700 (Tue, 24 Mar 2015)

Log Message

[Mac] Use .cpp file extension instead of .mm for SharedTimerCF and PowerObserverMac
https://bugs.webkit.org/show_bug.cgi?id=143026

Reviewed by Andy Estes.

Use .cpp file extension instead of .mm for SharedTimerCF and
PowerObserverMac.

* WebCore.xcodeproj/project.pbxproj:
* platform/cf/SharedTimerCF.cpp: Renamed from Source/WebCore/platform/cf/SharedTimerCF.mm.
(WebCore::timerFired):
Use WTF::AutodrainedPool instead of @autoreleasepool {}.

* platform/mac/PowerObserverMac.cpp: Renamed from Source/WebCore/platform/mac/PowerObserverMac.mm.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (181922 => 181923)


--- trunk/Source/WebCore/ChangeLog	2015-03-25 00:19:05 UTC (rev 181922)
+++ trunk/Source/WebCore/ChangeLog	2015-03-25 00:55:11 UTC (rev 181923)
@@ -1,3 +1,20 @@
+2015-03-24  Chris Dumez  <[email protected]>
+
+        [Mac] Use .cpp file extension instead of .mm for SharedTimerCF and PowerObserverMac
+        https://bugs.webkit.org/show_bug.cgi?id=143026
+
+        Reviewed by Andy Estes.
+
+        Use .cpp file extension instead of .mm for SharedTimerCF and
+        PowerObserverMac.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/cf/SharedTimerCF.cpp: Renamed from Source/WebCore/platform/cf/SharedTimerCF.mm.
+        (WebCore::timerFired):
+        Use WTF::AutodrainedPool instead of @autoreleasepool {}.
+
+        * platform/mac/PowerObserverMac.cpp: Renamed from Source/WebCore/platform/mac/PowerObserverMac.mm.
+
 2015-03-24  Yusuke Suzuki  <[email protected]>
 
         REGRESSION (r181458): Heap use-after-free in JSSetIterator destructor

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (181922 => 181923)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-03-25 00:19:05 UTC (rev 181922)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-03-25 00:55:11 UTC (rev 181923)
@@ -1638,12 +1638,12 @@
 		45BAC2B01360BBAB005DA258 /* IconURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 45BAC2AF1360BBAB005DA258 /* IconURL.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		45FEA5CF156DDE8C00654101 /* Decimal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45FEA5CD156DDE8C00654101 /* Decimal.cpp */; };
 		45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 45FEA5CE156DDE8C00654101 /* Decimal.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		4634592C1AC2271000ECB71C /* PowerObserverMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */; };
+		4634592E1AC2273C00ECB71C /* SharedTimerCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4634592D1AC2273C00ECB71C /* SharedTimerCF.cpp */; };
 		4689F1AF1267BAE100E8D380 /* FileMetadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 4689F1AE1267BAE100E8D380 /* FileMetadata.h */; };
 		46C83EFD1A9BBE2900A79A41 /* GeoNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46C83EFB1A9BBE2900A79A41 /* GeoNotifier.cpp */; };
 		46C83EFE1A9BBE2900A79A41 /* GeoNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		46D791141AB89A9B001B696B /* SharedTimerCF.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46D791131AB89A9B001B696B /* SharedTimerCF.mm */; };
 		46DBB6501AB8C96F00D9A813 /* PowerObserverMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */; };
-		46DBB6511AB8C96F00D9A813 /* PowerObserverMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46DBB64F1AB8C96F00D9A813 /* PowerObserverMac.mm */; };
 		46FCB6181A70820E00C5A21E /* DiagnosticLoggingKeys.h in Headers */ = {isa = PBXBuildFile; fileRef = CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */; };
 		490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */; };
@@ -8779,12 +8779,12 @@
 		45BAC2AF1360BBAB005DA258 /* IconURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconURL.h; sourceTree = "<group>"; };
 		45FEA5CD156DDE8C00654101 /* Decimal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Decimal.cpp; sourceTree = "<group>"; };
 		45FEA5CE156DDE8C00654101 /* Decimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decimal.h; sourceTree = "<group>"; };
+		4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PowerObserverMac.cpp; sourceTree = "<group>"; };
+		4634592D1AC2273C00ECB71C /* SharedTimerCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedTimerCF.cpp; sourceTree = "<group>"; };
 		4689F1AE1267BAE100E8D380 /* FileMetadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileMetadata.h; path = platform/FileMetadata.h; sourceTree = "<group>"; };
 		46C83EFB1A9BBE2900A79A41 /* GeoNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeoNotifier.cpp; sourceTree = "<group>"; };
 		46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeoNotifier.h; sourceTree = "<group>"; };
-		46D791131AB89A9B001B696B /* SharedTimerCF.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedTimerCF.mm; sourceTree = "<group>"; };
 		46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PowerObserverMac.h; sourceTree = "<group>"; };
-		46DBB64F1AB8C96F00D9A813 /* PowerObserverMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PowerObserverMac.mm; sourceTree = "<group>"; };
 		490707E41219C04300D90E51 /* ANGLEWebKitBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ANGLEWebKitBridge.cpp; sourceTree = "<group>"; };
 		490707E51219C04300D90E51 /* ANGLEWebKitBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ANGLEWebKitBridge.h; sourceTree = "<group>"; };
 		49291E4A134172C800E753DE /* ImageRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageRenderingMode.h; sourceTree = "<group>"; };
@@ -15233,7 +15233,7 @@
 				2D76BB8319456F8100CFD29A /* RunLoopObserver.cpp */,
 				2D76BB801945632400CFD29A /* RunLoopObserver.h */,
 				512DD8E20D91E2B4000F89EE /* SharedBufferCF.cpp */,
-				46D791131AB89A9B001B696B /* SharedTimerCF.mm */,
+				4634592D1AC2273C00ECB71C /* SharedTimerCF.cpp */,
 				1A98956A0AA78F80005EF5EF /* URLCF.cpp */,
 				5CBC8DAA1AAA302200E1C803 /* MediaAccessibilitySoftLink.cpp */,
 				5CBC8DAB1AAA302200E1C803 /* MediaAccessibilitySoftLink.h */,
@@ -16690,8 +16690,8 @@
 				C5F765BA14E1ECF4006C899B /* PlatformPasteboardMac.mm */,
 				BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */,
 				29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */,
+				4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */,
 				46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */,
-				46DBB64F1AB8C96F00D9A813 /* PowerObserverMac.mm */,
 				0081FEFE16B0A2B6008AAA7A /* PublicSuffixMac.mm */,
 				BCAE1FA512939DB7004CB026 /* ScrollAnimatorMac.h */,
 				BC51156D12B1749C00C96754 /* ScrollAnimatorMac.mm */,
@@ -27533,6 +27533,7 @@
 				BCB16C1F0979C3BD00467741 /* CachedResource.cpp in Sources */,
 				E47B4BE90E71241600038854 /* CachedResourceHandle.cpp in Sources */,
 				BCB16C290979C3BD00467741 /* CachedResourceLoader.cpp in Sources */,
+				4634592C1AC2271000ECB71C /* PowerObserverMac.cpp in Sources */,
 				5081E3C33CE580C16EF8B48B /* CachedResourceRequest.cpp in Sources */,
 				93D200F21AB8F81F0025E851 /* JSWebKitMouseForceEvent.cpp in Sources */,
 				6C638896A96CCEE50C8C946C /* CachedResourceRequestInitiators.cpp in Sources */,
@@ -28016,7 +28017,6 @@
 				9BAB6C6D12550631001626D4 /* EditingStyle.cpp in Sources */,
 				4B3043CC0AE0373B00A82647 /* Editor.cpp in Sources */,
 				93A38B4B0D0E5808006872C2 /* EditorCommand.cpp in Sources */,
-				46D791141AB89A9B001B696B /* SharedTimerCF.mm in Sources */,
 				0760C17A1AA8FC7D009ED7B8 /* MediaPlaybackTargetMac.mm in Sources */,
 				FED13D3A0CEA934600D89466 /* EditorIOS.mm in Sources */,
 				ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */,
@@ -28749,6 +28749,7 @@
 				CDA98E0616039E1F00FEA3B1 /* JSMediaKeySession.cpp in Sources */,
 				BC3C39B60C0D3D8D005F4D7A /* JSMediaList.cpp in Sources */,
 				D3A94A46122DC40F00A37BBC /* JSMediaQueryList.cpp in Sources */,
+				4634592E1AC2273C00ECB71C /* SharedTimerCF.cpp in Sources */,
 				7C5343FC17B74B63004232F0 /* JSMediaQueryListListener.cpp in Sources */,
 				319848021A1D818100A13318 /* AnimationEvent.cpp in Sources */,
 				CD9DE17417AAC74C00EA386D /* JSMediaSource.cpp in Sources */,
@@ -29383,7 +29384,6 @@
 				B27535630B053814002CE64F /* PathCG.cpp in Sources */,
 				A88DD4890B4629B000C02990 /* PathTraversalState.cpp in Sources */,
 				A8FA6E5E0E4CFDED00D5CF49 /* Pattern.cpp in Sources */,
-				46DBB6511AB8C96F00D9A813 /* PowerObserverMac.mm in Sources */,
 				A80A38FE0E50CC8200A25EBC /* PatternCG.cpp in Sources */,
 				B27535640B053814002CE64F /* PDFDocumentImage.cpp in Sources */,
 				2D6E468417D660F500ECF8BB /* PDFDocumentImageMac.mm in Sources */,

Copied: trunk/Source/WebCore/platform/cf/SharedTimerCF.cpp (from rev 181922, trunk/Source/WebCore/platform/cf/SharedTimerCF.mm) (0 => 181923)


--- trunk/Source/WebCore/platform/cf/SharedTimerCF.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/cf/SharedTimerCF.cpp	2015-03-25 00:55:11 UTC (rev 181923)
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2006, 2010, 2015 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. ``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
+ * 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.
+ */
+
+#import "config.h"
+#import "SharedTimer.h"
+
+#include <wtf/AutodrainedPool.h>
+
+#if PLATFORM(MAC)
+#import "PowerObserverMac.h"
+#elif PLATFORM(IOS)
+#import "WebCoreThread.h"
+#import "WebCoreThreadRun.h"
+#endif
+
+namespace WebCore {
+
+static CFRunLoopTimerRef sharedTimer;
+static void (*sharedTimerFiredFunction)();
+static void timerFired(CFRunLoopTimerRef, void*);
+static void restartSharedTimer();
+
+static const CFTimeInterval kCFTimeIntervalDistantFuture = std::numeric_limits<CFTimeInterval>::max();
+
+#if PLATFORM(IOS)
+static void applicationDidBecomeActive(CFNotificationCenterRef, void*, CFStringRef, const void*, CFDictionaryRef)
+{
+    WebThreadRun(^{
+        restartSharedTimer();
+    });
+}
+#endif
+
+static void setupPowerObserver()
+{
+#if PLATFORM(MAC)
+    static PowerObserver* powerObserver;
+    if (!powerObserver)
+        powerObserver = std::make_unique<PowerObserver>(restartSharedTimer).release();
+#elif PLATFORM(IOS)
+    static bool registeredForApplicationNotification = false;
+    if (!registeredForApplicationNotification) {
+        registeredForApplicationNotification = true;
+        CFNotificationCenterRef notificationCenter = CFNotificationCenterGetLocalCenter();
+        CFNotificationCenterAddObserver(notificationCenter, nullptr, applicationDidBecomeActive, CFSTR("UIApplicationDidBecomeActiveNotification"), nullptr, CFNotificationSuspensionBehaviorCoalesce);
+    }
+#endif
+}
+
+void setSharedTimerFiredFunction(void (*f)())
+{
+    ASSERT(!sharedTimerFiredFunction || sharedTimerFiredFunction == f);
+
+    sharedTimerFiredFunction = f;
+}
+
+static void timerFired(CFRunLoopTimerRef, void*)
+{
+    AutodrainedPool pool;
+    sharedTimerFiredFunction();
+}
+
+static void restartSharedTimer()
+{
+    if (!sharedTimer)
+        return;
+
+    stopSharedTimer();
+    timerFired(0, 0);
+}
+
+void invalidateSharedTimer()
+{
+    if (!sharedTimer)
+        return;
+
+    CFRunLoopTimerInvalidate(sharedTimer);
+    CFRelease(sharedTimer);
+    sharedTimer = nullptr;
+}
+
+void setSharedTimerFireInterval(double interval)
+{
+    ASSERT(sharedTimerFiredFunction);
+
+    CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent() + interval;
+    if (!sharedTimer) {
+        sharedTimer = CFRunLoopTimerCreate(nullptr, fireDate, kCFTimeIntervalDistantFuture, 0, 0, timerFired, nullptr);
+#if PLATFORM(IOS)
+        CFRunLoopAddTimer(WebThreadRunLoop(), sharedTimer, kCFRunLoopCommonModes);
+#else
+        CFRunLoopAddTimer(CFRunLoopGetCurrent(), sharedTimer, kCFRunLoopCommonModes);
+#endif
+
+        setupPowerObserver();
+
+        return;
+    }
+
+    CFRunLoopTimerSetNextFireDate(sharedTimer, fireDate);
+}
+
+void stopSharedTimer()
+{
+    if (!sharedTimer)
+        return;
+
+    CFRunLoopTimerSetNextFireDate(sharedTimer, kCFTimeIntervalDistantFuture);
+}
+
+} // namespace WebCore

Deleted: trunk/Source/WebCore/platform/cf/SharedTimerCF.mm (181922 => 181923)


--- trunk/Source/WebCore/platform/cf/SharedTimerCF.mm	2015-03-25 00:19:05 UTC (rev 181922)
+++ trunk/Source/WebCore/platform/cf/SharedTimerCF.mm	2015-03-25 00:55:11 UTC (rev 181923)
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2006, 2010, 2015 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. ``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
- * 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.
- */
-
-#import "config.h"
-#import "SharedTimer.h"
-
-#if PLATFORM(MAC)
-#import "PowerObserverMac.h"
-#elif PLATFORM(IOS)
-#import "WebCoreThread.h"
-#import "WebCoreThreadRun.h"
-#endif
-
-namespace WebCore {
-
-static CFRunLoopTimerRef sharedTimer;
-static void (*sharedTimerFiredFunction)();
-static void timerFired(CFRunLoopTimerRef, void*);
-static void restartSharedTimer();
-
-static const CFTimeInterval kCFTimeIntervalDistantFuture = std::numeric_limits<CFTimeInterval>::max();
-
-#if PLATFORM(IOS)
-static void applicationDidBecomeActive(CFNotificationCenterRef, void*, CFStringRef, const void*, CFDictionaryRef)
-{
-    WebThreadRun(^{
-        restartSharedTimer();
-    });
-}
-#endif
-
-static void setupPowerObserver()
-{
-#if PLATFORM(MAC)
-    static PowerObserver* powerObserver;
-    if (!powerObserver)
-        powerObserver = std::make_unique<PowerObserver>(restartSharedTimer).release();
-#elif PLATFORM(IOS)
-    static bool registeredForApplicationNotification = false;
-    if (!registeredForApplicationNotification) {
-        registeredForApplicationNotification = true;
-        CFNotificationCenterRef notificationCenter = CFNotificationCenterGetLocalCenter();
-        CFNotificationCenterAddObserver(notificationCenter, 0, applicationDidBecomeActive, CFSTR("UIApplicationDidBecomeActiveNotification"), NULL, CFNotificationSuspensionBehaviorCoalesce);
-    }
-#endif
-}
-
-void setSharedTimerFiredFunction(void (*f)())
-{
-    ASSERT(!sharedTimerFiredFunction || sharedTimerFiredFunction == f);
-
-    sharedTimerFiredFunction = f;
-}
-
-static void timerFired(CFRunLoopTimerRef, void*)
-{
-    @autoreleasepool {
-        sharedTimerFiredFunction();
-    }
-}
-
-static void restartSharedTimer()
-{
-    if (!sharedTimer)
-        return;
-
-    stopSharedTimer();
-    timerFired(0, 0);
-}
-
-void invalidateSharedTimer()
-{
-    if (!sharedTimer)
-        return;
-
-    CFRunLoopTimerInvalidate(sharedTimer);
-    CFRelease(sharedTimer);
-    sharedTimer = nullptr;
-}
-
-void setSharedTimerFireInterval(double interval)
-{
-    ASSERT(sharedTimerFiredFunction);
-
-    CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent() + interval;
-    if (!sharedTimer) {
-        sharedTimer = CFRunLoopTimerCreate(nullptr, fireDate, kCFTimeIntervalDistantFuture, 0, 0, timerFired, nullptr);
-#if PLATFORM(IOS)
-        CFRunLoopAddTimer(WebThreadRunLoop(), sharedTimer, kCFRunLoopCommonModes);
-#else
-        CFRunLoopAddTimer(CFRunLoopGetCurrent(), sharedTimer, kCFRunLoopCommonModes);
-#endif
-
-        setupPowerObserver();
-
-        return;
-    }
-
-    CFRunLoopTimerSetNextFireDate(sharedTimer, fireDate);
-}
-
-void stopSharedTimer()
-{
-    if (!sharedTimer)
-        return;
-
-    CFRunLoopTimerSetNextFireDate(sharedTimer, kCFTimeIntervalDistantFuture);
-}
-
-} // namespace WebCore

Copied: trunk/Source/WebCore/platform/mac/PowerObserverMac.cpp (from rev 181922, trunk/Source/WebCore/platform/mac/PowerObserverMac.mm) (0 => 181923)


--- trunk/Source/WebCore/platform/mac/PowerObserverMac.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/mac/PowerObserverMac.cpp	2015-03-25 00:55:11 UTC (rev 181923)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2006, 2010, 2015 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. ``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
+ * 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.
+ */
+
+#import "config.h"
+
+#if PLATFORM(MAC)
+#import "PowerObserverMac.h"
+
+namespace WebCore {
+
+PowerObserver::PowerObserver(const std::function<void()>& powerOnHander)
+    : m_powerOnHander(powerOnHander)
+    , m_powerConnection(0)
+    , m_notificationPort(nullptr)
+    , m_notifierReference(0)
+    , m_dispatchQueue(dispatch_queue_create("com.apple.WebKit.PowerObserver", 0))
+{
+    m_powerConnection = IORegisterForSystemPower(this, &m_notificationPort, [](void* context, io_service_t service, uint32_t messageType, void* messageArgument) {
+        static_cast<PowerObserver*>(context)->didReceiveSystemPowerNotification(service, messageType, messageArgument);
+    }, &m_notifierReference);
+    if (!m_powerConnection)
+        return;
+
+    IONotificationPortSetDispatchQueue(m_notificationPort, m_dispatchQueue);
+}
+
+PowerObserver::~PowerObserver()
+{
+    if (!m_powerConnection)
+        return;
+
+    dispatch_release(m_dispatchQueue);
+
+    IODeregisterForSystemPower(&m_notifierReference);
+    IOServiceClose(m_powerConnection);
+    IONotificationPortDestroy(m_notificationPort);
+}
+
+void PowerObserver::didReceiveSystemPowerNotification(io_service_t, uint32_t messageType, void* messageArgument)
+{
+    IOAllowPowerChange(m_powerConnection, reinterpret_cast<long>(messageArgument));
+
+    // We only care about the "wake from sleep" message.
+    if (messageType != kIOMessageSystemWillPowerOn)
+        return;
+
+    // We need to restart the timer on the main thread.
+    CFRunLoopPerformBlock(CFRunLoopGetMain(), kCFRunLoopCommonModes, ^() {
+        m_powerOnHander();
+    });
+}
+
+} // namespace WebCore
+
+#endif

Deleted: trunk/Source/WebCore/platform/mac/PowerObserverMac.mm (181922 => 181923)


--- trunk/Source/WebCore/platform/mac/PowerObserverMac.mm	2015-03-25 00:19:05 UTC (rev 181922)
+++ trunk/Source/WebCore/platform/mac/PowerObserverMac.mm	2015-03-25 00:55:11 UTC (rev 181923)
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2006, 2010, 2015 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. ``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
- * 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.
- */
-
-#import "config.h"
-
-#if PLATFORM(MAC)
-#import "PowerObserverMac.h"
-
-namespace WebCore {
-
-PowerObserver::PowerObserver(const std::function<void()>& powerOnHander)
-    : m_powerOnHander(powerOnHander)
-    , m_powerConnection(0)
-    , m_notificationPort(nullptr)
-    , m_notifierReference(0)
-    , m_dispatchQueue(dispatch_queue_create("com.apple.WebKit.PowerObserver", 0))
-{
-    m_powerConnection = IORegisterForSystemPower(this, &m_notificationPort, [](void* context, io_service_t service, uint32_t messageType, void* messageArgument) {
-        static_cast<PowerObserver*>(context)->didReceiveSystemPowerNotification(service, messageType, messageArgument);
-    }, &m_notifierReference);
-    if (!m_powerConnection)
-        return;
-
-    IONotificationPortSetDispatchQueue(m_notificationPort, m_dispatchQueue);
-}
-
-PowerObserver::~PowerObserver()
-{
-    if (!m_powerConnection)
-        return;
-
-    dispatch_release(m_dispatchQueue);
-
-    IODeregisterForSystemPower(&m_notifierReference);
-    IOServiceClose(m_powerConnection);
-    IONotificationPortDestroy(m_notificationPort);
-}
-
-void PowerObserver::didReceiveSystemPowerNotification(io_service_t, uint32_t messageType, void* messageArgument)
-{
-    IOAllowPowerChange(m_powerConnection, reinterpret_cast<long>(messageArgument));
-
-    // We only care about the "wake from sleep" message.
-    if (messageType != kIOMessageSystemWillPowerOn)
-        return;
-
-    // We need to restart the timer on the main thread.
-    CFRunLoopPerformBlock(CFRunLoopGetMain(), kCFRunLoopCommonModes, ^() {
-        m_powerOnHander();
-    });
-}
-
-} // namespace WebCore
-
-#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to