Remove LayerFlushScheduler
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2018 15:08:26 +0000 (15:08 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Oct 2018 15:08:26 +0000 (15:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191103

Reviewed by Anders Carlsson.

Source/WebCore:

It is only used in WK1.

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/ca/LayerFlushScheduler.cpp: Removed.
* platform/graphics/ca/LayerFlushScheduler.h: Removed.
* platform/graphics/ca/LayerFlushSchedulerClient.h: Removed.
* platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp: Removed.

Source/WebKitLegacy/mac:

Add a RunLoopObserver directly into WebViewLayerFlushScheduler and remove
all the virtual cruft.

* WebView/WebViewData.h:
(WebViewLayerFlushScheduler::~WebViewLayerFlushScheduler): Deleted.
(): Deleted.
* WebView/WebViewData.mm:
(currentRunLoop):
(WebViewLayerFlushScheduler::WebViewLayerFlushScheduler):
(WebViewLayerFlushScheduler::~WebViewLayerFlushScheduler):
(WebViewLayerFlushScheduler::schedule):
(WebViewLayerFlushScheduler::invalidate):
(WebViewLayerFlushScheduler::layerFlushCallback):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237636 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/PlatformAppleWin.cmake
Source/WebCore/PlatformMac.cmake
Source/WebCore/SourcesCocoa.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/RuntimeApplicationChecks.h
Source/WebCore/platform/graphics/ca/LayerFlushScheduler.cpp [deleted file]
Source/WebCore/platform/graphics/ca/LayerFlushScheduler.h [deleted file]
Source/WebCore/platform/graphics/ca/LayerFlushSchedulerClient.h [deleted file]
Source/WebCore/platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp [deleted file]
Source/WebCore/platform/ios/wak/WebCoreThreadInternal.h
Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebViewData.h
Source/WebKitLegacy/mac/WebView/WebViewData.mm

index a2186db..31c310c 100644 (file)
@@ -1,3 +1,19 @@
+2018-10-31  Antti Koivisto  <antti@apple.com>
+
+        Remove LayerFlushScheduler
+        https://bugs.webkit.org/show_bug.cgi?id=191103
+
+        Reviewed by Anders Carlsson.
+
+        It is only used in WK1.
+
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/ca/LayerFlushScheduler.cpp: Removed.
+        * platform/graphics/ca/LayerFlushScheduler.h: Removed.
+        * platform/graphics/ca/LayerFlushSchedulerClient.h: Removed.
+        * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp: Removed.
+
 2018-10-31  Zalan Bujtas  <zalan@apple.com>
 
         Missing from r237634
index cac3674..19b665b 100644 (file)
@@ -92,7 +92,6 @@ else ()
         page/win/FrameCGWin.cpp
 
         platform/graphics/ca/GraphicsLayerCA.cpp
-        platform/graphics/ca/LayerFlushScheduler.cpp
         platform/graphics/ca/LayerPool.cpp
         platform/graphics/ca/PlatformCALayer.cpp
         platform/graphics/ca/TileController.cpp
index 9433984..57fa917 100644 (file)
@@ -256,7 +256,6 @@ list(APPEND WebCore_SOURCES
     platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm
 
     platform/graphics/ca/GraphicsLayerCA.cpp
-    platform/graphics/ca/LayerFlushScheduler.cpp
     platform/graphics/ca/LayerPool.cpp
     platform/graphics/ca/PlatformCAAnimation.cpp
     platform/graphics/ca/PlatformCALayer.cpp
@@ -265,7 +264,6 @@ list(APPEND WebCore_SOURCES
     platform/graphics/ca/TileGrid.cpp
     platform/graphics/ca/TransformationMatrixCA.cpp
 
-    platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp
     platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm
     platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm
     platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
index 94ff156..a258d08 100644 (file)
@@ -255,7 +255,6 @@ platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm @no-
 platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm @no-unify
 
 platform/graphics/ca/GraphicsLayerCA.cpp
-platform/graphics/ca/LayerFlushScheduler.cpp
 platform/graphics/ca/LayerPool.cpp
 platform/graphics/ca/PlatformCAAnimation.cpp
 platform/graphics/ca/PlatformCALayer.cpp
@@ -263,7 +262,6 @@ platform/graphics/ca/TileController.cpp
 platform/graphics/ca/TileCoverageMap.cpp
 platform/graphics/ca/TileGrid.cpp
 platform/graphics/ca/TransformationMatrixCA.cpp
-platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp
 platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm
 platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm
 platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
index 14e3408..63c7c60 100644 (file)
                26F9A83918A046AC00AEB88A /* ViewportConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F9A83718A046AC00AEB88A /* ViewportConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
                285D32082035D6560070D32F /* ServerTimingParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 288E82F02035D4ED00B0DCFF /* ServerTimingParser.h */; };
                2914E3081CAB5A440049966F /* AccessibilityAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 2914E3061CAB5A440049966F /* AccessibilityAttachment.h */; };
-               2917B5621473496C0052C9D0 /* LayerFlushScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 2917B55F1473496C0052C9D0 /* LayerFlushScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               2917B5631473496C0052C9D0 /* LayerFlushSchedulerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2917B5601473496C0052C9D0 /* LayerFlushSchedulerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                293EAE1F1356B2FE0067ACF9 /* RuntimeApplicationChecks.h in Headers */ = {isa = PBXBuildFile; fileRef = 293EAE1E1356B2FE0067ACF9 /* RuntimeApplicationChecks.h */; settings = {ATTRIBUTES = (Private, ); }; };
                29489FC712C00F0300D83F0F /* AccessibilityScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29489FC512C00F0300D83F0F /* AccessibilityScrollView.h */; };
                297BE3D516C03C08003316BD /* PlatformSpeechSynthesisUtterance.h in Headers */ = {isa = PBXBuildFile; fileRef = 2527CC9116BF8BA1009DDAC0 /* PlatformSpeechSynthesisUtterance.h */; };
                A14832C4187F663C00DA63A6 /* WKView.h in Headers */ = {isa = PBXBuildFile; fileRef = A14832A9187F508700DA63A6 /* WKView.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A14832C6187F668F00DA63A6 /* WKViewPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A14832AB187F508700DA63A6 /* WKViewPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A14832C7187F66C800DA63A6 /* WebCoreThread.h in Headers */ = {isa = PBXBuildFile; fileRef = A1483299187F508700DA63A6 /* WebCoreThread.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               A14832C9187F676B00DA63A6 /* WebCoreThreadInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A148329B187F508700DA63A6 /* WebCoreThreadInternal.h */; };
+               A14832C9187F676B00DA63A6 /* WebCoreThreadInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A148329B187F508700DA63A6 /* WebCoreThreadInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A14832CA187F678000DA63A6 /* WebCoreThreadMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = A148329C187F508700DA63A6 /* WebCoreThreadMessage.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A14832CC187F67C400DA63A6 /* WebCoreThreadRun.h in Headers */ = {isa = PBXBuildFile; fileRef = A148329E187F508700DA63A6 /* WebCoreThreadRun.h */; settings = {ATTRIBUTES = (Private, ); }; };
                A14832CF187F684700DA63A6 /* WebCoreThreadSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = A14832A1187F508700DA63A6 /* WebCoreThreadSystemInterface.h */; settings = {ATTRIBUTES = (Private, ); }; };
                28DB9BC72020EA0400E54A07 /* PerformanceServerTiming.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PerformanceServerTiming.idl; sourceTree = "<group>"; };
                2914E3051CAB5A440049966F /* AccessibilityAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityAttachment.cpp; sourceTree = "<group>"; };
                2914E3061CAB5A440049966F /* AccessibilityAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityAttachment.h; sourceTree = "<group>"; };
-               2917B55E1473496C0052C9D0 /* LayerFlushScheduler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayerFlushScheduler.cpp; sourceTree = "<group>"; };
-               2917B55F1473496C0052C9D0 /* LayerFlushScheduler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerFlushScheduler.h; sourceTree = "<group>"; };
-               2917B5601473496C0052C9D0 /* LayerFlushSchedulerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerFlushSchedulerClient.h; sourceTree = "<group>"; };
-               2917B565147349950052C9D0 /* LayerFlushSchedulerMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayerFlushSchedulerMac.cpp; sourceTree = "<group>"; };
                293EAE1E1356B2FE0067ACF9 /* RuntimeApplicationChecks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RuntimeApplicationChecks.h; sourceTree = "<group>"; };
                29489FC512C00F0300D83F0F /* AccessibilityScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityScrollView.h; sourceTree = "<group>"; };
                29498681195341940072D2BD /* TextUndoInsertionMarkupMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TextUndoInsertionMarkupMac.mm; sourceTree = "<group>"; };
                4958781E12A57DBC007238AC /* cocoa */ = {
                        isa = PBXGroup;
                        children = (
-                               2917B565147349950052C9D0 /* LayerFlushSchedulerMac.cpp */,
                                0F5E200518E771FC003EC3E5 /* PlatformCAAnimationCocoa.h */,
                                4958781F12A57DDF007238AC /* PlatformCAAnimationCocoa.mm */,
                                0F13163F16ED0CDE0035CC04 /* PlatformCAFiltersCocoa.mm */,
                                4958781E12A57DBC007238AC /* cocoa */,
                                499B3ED4128CD31400E726C2 /* GraphicsLayerCA.cpp */,
                                499B3ED5128CD31400E726C2 /* GraphicsLayerCA.h */,
-                               2917B55E1473496C0052C9D0 /* LayerFlushScheduler.cpp */,
-                               2917B55F1473496C0052C9D0 /* LayerFlushScheduler.h */,
-                               2917B5601473496C0052C9D0 /* LayerFlushSchedulerClient.h */,
                                7AA3A69D194B59B6001CBD24 /* LayerPool.cpp */,
                                7AA3A69E194B59B6001CBD24 /* LayerPool.h */,
                                0FDF45A61BD1C6FD00E4FA8C /* PlatformCAAnimation.cpp */,
                                E15FF7D518C9553800FE4C87 /* KeypressCommand.h in Headers */,
                                450CEBF115073BBE002BB149 /* LabelableElement.h in Headers */,
                                A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */,
-                               2917B5621473496C0052C9D0 /* LayerFlushScheduler.h in Headers */,
-                               2917B5631473496C0052C9D0 /* LayerFlushSchedulerClient.h in Headers */,
                                E4916FF7195DF6A0005AB349 /* LayerFlushThrottleState.h in Headers */,
                                580371641A66F1D300BAF519 /* LayerFragment.h in Headers */,
                                7AA3A6A0194B59B6001CBD24 /* LayerPool.h in Headers */,
index 02ad5c3..599ed2a 100644 (file)
@@ -85,7 +85,7 @@ bool isMobileStore();
 bool isSpringBoard();
 WEBCORE_EXPORT bool isWebApp();
 WEBCORE_EXPORT bool isWebProcess();
-bool isIBooks();
+WEBCORE_EXPORT bool isIBooks();
 bool isIBooksStorytime();
 WEBCORE_EXPORT bool isTheSecretSocietyHiddenMystery();
 WEBCORE_EXPORT bool isCardiogram();
diff --git a/Source/WebCore/platform/graphics/ca/LayerFlushScheduler.cpp b/Source/WebCore/platform/graphics/ca/LayerFlushScheduler.cpp
deleted file mode 100644 (file)
index 932b6a9..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2011 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. 
- */
-
-#include "config.h"
-
-#include "LayerFlushScheduler.h"
-
-namespace WebCore {
-    
-void LayerFlushScheduler::suspend()
-{
-    if (m_isSuspended)
-        return;
-    
-    m_isSuspended = true;
-    invalidate();
-}
-    
-void LayerFlushScheduler::resume()
-{
-    if (!m_isSuspended)
-        return;
-    
-    m_isSuspended = false;
-    schedule();
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/ca/LayerFlushScheduler.h b/Source/WebCore/platform/graphics/ca/LayerFlushScheduler.h
deleted file mode 100644 (file)
index 6c3d8ab..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2011 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. 
- */
-
-#pragma once
-
-#include "LayerFlushSchedulerClient.h"
-#include "RunLoopObserver.h"
-#include <wtf/Noncopyable.h>
-
-namespace WebCore {
-    
-class LayerFlushScheduler {
-    WTF_MAKE_NONCOPYABLE(LayerFlushScheduler);
-public:
-    WEBCORE_EXPORT LayerFlushScheduler(LayerFlushSchedulerClient*);
-    WEBCORE_EXPORT virtual ~LayerFlushScheduler();
-
-    WEBCORE_EXPORT void schedule();
-    WEBCORE_EXPORT void invalidate();
-
-    WEBCORE_EXPORT void suspend();
-    WEBCORE_EXPORT void resume();
-
-    bool isSuspended() const { return m_isSuspended; }
-
-#if PLATFORM(COCOA)
-    WEBCORE_EXPORT virtual void layerFlushCallback();
-#endif
-
-private:
-    bool m_isSuspended;
-    LayerFlushSchedulerClient* m_client;
-    
-#if PLATFORM(COCOA)
-    std::unique_ptr<RunLoopObserver> m_runLoopObserver;
-#endif
-};
-
-} // namespace WebCore
-
diff --git a/Source/WebCore/platform/graphics/ca/LayerFlushSchedulerClient.h b/Source/WebCore/platform/graphics/ca/LayerFlushSchedulerClient.h
deleted file mode 100644 (file)
index 8def92b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2011 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. 
- */
-
-#ifndef LayerFlushSchedulerClient_h
-#define LayerFlushSchedulerClient_h
-
-namespace WebCore {
-
-class LayerFlushSchedulerClient {
-protected:
-    virtual ~LayerFlushSchedulerClient() = default;
-
-public:
-    // Flush the layers. Returns true on success.
-    virtual bool flushLayers() = 0;
-};
-
-} // namespace WebCore
-
-#endif // LayerFlushSchedulerClient_h
diff --git a/Source/WebCore/platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp b/Source/WebCore/platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp
deleted file mode 100644 (file)
index 966dae7..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2011 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. 
- */
-
-#include "config.h"
-#include "LayerFlushScheduler.h"
-
-#include <wtf/AutodrainedPool.h>
-
-#if PLATFORM(IOS_FAMILY)
-#include "RuntimeApplicationChecks.h"
-#include "WebCoreThreadInternal.h"
-#include <CoreFoundation/CFBundle.h>
-#endif
-
-namespace WebCore {
-
-static CFRunLoopRef currentRunLoop()
-{
-#if PLATFORM(IOS_FAMILY)
-    // A race condition during WebView deallocation can lead to a crash if the layer sync run loop
-    // observer is added to the main run loop <rdar://problem/9798550>. However, for responsiveness,
-    // we still allow this, see <rdar://problem/7403328>. Since the race condition and subsequent
-    // crash are especially troublesome for iBooks, we never allow the observer to be added to the
-    // main run loop in iBooks.
-    if (IOSApplication::isIBooks())
-        return WebThreadRunLoop();
-#endif
-    return CFRunLoopGetCurrent();
-}
-
-LayerFlushScheduler::LayerFlushScheduler(LayerFlushSchedulerClient* client)
-    : m_isSuspended(false)
-    , m_client(client)
-{
-    ASSERT_ARG(client, client);
-
-    m_runLoopObserver = std::make_unique<RunLoopObserver>(static_cast<CFIndex>(RunLoopObserver::WellKnownRunLoopOrders::LayerFlush), [this]() {
-        if (this->isSuspended())
-            return;
-        this->layerFlushCallback();
-    });
-}
-
-LayerFlushScheduler::~LayerFlushScheduler() = default;
-
-void LayerFlushScheduler::layerFlushCallback()
-{
-    ASSERT(!m_isSuspended);
-
-    AutodrainedPool pool;
-    if (m_client->flushLayers())
-        invalidate();
-}
-
-void LayerFlushScheduler::schedule()
-{
-    if (m_isSuspended)
-        return;
-
-    m_runLoopObserver->schedule(currentRunLoop());
-}
-
-void LayerFlushScheduler::invalidate()
-{
-    m_runLoopObserver->invalidate();
-}
-    
-} // namespace WebCore
index 87cbda2..379ac9e 100644 (file)
@@ -42,7 +42,7 @@ void WebRunLoopDisableNested();
 
 void WebThreadInitRunQueue();
 
-CFRunLoopRef WebThreadRunLoop(void);
+WEBCORE_EXPORT CFRunLoopRef WebThreadRunLoop(void);
 WebThreadContext *WebThreadCurrentContext(void);
 
 #if defined(__cplusplus)
index dbb0b68..a9bddd6 100644 (file)
@@ -1,3 +1,24 @@
+2018-10-31  Antti Koivisto  <antti@apple.com>
+
+        Remove LayerFlushScheduler
+        https://bugs.webkit.org/show_bug.cgi?id=191103
+
+        Reviewed by Anders Carlsson.
+
+        Add a RunLoopObserver directly into WebViewLayerFlushScheduler and remove
+        all the virtual cruft.
+
+        * WebView/WebViewData.h:
+        (WebViewLayerFlushScheduler::~WebViewLayerFlushScheduler): Deleted.
+        (): Deleted.
+        * WebView/WebViewData.mm:
+        (currentRunLoop):
+        (WebViewLayerFlushScheduler::WebViewLayerFlushScheduler):
+        (WebViewLayerFlushScheduler::~WebViewLayerFlushScheduler):
+        (WebViewLayerFlushScheduler::schedule):
+        (WebViewLayerFlushScheduler::invalidate):
+        (WebViewLayerFlushScheduler::layerFlushCallback):
+
 2018-10-30  Alexey Proskuryakov  <ap@apple.com>
 
         Enable InstallAPI for iOS unconditionally
index 076e152..da555b9 100644 (file)
@@ -34,8 +34,6 @@
 #import <pal/spi/cocoa/AVKitSPI.h>
 #endif
 #import <WebCore/AlternativeTextClient.h>
-#import <WebCore/LayerFlushScheduler.h>
-#import <WebCore/LayerFlushSchedulerClient.h>
 #import <WebCore/WebCoreKeyboardUIMode.h>
 #import <wtf/HashMap.h>
 #import <wtf/Lock.h>
@@ -51,6 +49,7 @@ namespace WebCore {
 class AlternativeTextUIController;
 class HistoryItem;
 class Page;
+class RunLoopObserver;
 class TextIndicatorWindow;
 class ValidationBubble;
 #if PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
@@ -109,29 +108,29 @@ class WebSelectionServiceController;
 @class WebTextTouchBarItemController;
 #endif
 
-class WebViewLayerFlushScheduler : public WebCore::LayerFlushScheduler {
+class WebViewLayerFlushScheduler {
 public:
     WebViewLayerFlushScheduler(LayerFlushController*);
-    virtual ~WebViewLayerFlushScheduler() { }
+    ~WebViewLayerFlushScheduler();
+
+    void schedule();
+    void invalidate();
 
 private:
-    void layerFlushCallback() override
-    {
-        RefPtr<LayerFlushController> protector = m_flushController;
-        WebCore::LayerFlushScheduler::layerFlushCallback();
-    }
+    void layerFlushCallback();
     
     LayerFlushController* m_flushController;
+    std::unique_ptr<WebCore::RunLoopObserver> m_runLoopObserver;
 };
 
-class LayerFlushController : public RefCounted<LayerFlushController>, public WebCore::LayerFlushSchedulerClient {
+class LayerFlushController : public RefCounted<LayerFlushController> {
 public:
     static Ref<LayerFlushController> create(WebView* webView)
     {
         return adoptRef(*new LayerFlushController(webView));
     }
     
-    virtual bool flushLayers();
+    bool flushLayers();
     
     void scheduleLayerFlush();
     void invalidate();
index 66ba5d9..a74834a 100644 (file)
@@ -37,6 +37,7 @@
 #import <JavaScriptCore/InitializeThreading.h>
 #import <WebCore/AlternativeTextUIController.h>
 #import <WebCore/HistoryItem.h>
+#import <WebCore/RunLoopObserver.h>
 #import <WebCore/TextIndicatorWindow.h>
 #import <WebCore/ValidationBubble.h>
 #import <wtf/MainThread.h>
@@ -44,6 +45,8 @@
 
 #if PLATFORM(IOS_FAMILY)
 #import "WebGeolocationProviderIOS.h"
+#import <WebCore/RuntimeApplicationChecks.h>
+#import <WebCore/WebCoreThreadInternal.h>
 #endif
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
 BOOL applicationIsTerminating = NO;
 int pluginDatabaseClientCount = 0;
 
+static CFRunLoopRef currentRunLoop()
+{
+#if PLATFORM(IOS_FAMILY)
+    // A race condition during WebView deallocation can lead to a crash if the layer sync run loop
+    // observer is added to the main run loop <rdar://problem/9798550>. However, for responsiveness,
+    // we still allow this, see <rdar://problem/7403328>. Since the race condition and subsequent
+    // crash are especially troublesome for iBooks, we never allow the observer to be added to the
+    // main run loop in iBooks.
+    if (WebCore::IOSApplication::isIBooks())
+        return WebThreadRunLoop();
+#endif
+    return CFRunLoopGetCurrent();
+}
+
 void LayerFlushController::scheduleLayerFlush()
 {
     m_layerFlushScheduler.schedule();
@@ -77,9 +94,34 @@ LayerFlushController::LayerFlushController(WebView* webView)
 }
 
 WebViewLayerFlushScheduler::WebViewLayerFlushScheduler(LayerFlushController* flushController)
-    : WebCore::LayerFlushScheduler(flushController)
-    , m_flushController(flushController)
+    : m_flushController(flushController)
+{
+    m_runLoopObserver = std::make_unique<WebCore::RunLoopObserver>(static_cast<CFIndex>(WebCore::RunLoopObserver::WellKnownRunLoopOrders::LayerFlush), [this]() {
+        this->layerFlushCallback();
+    });
+}
+
+WebViewLayerFlushScheduler::~WebViewLayerFlushScheduler()
+{
+}
+
+void WebViewLayerFlushScheduler::schedule()
+{
+    m_runLoopObserver->schedule(currentRunLoop());
+}
+
+void WebViewLayerFlushScheduler::invalidate()
+{
+    m_runLoopObserver->invalidate();
+}
+
+void WebViewLayerFlushScheduler::layerFlushCallback()
 {
+    @autoreleasepool {
+        RefPtr<LayerFlushController> protector = m_flushController;
+        if (m_flushController->flushLayers())
+            invalidate();
+    }
 }
 
 #if PLATFORM(MAC)