Diff
Modified: trunk/Source/WebCore/ChangeLog (272240 => 272241)
--- trunk/Source/WebCore/ChangeLog 2021-02-02 23:10:50 UTC (rev 272240)
+++ trunk/Source/WebCore/ChangeLog 2021-02-02 23:15:41 UTC (rev 272241)
@@ -1,3 +1,31 @@
+2021-02-02 Per Arne Vollan <pvol...@apple.com>
+
+ Register for power notifications in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=221258
+
+ Reviewed by Brent Fulgham.
+
+ Power notifications should be registered for in the UI process instead of the WebContent process. This patch addresses
+ this by creating a PowerObserver instance in the UI process, which will notify every WebContent when the power has been
+ turned on. Each WebContent process will in response restart their shared timer.
+
+ No new tests, since testing this involves putting the machine to sleep and wake it up, which is not trivial in the
+ testing framework.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/cf/MainThreadSharedTimerCF.cpp:
+ (WebCore::restartSharedTimer):
+ (WebCore::MainThreadSharedTimer::setFireInterval):
+ (WebCore::applicationDidBecomeActive): Deleted.
+ (WebCore::setupPowerObserver): Deleted.
+ * platform/cf/SetupPowerObserver.cpp: Added.
+ (WebCore::shouldSetupPowerObserver):
+ (WebCore::applicationDidBecomeActive):
+ (WebCore::setupPowerObserver):
+ (WebCore::runPowerOnHandler):
+ * platform/cf/SetupPowerObserver.h: Added.
+ * platform/mac/PowerObserverMac.h:
+
2021-02-02 Kate Cheney <katherine_che...@apple.com>
PCM: Indicate if network load data is user identifiable
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (272240 => 272241)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-02-02 23:10:50 UTC (rev 272240)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-02-02 23:15:41 UTC (rev 272241)
@@ -1271,7 +1271,7 @@
46C696CC1E7205FC00597937 /* CPUMonitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46C696CA1E7205E400597937 /* CPUMonitor.cpp */; };
46C83EFE1A9BBE2900A79A41 /* GeoNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 46C83EFC1A9BBE2900A79A41 /* GeoNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
46CA9C441F97BBE9004CFC3A /* VisibilityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 46CA9C411F97BBE7004CFC3A /* VisibilityState.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 46DBB6501AB8C96F00D9A813 /* PowerObserverMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */; };
+ 46DBB6501AB8C96F00D9A813 /* PowerObserverMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
46DFF4981DC2603100B80B48 /* ShadowRootMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DFF4961DC2601300B80B48 /* ShadowRootMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
46DFF49C1DC2620B00B80B48 /* JSShadowRootMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 46DFF49A1DC261F900B80B48 /* JSShadowRootMode.h */; };
46E0C0DE23C006E9005E47AE /* DragEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 46E0C0DA23C006B3005E47AE /* DragEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -2249,7 +2249,7 @@
7AABA25A14BC613300AA9A11 /* DOMEditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AABA25814BC613300AA9A11 /* DOMEditor.h */; };
7ADE722610CBBB9B006B3B3A /* ContextMenuProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
7AE335F21ACB09E200E401EF /* WheelEventTestMonitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AE335F01ACB09E200E401EF /* WheelEventTestMonitor.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 7AE6C93C1BE0C60100E19E03 /* MainThreadSharedTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AE6C93A1BE0C60100E19E03 /* MainThreadSharedTimer.h */; };
+ 7AE6C93C1BE0C60100E19E03 /* MainThreadSharedTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AE6C93A1BE0C60100E19E03 /* MainThreadSharedTimer.h */; settings = {ATTRIBUTES = (Private, ); }; };
7AF9B20318CFB2DF00C64BEF /* VTTRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B1FD18CFB2DF00C64BEF /* VTTRegion.h */; };
7AF9B20618CFB2DF00C64BEF /* VTTRegionList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B20018CFB2DF00C64BEF /* VTTRegionList.h */; };
7AF9B20D18CFB5F400C64BEF /* JSVTTRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B20918CFB5F200C64BEF /* JSVTTRegion.h */; };
@@ -2762,7 +2762,7 @@
93309E1E099E64920056E581 /* VisibleUnits.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309DCF099E64910056E581 /* VisibleUnits.h */; settings = {ATTRIBUTES = (Private, ); }; };
93309E20099E64920056E581 /* VisiblePosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309DD1099E64910056E581 /* VisiblePosition.h */; settings = {ATTRIBUTES = (Private, ); }; };
93309E24099E64920056E581 /* WrapContentsInDummySpanCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309DD5099E64910056E581 /* WrapContentsInDummySpanCommand.h */; };
- 93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309EA0099EB78C0056E581 /* SharedTimer.h */; };
+ 93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309EA0099EB78C0056E581 /* SharedTimer.h */; settings = {ATTRIBUTES = (Private, ); }; };
933A14300B7D188600A53FFD /* TextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 933A142D0B7D188600A53FFD /* TextEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
933A14B90B7D1D5200A53FFD /* JSTextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 933A14B70B7D1D5200A53FFD /* JSTextEvent.h */; };
9343CB8212F25E510033C5EE /* TextCodecUTF8.h in Headers */ = {isa = PBXBuildFile; fileRef = 9343CB8012F25E510033C5EE /* TextCodecUTF8.h */; };
@@ -31576,7 +31576,6 @@
77D510171ED6022200DA4C87 /* CredentialsContainer.h in Headers */,
51A052331058774F00CC9E95 /* CredentialStorage.h in Headers */,
2D481F02146B5C5500AA7834 /* CrossfadeGeneratedImage.h in Headers */,
- F48B7D5325C341E6009E75DD /* ImageExtractionResult.h in Headers */,
E1C416120F6562FD0092D2FB /* CrossOriginAccessControl.h in Headers */,
41ABE67B1D0580DB006D862D /* CrossOriginPreflightChecker.h in Headers */,
E1C415DA0F655D6F0092D2FB /* CrossOriginPreflightResultCache.h in Headers */,
@@ -32527,6 +32526,7 @@
CD19FEAE1F574B6D000C42FB /* ImageDecoderAVFObjC.h in Headers */,
555B87ED1CAAF0AB00349425 /* ImageDecoderCG.h in Headers */,
97205AB61239291000B17380 /* ImageDocument.h in Headers */,
+ F48B7D5325C341E6009E75DD /* ImageExtractionResult.h in Headers */,
5576A5651D88A70800CCC04C /* ImageFrame.h in Headers */,
F55B3DC21251F12D003EF269 /* ImageInputType.h in Headers */,
089582560E857A7E00F82C83 /* ImageLoader.h in Headers */,
Modified: trunk/Source/WebCore/platform/MainThreadSharedTimer.h (272240 => 272241)
--- trunk/Source/WebCore/platform/MainThreadSharedTimer.h 2021-02-02 23:10:50 UTC (rev 272240)
+++ trunk/Source/WebCore/platform/MainThreadSharedTimer.h 2021-02-02 23:15:41 UTC (rev 272241)
@@ -49,6 +49,9 @@
// need to call this from non-member functions at the moment.
void fired();
+ WEBCORE_EXPORT static bool& shouldSetupPowerObserver();
+ WEBCORE_EXPORT static void restartSharedTimer();
+
private:
MainThreadSharedTimer();
Modified: trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp (272240 => 272241)
--- trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp 2021-02-02 23:10:50 UTC (rev 272240)
+++ trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp 2021-02-02 23:15:41 UTC (rev 272241)
@@ -39,15 +39,20 @@
static CFRunLoopTimerRef sharedTimer;
static void timerFired(CFRunLoopTimerRef, void*);
-static void restartSharedTimer();
static const CFTimeInterval kCFTimeIntervalDistantFuture = std::numeric_limits<CFTimeInterval>::max();
+bool& MainThreadSharedTimer::shouldSetupPowerObserver()
+{
+ static bool setup = true;
+ return setup;
+}
+
#if PLATFORM(IOS_FAMILY)
static void applicationDidBecomeActive(CFNotificationCenterRef, void*, CFStringRef, const void*, CFDictionaryRef)
{
WebThreadRun(^{
- restartSharedTimer();
+ MainThreadSharedTimer::restartSharedTimer();
});
}
#endif
@@ -54,10 +59,12 @@
static void setupPowerObserver()
{
+ if (!MainThreadSharedTimer::shouldSetupPowerObserver())
+ return;
#if PLATFORM(MAC)
static PowerObserver* powerObserver;
if (!powerObserver)
- powerObserver = makeUnique<PowerObserver>(restartSharedTimer).release();
+ powerObserver = makeUnique<PowerObserver>(MainThreadSharedTimer::restartSharedTimer).release();
#elif PLATFORM(IOS_FAMILY)
static bool registeredForApplicationNotification = false;
if (!registeredForApplicationNotification) {
@@ -74,7 +81,7 @@
MainThreadSharedTimer::singleton().fired();
}
-static void restartSharedTimer()
+void MainThreadSharedTimer::restartSharedTimer()
{
if (!sharedTimer)
return;
Modified: trunk/Source/WebCore/platform/mac/PowerObserverMac.h (272240 => 272241)
--- trunk/Source/WebCore/platform/mac/PowerObserverMac.h 2021-02-02 23:10:50 UTC (rev 272240)
+++ trunk/Source/WebCore/platform/mac/PowerObserverMac.h 2021-02-02 23:15:41 UTC (rev 272241)
@@ -37,8 +37,8 @@
WTF_MAKE_NONCOPYABLE(PowerObserver); WTF_MAKE_FAST_ALLOCATED;
public:
- PowerObserver(WTF::Function<void()>&& powerOnHander);
- ~PowerObserver();
+ WEBCORE_EXPORT PowerObserver(WTF::Function<void()>&& powerOnHander);
+ WEBCORE_EXPORT ~PowerObserver();
private:
void didReceiveSystemPowerNotification(io_service_t, uint32_t messageType, void* messageArgument);
Modified: trunk/Source/WebKit/ChangeLog (272240 => 272241)
--- trunk/Source/WebKit/ChangeLog 2021-02-02 23:10:50 UTC (rev 272240)
+++ trunk/Source/WebKit/ChangeLog 2021-02-02 23:15:41 UTC (rev 272241)
@@ -1,3 +1,23 @@
+2021-02-02 Per Arne Vollan <pvol...@apple.com>
+
+ Register for power notifications in the UI process
+ https://bugs.webkit.org/show_bug.cgi?id=221258
+
+ Reviewed by Brent Fulgham.
+
+ Create a PowerObserver object when the Web process pool is registering notification observers. Notify all WebContent processes
+ When a power on notification is received.
+
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::registerNotificationObservers):
+ (WebKit::WebProcessPool::unregisterNotificationObservers):
+ * UIProcess/WebProcessPool.h:
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in:
+ * WebProcess/cocoa/WebProcessCocoa.mm:
+ (WebKit::WebProcess::platformInitializeProcess):
+ (WebKit::WebProcess::systemWillPowerOn):
+
2021-02-02 Kate Cheney <katherine_che...@apple.com>
PCM: Indicate if network load data is user identifiable
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (272240 => 272241)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2021-02-02 23:10:50 UTC (rev 272240)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2021-02-02 23:15:41 UTC (rev 272241)
@@ -624,6 +624,10 @@
void WebProcessPool::registerNotificationObservers()
{
#if !PLATFORM(IOS_FAMILY)
+ m_powerObserver = makeUnique<WebCore::PowerObserver>([weakThis = makeWeakPtr(this)] {
+ if (weakThis)
+ weakThis->sendToAllProcesses(Messages::WebProcess::SystemWillPowerOn());
+ });
// Listen for enhanced accessibility changes and propagate them to the WebProcess.
m_enhancedAccessibilityObserver = [[NSNotificationCenter defaultCenter] addObserverForName:WebKitApplicationDidChangeAccessibilityEnhancedUserInterfaceNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *note) {
setEnhancedAccessibility([[[note userInfo] objectForKey:@"AXEnhancedUserInterface"] boolValue]);
@@ -721,6 +725,7 @@
void WebProcessPool::unregisterNotificationObservers()
{
#if !PLATFORM(IOS_FAMILY)
+ m_powerObserver = nullptr;
[[NSNotificationCenter defaultCenter] removeObserver:m_enhancedAccessibilityObserver.get()];
[[NSNotificationCenter defaultCenter] removeObserver:m_automaticTextReplacementNotificationObserver.get()];
[[NSNotificationCenter defaultCenter] removeObserver:m_automaticSpellingCorrectionNotificationObserver.get()];
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (272240 => 272241)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2021-02-02 23:10:50 UTC (rev 272240)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2021-02-02 23:15:41 UTC (rev 272241)
@@ -69,9 +69,12 @@
#endif
#endif
-#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
+#if PLATFORM(MAC)
+#import <WebCore/PowerObserverMac.h>
+#if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
#include "DisplayLink.h"
#endif
+#endif
namespace API {
class AutomationClient;
@@ -772,6 +775,10 @@
HashSet<WebCore::RegistrableDomain> m_domainsWithUserInteraction;
HashMap<TopFrameDomain, SubResourceDomain> m_domainsWithCrossPageStorageAccessQuirk;
#endif
+
+#if PLATFORM(MAC)
+ std::unique_ptr<WebCore::PowerObserver> m_powerObserver;
+#endif
};
template<typename T>
Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (272240 => 272241)
--- trunk/Source/WebKit/WebProcess/WebProcess.h 2021-02-02 23:10:50 UTC (rev 272240)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2021-02-02 23:15:41 UTC (rev 272241)
@@ -511,6 +511,10 @@
void displayWasRefreshed(uint32_t displayID);
#endif
+#if PLATFORM(MAC)
+ void systemWillPowerOn();
+#endif
+
void platformInitializeProcess(const AuxiliaryProcessInitializationParameters&);
// IPC::Connection::Client
Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (272240 => 272241)
--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in 2021-02-02 23:10:50 UTC (rev 272240)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in 2021-02-02 23:15:41 UTC (rev 272241)
@@ -195,4 +195,8 @@
#if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
DisplayWasRefreshed(uint32_t displayID)
#endif
+
+#if PLATFORM(MAC)
+ SystemWillPowerOn()
+#endif
}
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (272240 => 272241)
--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-02-02 23:10:50 UTC (rev 272240)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm 2021-02-02 23:15:41 UTC (rev 272241)
@@ -64,6 +64,7 @@
#import <WebCore/LocalizedDeviceModel.h>
#import <WebCore/LocalizedStrings.h>
#import <WebCore/LogInitialization.h>
+#import <WebCore/MainThreadSharedTimer.h>
#import <WebCore/MemoryRelease.h>
#import <WebCore/NSScrollerImpDetails.h>
#import <WebCore/PerformanceLogging.h>
@@ -632,6 +633,7 @@
#endif // ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
SwitchingGPUClient::setSingleton(WebSwitchingGPUClient::singleton());
+ MainThreadSharedTimer::shouldSetupPowerObserver() = false;
#endif // PLATFORM(MAC)
if (parameters.extraInitializationData.get("inspector-process"_s) == "1")
@@ -1204,6 +1206,13 @@
}
}
+#if PLATFORM(MAC)
+void WebProcess::systemWillPowerOn()
+{
+ MainThreadSharedTimer::restartSharedTimer();
+}
+#endif
+
} // namespace WebKit
#undef RELEASE_LOG_SESSION_ID