WeakPtrFactory should populate m_ref lazily.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Sep 2017 04:38:45 +0000 (04:38 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Sep 2017 04:38:45 +0000 (04:38 +0000)
commit935d5ded5f30c48d36a455daf5886b51667c26e1
tree5b8ad00f85b00312c77440a0eb7dd820b282c390
parentfee69c2c54776e3c5c5288246ac48a5d201ca7c6
WeakPtrFactory should populate m_ref lazily.
https://bugs.webkit.org/show_bug.cgi?id=177375

Reviewed by Geoffrey Garen.

Source/WebCore:

* Modules/encryptedmedia/CDM.cpp:
(WebCore::CDM::CDM):
* Modules/encryptedmedia/CDM.h:
(WebCore::CDM::createWeakPtr):
* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::MediaKeySession):
(WebCore::MediaKeySession::generateRequest):
(WebCore::MediaKeySession::load):
(WebCore::MediaKeySession::update):
(WebCore::MediaKeySession::close):
(WebCore::MediaKeySession::remove):
* Modules/encryptedmedia/MediaKeys.cpp:
(WebCore::MediaKeys::MediaKeys):
(WebCore::MediaKeys::createSession):
* Modules/mediastream/MediaDevices.cpp:
(WebCore::MediaDevices::MediaDevices):
* Modules/mediastream/MediaDevices.h:
(WebCore::MediaDevices::createWeakPtr):
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::MediaStreamTrack):
* Modules/mediastream/MediaStreamTrack.h:
(WebCore::MediaStreamTrack::createWeakPtr):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::AccessibilityRenderObject):
* accessibility/AccessibilityRenderObject.h:
(WebCore::AccessibilityRenderObject::createWeakPtr):
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::WebAnimation):
* animation/WebAnimation.h:
* css/FontFace.cpp:
(WebCore::FontFace::FontFace):
(WebCore::FontFace::createWeakPtr):
(WebCore::FontFace::createWeakPtr const): Deleted.
* css/FontFace.h:
* css/StyleSheetContents.h:
* dom/DataTransferItemList.cpp:
(WebCore::DataTransferItemList::DataTransferItemList):
(WebCore::DataTransferItemList::add):
(WebCore::DataTransferItemList::ensureItems const):
(WebCore::DataTransferItemList::didSetStringData):
* dom/Document.cpp:
(WebCore::Document::postTask):
* dom/Document.h:
(WebCore::Document::createWeakPtr):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::createWeakPtr):
* html/HTMLPictureElement.h:
* html/parser/HTMLResourcePreloader.h:
(WebCore::HTMLResourcePreloader::HTMLResourcePreloader):
(WebCore::HTMLResourcePreloader::createWeakPtr):
* loader/LinkLoader.cpp:
(WebCore::LinkLoader::LinkLoader):
* loader/LinkLoader.h:
(WebCore::LinkLoader::createWeakPtr):
* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::MediaResourceLoader):
* loader/MediaResourceLoader.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::DOMWindow):
* page/DOMWindow.h:
* platform/GenericTaskQueue.cpp:
(WebCore::TaskDispatcher<Timer>::TaskDispatcher):
(WebCore::TaskDispatcher<Timer>::postTask):
* platform/GenericTaskQueue.h:
(WebCore::GenericTaskQueue::GenericTaskQueue):
(WebCore::GenericTaskQueue::enqueueTask):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::createWeakPtr):
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::Scrollbar):
* platform/Scrollbar.h:
(WebCore::Scrollbar::createWeakPtr):
* platform/Widget.h:
(WebCore::Widget::createWeakPtr):
* platform/audio/mac/AudioHardwareListenerMac.cpp:
(WebCore::AudioHardwareListenerMac::AudioHardwareListenerMac):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::FontCascade):
* platform/graphics/FontCascade.h:
(WebCore::FontCascade::createWeakPtr const):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
(WebCore::MediaPlayerPrivateAVFoundation::createWeakPtr):
* platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
(WebCore::CDMSessionAVFoundationObjC::createWeakPtr):
* platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
(WebCore::CDMSessionAVFoundationObjC::CDMSessionAVFoundationObjC):
* platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
(WebCore::CDMSessionAVStreamSession::CDMSessionAVStreamSession):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createWeakPtr):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::createWeakPtr):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::append):
(WebCore::SourceBufferPrivateAVFObjC::abort):
* platform/graphics/cv/TextureCacheCV.mm:
(WebCore::TextureCacheCV::TextureCacheCV):
(WebCore::TextureCacheCV::textureFromImage):
* platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
(WebCore::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
(WebCore::DisplayRefreshMonitorMac::displayLinkFired):
* platform/ios/RemoteCommandListenerIOS.h:
(WebCore::RemoteCommandListenerIOS::createWeakPtr):
* platform/ios/RemoteCommandListenerIOS.mm:
(WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS):
* platform/mac/RemoteCommandListenerMac.h:
(WebCore::RemoteCommandListenerMac::createWeakPtr):
* platform/mediastream/MediaStreamPrivate.cpp:
(WebCore::MediaStreamPrivate::MediaStreamPrivate):
* platform/mediastream/MediaStreamPrivate.h:
(WebCore::MediaStreamPrivate::createWeakPtr):
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::RealtimeMediaSource):
* platform/mediastream/RealtimeMediaSource.h:
* platform/mock/MockMediaEndpoint.cpp:
(WebCore::MockMediaEndpoint::MockMediaEndpoint):
(WebCore::MockMediaEndpoint::generateDtlsInfo):
* rendering/RenderMultiColumnSpannerPlaceholder.cpp:
(WebCore::RenderMultiColumnSpannerPlaceholder::RenderMultiColumnSpannerPlaceholder):
* rendering/RenderMultiColumnSpannerPlaceholder.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::RenderView):
* rendering/RenderView.h:
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::RenderWidget):
* rendering/RenderWidget.h:
(WebCore::RenderWidget::createWeakPtr):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::RootInlineBox):
* rendering/RootInlineBox.h:
(WebCore::RootInlineBox::createWeakPtr):
* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::SVGPathElement):
* svg/SVGPathElement.h:
* svg/properties/SVGMatrixTearOff.h:
* testing/MockCDMFactory.cpp:
(WebCore::MockCDMFactory::MockCDMFactory):
(WebCore::MockCDMFactory::createCDM):
(WebCore::MockCDM::MockCDM):
(WebCore::MockCDM::createInstance):
(WebCore::m_weakPtrFactory): Deleted.

Source/WebCore/PAL:

* pal/system/mac/SystemSleepListenerMac.mm:
(PAL::SystemSleepListenerMac::SystemSleepListenerMac):

Source/WebKit:

* UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::WebPaymentCoordinatorProxy):
(WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
(WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
* UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
* UIProcess/ApplicationStateTracker.mm:
(WebKit::ApplicationStateTracker::ApplicationStateTracker):
* UIProcess/Cocoa/WebViewImpl.h:
(WebKit::WebViewImpl::createWeakPtr):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::WebViewImpl):
* UIProcess/Launcher/ProcessLauncher.cpp:
(WebKit::ProcessLauncher::ProcessLauncher):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::ProcessLauncher::launchProcess):
* UIProcess/ProcessAssertion.h:
(WebKit::ProcessAssertion::createWeakPtr):
* UIProcess/WebPageProxy.cpp:
(WebKit::m_configurationPreferenceValues):
(WebKit::m_weakPtrFactory): Deleted.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::createWeakPtr const):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
(WebKit::RemoteLayerTreeDrawingArea::createWeakPtr):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):

Source/WebKitLegacy/mac:

* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::WebEditorClient):
(WebEditorClient::requestCandidatesForSelection):

Source/WTF:

This helps us with the overhead of initializing WeakPtrFactory for
objects that rarely end up creating the weak reference.
-This is in preparation for introducing WeakPtr to RenderObject.

All credit to Geoffrey Garen.

* wtf/WeakPtr.h:
(WTF::WeakReference::get const):
(WTF::WeakReference::clear):
(WTF::WeakReference::WeakReference):
(WTF::WeakPtrFactory::~WeakPtrFactory):
(WTF::WeakPtrFactory::createWeakPtr const):
(WTF::WeakPtrFactory::revokeAll):
(WTF::WeakPtrFactory::WeakPtrFactory): Deleted.

Tools:

* TestWebKitAPI/Tests/WTF/WeakPtr.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222422 268f45cc-cd09-0410-ab3c-d52691b4dbfc
103 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/WeakPtr.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/CDM.cpp
Source/WebCore/Modules/encryptedmedia/CDM.h
Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp
Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp
Source/WebCore/Modules/mediastream/MediaDevices.cpp
Source/WebCore/Modules/mediastream/MediaDevices.h
Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
Source/WebCore/Modules/mediastream/MediaStreamTrack.h
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/system/mac/SystemSleepListenerMac.mm
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.h
Source/WebCore/animation/WebAnimation.cpp
Source/WebCore/animation/WebAnimation.h
Source/WebCore/css/FontFace.cpp
Source/WebCore/css/FontFace.h
Source/WebCore/css/StyleSheetContents.h
Source/WebCore/dom/DataTransferItemList.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/html/HTMLPictureElement.h
Source/WebCore/html/parser/HTMLResourcePreloader.h
Source/WebCore/loader/LinkLoader.cpp
Source/WebCore/loader/LinkLoader.h
Source/WebCore/loader/MediaResourceLoader.cpp
Source/WebCore/loader/MediaResourceLoader.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/platform/GenericTaskQueue.cpp
Source/WebCore/platform/GenericTaskQueue.h
Source/WebCore/platform/ScrollableArea.h
Source/WebCore/platform/Scrollbar.cpp
Source/WebCore/platform/Scrollbar.h
Source/WebCore/platform/Widget.h
Source/WebCore/platform/audio/gstreamer/AudioFileReaderGStreamer.cpp
Source/WebCore/platform/audio/mac/AudioHardwareListenerMac.cpp
Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/FontCascade.h
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
Source/WebCore/platform/graphics/cv/TextureCacheCV.mm
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp
Source/WebCore/platform/graphics/mac/DisplayRefreshMonitorMac.cpp
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
Source/WebCore/platform/ios/RemoteCommandListenerIOS.h
Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm
Source/WebCore/platform/mac/RemoteCommandListenerMac.h
Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp
Source/WebCore/platform/mediastream/MediaStreamPrivate.h
Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSource.h
Source/WebCore/platform/mock/MockMediaEndpoint.cpp
Source/WebCore/rendering/RenderMultiColumnSpannerPlaceholder.cpp
Source/WebCore/rendering/RenderMultiColumnSpannerPlaceholder.h
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RenderView.h
Source/WebCore/rendering/RenderWidget.cpp
Source/WebCore/rendering/RenderWidget.h
Source/WebCore/rendering/RootInlineBox.cpp
Source/WebCore/rendering/RootInlineBox.h
Source/WebCore/svg/SVGPathElement.cpp
Source/WebCore/svg/SVGPathElement.h
Source/WebCore/svg/properties/SVGMatrixTearOff.h
Source/WebCore/testing/MockCDMFactory.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.cpp
Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm
Source/WebKit/UIProcess/ApplicationStateTracker.mm
Source/WebKit/UIProcess/Cocoa/WebViewImpl.h
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/Launcher/ProcessLauncher.cpp
Source/WebKit/UIProcess/Launcher/mac/ProcessLauncherMac.mm
Source/WebKit/UIProcess/ProcessAssertion.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/gtk/WaylandCompositor.cpp
Source/WebKit/UIProcess/gtk/WaylandCompositor.h
Source/WebKit/UIProcess/ios/ProcessAssertionIOS.mm
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/WeakPtr.cpp