Changeset 261900 in webkit
- Timestamp:
- May 19, 2020 6:32:30 PM (4 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 11 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r261898 r261900 1 2020-05-19 Simon Fraser <simon.fraser@apple.com> 2 3 Use an ObjectIdentifier<> for DisplayLink observer IDs 4 https://bugs.webkit.org/show_bug.cgi?id=212112 5 6 Reviewed by Per Arne Vollan. 7 8 Replace unsigned observerID with DisplayLinkObserverID, which is a typesafe ObjectIdentifier<>. 9 10 Use PlatformDisplayID in more places. 11 12 * Scripts/webkit/messages.py: 13 * Shared/DisplayLinkObserverID.h: Copied from Source/WebKit/UIProcess/mac/DisplayLink.h. 14 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 15 (WebKit::WebProcessPool::startDisplayLink): 16 (WebKit::WebProcessPool::stopDisplayLink): 17 * UIProcess/WebProcessPool.h: 18 * UIProcess/WebProcessProxy.h: 19 * UIProcess/WebProcessProxy.messages.in: 20 * UIProcess/mac/DisplayLink.cpp: 21 (WebKit::DisplayLink::addObserver): 22 (WebKit::DisplayLink::removeObserver): 23 * UIProcess/mac/DisplayLink.h: 24 * UIProcess/mac/WebProcessProxyMac.mm: 25 (WebKit::WebProcessProxy::startDisplayLink): 26 (WebKit::WebProcessProxy::stopDisplayLink): 27 * WebKit.xcodeproj/project.pbxproj: 28 * WebProcess/WebPage/mac/DrawingAreaMac.cpp: 29 (WebKit::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac): 30 1 31 2020-05-19 Alex Christensen <achristensen@webkit.org> 2 32 -
trunk/Source/WebKit/Scripts/webkit/messages.py
r261776 r261900 229 229 'WebKit::AudioMediaStreamTrackRendererIdentifier', 230 230 'WebKit::ContentWorldIdentifier', 231 'WebKit::DisplayLinkObserverID', 231 232 'WebKit::GeolocationIdentifier', 232 233 'WebKit::ImageBufferBackendHandle', -
trunk/Source/WebKit/Shared/DisplayLinkObserverID.h
r261899 r261900 1 1 /* 2 * Copyright (C) 20 18-2019Apple Inc. All rights reserved.2 * Copyright (C) 2020 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) 29 30 #include <CoreVideo/CVDisplayLink.h> 31 #include <WebCore/PlatformScreen.h> 32 #include <wtf/HashMap.h> 33 #include <wtf/Lock.h> 34 35 namespace IPC { 36 class Connection; 37 } 28 #include <wtf/ObjectIdentifier.h> 38 29 39 30 namespace WebKit { 40 41 class DisplayLink {42 WTF_MAKE_FAST_ALLOCATED;43 public:44 explicit DisplayLink(WebCore::PlatformDisplayID);45 ~DisplayLink();46 47 void addObserver(IPC::Connection&, unsigned observerID);48 void removeObserver(IPC::Connection&, unsigned observerID);49 void removeObservers(IPC::Connection&);50 bool hasObservers() const;51 31 52 WebCore::PlatformDisplayID displayID() const { return m_displayID; } 53 54 private: 55 static CVReturn displayLinkCallback(CVDisplayLinkRef, const CVTimeStamp*, const CVTimeStamp*, CVOptionFlags, CVOptionFlags*, void* data); 56 57 CVDisplayLinkRef m_displayLink { nullptr }; 58 Lock m_observersLock; 59 HashMap<RefPtr<IPC::Connection>, Vector<unsigned>> m_observers; 60 WebCore::PlatformDisplayID m_displayID; 61 }; 32 enum DisplayLinkObserverIDType { }; 33 using DisplayLinkObserverID = ObjectIdentifier<DisplayLinkObserverIDType>; 62 34 63 35 } // namespace WebKit 64 65 #endif66 -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r261865 r261900 792 792 793 793 #if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) 794 void WebProcessPool::startDisplayLink(IPC::Connection& connection, unsigned observerID, uint32_tdisplayID)794 void WebProcessPool::startDisplayLink(IPC::Connection& connection, DisplayLinkObserverID observerID, PlatformDisplayID displayID) 795 795 { 796 796 for (auto& displayLink : m_displayLinks) { … … 805 805 } 806 806 807 void WebProcessPool::stopDisplayLink(IPC::Connection& connection, unsigned observerID, uint32_tdisplayID)807 void WebProcessPool::stopDisplayLink(IPC::Connection& connection, DisplayLinkObserverID observerID, PlatformDisplayID displayID) 808 808 { 809 809 for (auto& displayLink : m_displayLinks) { -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r261717 r261900 250 250 251 251 #if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) 252 void startDisplayLink(IPC::Connection&, unsigned observerID, uint32_t displayID);253 void stopDisplayLink(IPC::Connection&, unsigned observerID, uint32_t displayID);252 void startDisplayLink(IPC::Connection&, DisplayLinkObserverID, WebCore::PlatformDisplayID); 253 void stopDisplayLink(IPC::Connection&, DisplayLinkObserverID, WebCore::PlatformDisplayID); 254 254 void stopDisplayLinks(IPC::Connection&); 255 255 #endif -
trunk/Source/WebKit/UIProcess/WebProcessProxy.h
r261288 r261900 29 29 #include "AuxiliaryProcessProxy.h" 30 30 #include "BackgroundProcessResponsivenessTimer.h" 31 #include "DisplayLinkObserverID.h" 31 32 #include "MessageReceiverMap.h" 32 33 #include "NetworkProcessProxy.h" … … 75 76 struct SecurityOriginData; 76 77 enum class ThirdPartyCookieBlockingMode : uint8_t; 78 using PlatformDisplayID = uint32_t; 77 79 } 78 80 … … 282 284 283 285 #if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) 284 void startDisplayLink( unsigned observerID, uint32_t displayID);285 void stopDisplayLink( unsigned observerID, uint32_t displayID);286 void startDisplayLink(DisplayLinkObserverID, WebCore::PlatformDisplayID); 287 void stopDisplayLink(DisplayLinkObserverID, WebCore::PlatformDisplayID); 286 288 #endif 287 289 -
trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in
r260856 r261900 67 67 68 68 #if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) 69 StartDisplayLink( unsignedobserverID, uint32_t displayID)70 StopDisplayLink( unsignedobserverID, uint32_t displayID)69 StartDisplayLink(WebKit::DisplayLinkObserverID observerID, uint32_t displayID) 70 StopDisplayLink(WebKit::DisplayLinkObserverID observerID, uint32_t displayID) 71 71 #endif 72 72 -
trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp
r260614 r261900 62 62 } 63 63 64 void DisplayLink::addObserver(IPC::Connection& connection, unsignedobserverID)64 void DisplayLink::addObserver(IPC::Connection& connection, DisplayLinkObserverID observerID) 65 65 { 66 66 ASSERT(RunLoop::isMain()); … … 70 70 LockHolder locker(m_observersLock); 71 71 m_observers.ensure(&connection, [] { 72 return Vector< unsigned> { };72 return Vector<DisplayLinkObserverID> { }; 73 73 }).iterator->value.append(observerID); 74 74 } … … 81 81 } 82 82 83 void DisplayLink::removeObserver(IPC::Connection& connection, unsignedobserverID)83 void DisplayLink::removeObserver(IPC::Connection& connection, DisplayLinkObserverID observerID) 84 84 { 85 85 ASSERT(RunLoop::isMain()); -
trunk/Source/WebKit/UIProcess/mac/DisplayLink.h
r241232 r261900 28 28 #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) 29 29 30 #include "DisplayLinkObserverID.h" 30 31 #include <CoreVideo/CVDisplayLink.h> 31 32 #include <WebCore/PlatformScreen.h> … … 45 46 ~DisplayLink(); 46 47 47 void addObserver(IPC::Connection&, unsigned observerID);48 void removeObserver(IPC::Connection&, unsigned observerID);48 void addObserver(IPC::Connection&, DisplayLinkObserverID); 49 void removeObserver(IPC::Connection&, DisplayLinkObserverID); 49 50 void removeObservers(IPC::Connection&); 50 51 bool hasObservers() const; … … 57 58 CVDisplayLinkRef m_displayLink { nullptr }; 58 59 Lock m_observersLock; 59 HashMap<RefPtr<IPC::Connection>, Vector< unsigned>> m_observers;60 HashMap<RefPtr<IPC::Connection>, Vector<DisplayLinkObserverID>> m_observers; 60 61 WebCore::PlatformDisplayID m_displayID; 61 62 }; -
trunk/Source/WebKit/UIProcess/mac/WebProcessProxyMac.mm
r261153 r261900 61 61 62 62 #if ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) 63 void WebProcessProxy::startDisplayLink( unsigned observerID, uint32_tdisplayID)63 void WebProcessProxy::startDisplayLink(DisplayLinkObserverID observerID, WebCore::PlatformDisplayID displayID) 64 64 { 65 65 ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer)); … … 68 68 } 69 69 70 void WebProcessProxy::stopDisplayLink( unsigned observerID, uint32_tdisplayID)70 void WebProcessProxy::stopDisplayLink(DisplayLinkObserverID observerID, WebCore::PlatformDisplayID displayID) 71 71 { 72 72 ASSERT(connection()); -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r261658 r261900 113 113 0F08CF541D63C14000B48DF1 /* WKFormSelectPopover.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F08CF531D63C14000B48DF1 /* WKFormSelectPopover.h */; }; 114 114 0F174AA3142A4CB70039250F /* APIGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F174AA2142A4CB60039250F /* APIGeometry.h */; }; 115 0F189CAC24749F2F00E58D81 /* DisplayLinkObserverID.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F189CAB24749F2F00E58D81 /* DisplayLinkObserverID.h */; }; 115 116 0F3C725B196F604E00AEDD0C /* WKInspectorHighlightView.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F3C7259196F5F6800AEDD0C /* WKInspectorHighlightView.h */; }; 116 117 0F45A331239D89A100294ABF /* WKWebViewPrivateForTestingIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F45A32F239D89A000294ABF /* WKWebViewPrivateForTestingIOS.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2201 2202 0F174AA2142A4CB60039250F /* APIGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIGeometry.h; sourceTree = "<group>"; }; 2202 2203 0F174AA6142AAC610039250F /* WKGeometry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKGeometry.cpp; sourceTree = "<group>"; }; 2204 0F189CAB24749F2F00E58D81 /* DisplayLinkObserverID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayLinkObserverID.h; sourceTree = "<group>"; }; 2203 2205 0F3C7257196F5F5000AEDD0C /* WKInspectorHighlightView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKInspectorHighlightView.mm; sourceTree = "<group>"; }; 2204 2206 0F3C7259196F5F6800AEDD0C /* WKInspectorHighlightView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKInspectorHighlightView.h; sourceTree = "<group>"; }; … … 6032 6034 99036AE823A970870000B06A /* DebuggableInfoData.cpp */, 6033 6035 99036AE723A970870000B06A /* DebuggableInfoData.h */, 6036 0F189CAB24749F2F00E58D81 /* DisplayLinkObserverID.h */, 6034 6037 2D7FD190223C730F007887F1 /* DocumentEditingContext.h */, 6035 6038 2D7FD191223C7310007887F1 /* DocumentEditingContext.mm */, … … 10783 10786 83891B6C1A68C30B0030F386 /* DiagnosticLoggingClient.h in Headers */, 10784 10787 C18173612058424700DFDA65 /* DisplayLink.h in Headers */, 10788 0F189CAC24749F2F00E58D81 /* DisplayLinkObserverID.h in Headers */, 10785 10789 5C1427021C23F84C00D41183 /* Download.h in Headers */, 10786 10790 A1DF631318E0B7C8003A3E2A /* DownloadClient.h in Headers */, -
trunk/Source/WebKit/WebProcess/WebPage/mac/DrawingAreaMac.cpp
r261333 r261900 56 56 bool hasRequestedRefreshCallback() const override { return m_hasSentMessage; } 57 57 58 DisplayLinkObserverID m_observerID; 59 std::unique_ptr<RunLoopObserver> m_runLoopObserver; 58 60 bool m_hasSentMessage { false }; 59 unsigned m_observerID;60 static unsigned m_counterID;61 std::unique_ptr<RunLoopObserver> m_runLoopObserver;62 61 bool m_firstCallbackInCurrentRunloop { false }; 63 62 }; 64 63 65 unsigned DisplayRefreshMonitorMac::m_counterID = 0;66 67 64 DisplayRefreshMonitorMac::DisplayRefreshMonitorMac(PlatformDisplayID displayID) 68 65 : DisplayRefreshMonitor(displayID) 69 , m_observerID( ++m_counterID)66 , m_observerID(DisplayLinkObserverID::generate()) 70 67 { 71 68 }
Note: See TracChangeset
for help on using the changeset viewer.