Clean up USE(WEB_THREAD)
authorconrad_shultz@apple.com <conrad_shultz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 20:36:37 +0000 (20:36 +0000)
committerconrad_shultz@apple.com <conrad_shultz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 20:36:37 +0000 (20:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=193698

Rubber-stamped by Tim Horton.

WebCore:

    * page/CaptionUserPreferencesMediaAF.cpp:
    (WebCore::userCaptionPreferencesChangedNotificationCallback):
    * platform/cf/MainThreadSharedTimerCF.cpp:
    (WebCore::applicationDidBecomeActive):
    * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
    (WebCore::dispatchToMainThread):
    * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
    (-[WebCoreTextTrackRepresentationCocoaHelper observeValueForKeyPath:ofObject:change:context:]):
    * platform/ios/LegacyTileCache.mm:
    (WebCore::LegacyTileCache::layoutTiles):
    (WebCore::LegacyTileCache::setTilingMode):
    * platform/ios/WebCoreMotionManager.mm:
    (-[WebCoreMotionManager sendAccelerometerData:]):
    (-[WebCoreMotionManager sendMotionData:withHeading:]):
    * platform/ios/WebVideoFullscreenControllerAVKit.mm:
    (VideoFullscreenControllerContext::requestUpdateInlineRect):
    (VideoFullscreenControllerContext::requestVideoContentLayer):
    (VideoFullscreenControllerContext::returnVideoContentLayer):
    (VideoFullscreenControllerContext::didSetupFullscreen):
    (VideoFullscreenControllerContext::willExitFullscreen):
    (VideoFullscreenControllerContext::didExitFullscreen):
    (VideoFullscreenControllerContext::didCleanupFullscreen):
    (VideoFullscreenControllerContext::fullscreenMayReturnToInline):
    (VideoFullscreenControllerContext::requestFullscreenMode):
    (VideoFullscreenControllerContext::setVideoLayerFrame):
    (VideoFullscreenControllerContext::setVideoLayerGravity):
    (VideoFullscreenControllerContext::fullscreenModeChanged):
    (VideoFullscreenControllerContext::play):
    (VideoFullscreenControllerContext::pause):
    (VideoFullscreenControllerContext::togglePlayState):
    (VideoFullscreenControllerContext::toggleMuted):
    (VideoFullscreenControllerContext::setMuted):
    (VideoFullscreenControllerContext::setVolume):
    (VideoFullscreenControllerContext::setPlayingOnSecondScreen):
    (VideoFullscreenControllerContext::beginScrubbing):
    (VideoFullscreenControllerContext::endScrubbing):
    (VideoFullscreenControllerContext::seekToTime):
    (VideoFullscreenControllerContext::fastSeek):
    (VideoFullscreenControllerContext::beginScanningForward):
    (VideoFullscreenControllerContext::beginScanningBackward):
    (VideoFullscreenControllerContext::endScanning):
    (VideoFullscreenControllerContext::selectAudioMediaOption):
    (VideoFullscreenControllerContext::selectLegibleMediaOption):
    (VideoFullscreenControllerContext::duration const):
    (VideoFullscreenControllerContext::currentTime const):
    (VideoFullscreenControllerContext::bufferedTime const):
    (VideoFullscreenControllerContext::isPlaying const):
    (VideoFullscreenControllerContext::playbackRate const):
    (VideoFullscreenControllerContext::seekableRanges const):
    (VideoFullscreenControllerContext::seekableTimeRangesLastModifiedTime const):
    (VideoFullscreenControllerContext::liveUpdateInterval const):
    (VideoFullscreenControllerContext::canPlayFastReverse const):
    (VideoFullscreenControllerContext::audioMediaSelectionOptions const):
    (VideoFullscreenControllerContext::audioMediaSelectedIndex const):
    (VideoFullscreenControllerContext::legibleMediaSelectionOptions const):
    (VideoFullscreenControllerContext::legibleMediaSelectedIndex const):
    (VideoFullscreenControllerContext::externalPlaybackEnabled const):
    (VideoFullscreenControllerContext::externalPlaybackTargetType const):
    (VideoFullscreenControllerContext::externalPlaybackLocalizedDeviceName const):
    (VideoFullscreenControllerContext::wirelessVideoPlaybackDisabled const):
    (VideoFullscreenControllerContext::setUpFullscreen):
    (VideoFullscreenControllerContext::exitFullscreen):
    (VideoFullscreenControllerContext::requestHideAndExitFullscreen):
    (-[WebVideoFullscreenController enterFullscreen:mode:]):
    (-[WebVideoFullscreenController exitFullscreen]):
    (-[WebVideoFullscreenController requestHideAndExitFullscreen]):
    * platform/ios/wak/WAKWindow.mm:
    (-[WAKWindow setVisible:]):
    (-[WAKWindow setScreenScale:]):
    (-[WAKWindow sendEvent:]):
    (-[WAKWindow sendMouseMoveEvent:contentChange:]):
    * platform/network/ios/NetworkStateNotifierIOS.mm:
    (WebCore::NetworkStateNotifier::startObserving):
    * rendering/RenderThemeIOS.mm:
    (WebCore::contentSizeCategoryDidChange):

WebKitLegacy:

    * Misc/WebGeolocationProviderIOS.mm:
    (-[_WebCoreLocationUpdateThreadingProxy geolocationAuthorizationGranted]):
    (-[_WebCoreLocationUpdateThreadingProxy geolocationAuthorizationDenied]):
    (-[_WebCoreLocationUpdateThreadingProxy positionChanged:]):
    (-[_WebCoreLocationUpdateThreadingProxy errorOccurred:]):
    (-[_WebCoreLocationUpdateThreadingProxy resetGeolocation]):
    * WebCoreSupport/WebFixedPositionContent.mm:
    (-[WebFixedPositionContent didFinishScrollingOrZooming]):
    * Misc/WebCache.mm:
    (+[WebCache emptyInMemoryResources]):
    * WebCoreSupport/WebFrameLoaderClient.mm:
    (-[WebFramePolicyListener use]):
    * WebCoreSupport/WebGeolocationClient.mm:
    (-[WebGeolocationPolicyListener allow]):
    (-[WebGeolocationPolicyListener deny]):
    (-[WebGeolocationPolicyListener denyOnlyThisRequest]):
    * WebView/WebFrame.mm:
    (-[WebFrame deviceOrientationChanged]):
    * WebView/WebHTMLView.mm:
    (hardwareKeyboardAvailabilityChangedCallback):
    * WebView/WebView.mm:
    (+[WebView _releaseMemoryNow]):
    (+[WebView willEnterBackgroundWithCompletionHandler:]):
    (-[WebView updateLayoutIgnorePendingStyleSheets]):
    (-[WebView _dispatchUnloadEvent]):
    (-[WebView _close]):
    (-[WebView _preferencesChangedNotification:]):
    (-[WebView _setCustomFixedPositionLayoutRectInWebThread:synchronize:]):
    (-[WebView goBack]):
    (-[WebView goForward]):
    (+[WebView _cacheModelChangedNotification:]):
    (-[WebView stopLoading:]):
    (-[WebView stopLoadingAndClear]):
    (-[WebView reload:]):
    (WebInstallMemoryPressureHandler):

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

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp
Source/WebCore/platform/cocoa/ContentFilterUnblockHandlerCocoa.mm
Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.mm
Source/WebCore/platform/ios/LegacyTileCache.mm
Source/WebCore/platform/ios/WebCoreMotionManager.mm
Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm
Source/WebCore/platform/ios/wak/WAKWindow.mm
Source/WebCore/platform/network/ios/NetworkStateNotifierIOS.mm
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebKitLegacy/ios/ChangeLog
Source/WebKitLegacy/ios/Misc/WebGeolocationProviderIOS.mm
Source/WebKitLegacy/ios/WebCoreSupport/WebFixedPositionContent.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Misc/WebCache.mm
Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm
Source/WebKitLegacy/mac/WebView/WebFrame.mm
Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
Source/WebKitLegacy/mac/WebView/WebView.mm

index c06d2b5..627e5b2 100644 (file)
@@ -1,3 +1,86 @@
+2019-01-22  Conrad Shultz  <conrad_shultz@apple.com>
+
+        Clean up USE(WEB_THREAD)
+        https://bugs.webkit.org/show_bug.cgi?id=193698
+
+        Rubber-stamped by Tim Horton.
+
+        * page/CaptionUserPreferencesMediaAF.cpp:
+        (WebCore::userCaptionPreferencesChangedNotificationCallback):
+        * platform/cf/MainThreadSharedTimerCF.cpp:
+        (WebCore::applicationDidBecomeActive):
+        * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
+        (WebCore::dispatchToMainThread):
+        * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
+        (-[WebCoreTextTrackRepresentationCocoaHelper observeValueForKeyPath:ofObject:change:context:]):
+        * platform/ios/LegacyTileCache.mm:
+        (WebCore::LegacyTileCache::layoutTiles):
+        (WebCore::LegacyTileCache::setTilingMode):
+        * platform/ios/WebCoreMotionManager.mm:
+        (-[WebCoreMotionManager sendAccelerometerData:]):
+        (-[WebCoreMotionManager sendMotionData:withHeading:]):
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        (VideoFullscreenControllerContext::requestUpdateInlineRect):
+        (VideoFullscreenControllerContext::requestVideoContentLayer):
+        (VideoFullscreenControllerContext::returnVideoContentLayer):
+        (VideoFullscreenControllerContext::didSetupFullscreen):
+        (VideoFullscreenControllerContext::willExitFullscreen):
+        (VideoFullscreenControllerContext::didExitFullscreen):
+        (VideoFullscreenControllerContext::didCleanupFullscreen):
+        (VideoFullscreenControllerContext::fullscreenMayReturnToInline):
+        (VideoFullscreenControllerContext::requestFullscreenMode):
+        (VideoFullscreenControllerContext::setVideoLayerFrame):
+        (VideoFullscreenControllerContext::setVideoLayerGravity):
+        (VideoFullscreenControllerContext::fullscreenModeChanged):
+        (VideoFullscreenControllerContext::play):
+        (VideoFullscreenControllerContext::pause):
+        (VideoFullscreenControllerContext::togglePlayState):
+        (VideoFullscreenControllerContext::toggleMuted):
+        (VideoFullscreenControllerContext::setMuted):
+        (VideoFullscreenControllerContext::setVolume):
+        (VideoFullscreenControllerContext::setPlayingOnSecondScreen):
+        (VideoFullscreenControllerContext::beginScrubbing):
+        (VideoFullscreenControllerContext::endScrubbing):
+        (VideoFullscreenControllerContext::seekToTime):
+        (VideoFullscreenControllerContext::fastSeek):
+        (VideoFullscreenControllerContext::beginScanningForward):
+        (VideoFullscreenControllerContext::beginScanningBackward):
+        (VideoFullscreenControllerContext::endScanning):
+        (VideoFullscreenControllerContext::selectAudioMediaOption):
+        (VideoFullscreenControllerContext::selectLegibleMediaOption):
+        (VideoFullscreenControllerContext::duration const):
+        (VideoFullscreenControllerContext::currentTime const):
+        (VideoFullscreenControllerContext::bufferedTime const):
+        (VideoFullscreenControllerContext::isPlaying const):
+        (VideoFullscreenControllerContext::playbackRate const):
+        (VideoFullscreenControllerContext::seekableRanges const):
+        (VideoFullscreenControllerContext::seekableTimeRangesLastModifiedTime const):
+        (VideoFullscreenControllerContext::liveUpdateInterval const):
+        (VideoFullscreenControllerContext::canPlayFastReverse const):
+        (VideoFullscreenControllerContext::audioMediaSelectionOptions const):
+        (VideoFullscreenControllerContext::audioMediaSelectedIndex const):
+        (VideoFullscreenControllerContext::legibleMediaSelectionOptions const):
+        (VideoFullscreenControllerContext::legibleMediaSelectedIndex const):
+        (VideoFullscreenControllerContext::externalPlaybackEnabled const):
+        (VideoFullscreenControllerContext::externalPlaybackTargetType const):
+        (VideoFullscreenControllerContext::externalPlaybackLocalizedDeviceName const):
+        (VideoFullscreenControllerContext::wirelessVideoPlaybackDisabled const):
+        (VideoFullscreenControllerContext::setUpFullscreen):
+        (VideoFullscreenControllerContext::exitFullscreen):
+        (VideoFullscreenControllerContext::requestHideAndExitFullscreen):
+        (-[WebVideoFullscreenController enterFullscreen:mode:]):
+        (-[WebVideoFullscreenController exitFullscreen]):
+        (-[WebVideoFullscreenController requestHideAndExitFullscreen]):
+        * platform/ios/wak/WAKWindow.mm:
+        (-[WAKWindow setVisible:]):
+        (-[WAKWindow setScreenScale:]):
+        (-[WAKWindow sendEvent:]):
+        (-[WAKWindow sendMouseMoveEvent:contentChange:]):
+        * platform/network/ios/NetworkStateNotifierIOS.mm:
+        (WebCore::NetworkStateNotifier::startObserving):
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::contentSizeCategoryDidChange):
+
 2019-01-23  David Kilzer  <ddkilzer@apple.com>
 
         REGRESSION (r240292): Attempt to fix WinCairo build
index b7923f7..763a1ca 100644 (file)
@@ -97,7 +97,7 @@ namespace WebCore {
 #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
 static void userCaptionPreferencesChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void *, CFDictionaryRef)
 {
-#if !PLATFORM(IOS_FAMILY)
+#if !USE(WEB_THREAD)
     static_cast<CaptionUserPreferencesMediaAF*>(observer)->captionPreferencesChanged();
 #else
     WebThreadRun(^{
index b689228..56d3b16 100644 (file)
@@ -46,9 +46,13 @@ static const CFTimeInterval kCFTimeIntervalDistantFuture = std::numeric_limits<C
 #if PLATFORM(IOS_FAMILY)
 static void applicationDidBecomeActive(CFNotificationCenterRef, void*, CFStringRef, const void*, CFDictionaryRef)
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         restartSharedTimer();
     });
+#else
+    restartSharedTimer();
+#endif
 }
 #endif
 
index 9c329e7..3390ed8 100644 (file)
@@ -144,7 +144,7 @@ bool ContentFilterUnblockHandler::canHandleRequest(const ResourceRequest& reques
 static inline void dispatchToMainThread(void (^block)())
 {
     dispatch_async(dispatch_get_main_queue(), ^{
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
         WebThreadRun(block);
 #else
         block();
index 6e60ebf..53826c4 100644 (file)
@@ -85,7 +85,7 @@ using namespace WebCore;
 {
     UNUSED_PARAM(change);
     UNUSED_PARAM(context);
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         if (_parent && [keyPath isEqual:@"bounds"] && object == _parent->platformLayer())
             _parent->client().textTrackRepresentationBoundsChanged(_parent->bounds());
index 209f88f..f85c8d9 100644 (file)
@@ -277,12 +277,16 @@ void LegacyTileCache::layoutTiles()
     m_hasPendingLayoutTiles = true;
 
     LegacyTileCacheTombstone *tombstone = m_tombstone.get();
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
         if ([tombstone isDead])
             return;
         m_hasPendingLayoutTiles = false;
         doLayoutTiles();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void LegacyTileCache::layoutTilesNow()
@@ -716,12 +720,16 @@ void LegacyTileCache::setTilingMode(TilingMode tilingMode)
     m_hasPendingUpdateTilingMode = true;
 
     LegacyTileCacheTombstone *tombstone = m_tombstone.get();
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
         if ([tombstone isDead])
             return;
         m_hasPendingUpdateTilingMode = false;
         updateTilingMode();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void LegacyTileCache::setTilingDirection(TilingDirection tilingDirection)
index 8f0a86d..6703fd0 100644 (file)
@@ -220,17 +220,23 @@ static const double kGravity = 9.80665;
 
 - (void)sendAccelerometerData:(CMAccelerometerData *)newAcceleration
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
         CMAcceleration accel = newAcceleration.acceleration;
 
         for (auto& client : copyToVector(m_deviceMotionClients))
             client->motionChanged(0, 0, 0, accel.x * kGravity, accel.y * kGravity, accel.z * kGravity, 0, 0, 0);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 - (void)sendMotionData:(CMDeviceMotion *)newMotion withHeading:(CLHeading *)newHeading
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
         // Acceleration is user + gravity
         CMAcceleration userAccel = newMotion.userAcceleration;
         CMAcceleration gravity = newMotion.gravity;
@@ -321,7 +327,9 @@ static const double kGravity = 9.80665;
 
         for (size_t i = 0; i < orientationClients.size(); ++i)
             orientationClients[i]->orientationChanged(alpha, beta, gamma, heading, headingAccuracy);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 @end
index 691cbf8..ffe2110 100644 (file)
@@ -221,13 +221,17 @@ private:
 void VideoFullscreenControllerContext::requestUpdateInlineRect()
 {
 #if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] () mutable {
+#endif
         IntRect clientRect = elementRectInWindow(m_videoElement.get());
         dispatch_async(dispatch_get_main_queue(), [protectedThis = WTFMove(protectedThis), this, clientRect] {
             m_interface->setInlineRect(clientRect, clientRect != IntRect(0, 0, 0, 0));
         });
+#if USE(WEB_THREAD)
     });
+#endif
 #else
     ASSERT_NOT_REACHED();
 #endif
@@ -236,15 +240,19 @@ void VideoFullscreenControllerContext::requestUpdateInlineRect()
 void VideoFullscreenControllerContext::requestVideoContentLayer()
 {
 #if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, videoFullscreenLayer = retainPtr([m_videoFullscreenView layer])] () mutable {
+#endif
         [videoFullscreenLayer setBackgroundColor:cachedCGColor(WebCore::Color::transparent)];
         m_fullscreenModel->setVideoFullscreenLayer(videoFullscreenLayer.get(), [protectedThis = WTFMove(protectedThis), this] () mutable {
             dispatch_async(dispatch_get_main_queue(), [protectedThis = WTFMove(protectedThis), this] {
                 m_interface->setHasVideoContentLayer(true);
             });
         });
+#if USE(WEB_THREAD)
     });
+#endif
 #else
     ASSERT_NOT_REACHED();
 #endif
@@ -253,15 +261,19 @@ void VideoFullscreenControllerContext::requestVideoContentLayer()
 void VideoFullscreenControllerContext::returnVideoContentLayer()
 {
 #if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, videoFullscreenLayer = retainPtr([m_videoFullscreenView layer])] () mutable {
+#endif
         [videoFullscreenLayer setBackgroundColor:cachedCGColor(WebCore::Color::transparent)];
         m_fullscreenModel->setVideoFullscreenLayer(nil, [protectedThis = WTFMove(protectedThis), this] () mutable {
             dispatch_async(dispatch_get_main_queue(), [protectedThis = WTFMove(protectedThis), this] {
                 m_interface->setHasVideoContentLayer(false);
             });
         });
+#if USE(WEB_THREAD)
     });
+#endif
 #else
     ASSERT_NOT_REACHED();
 #endif
@@ -269,31 +281,41 @@ void VideoFullscreenControllerContext::returnVideoContentLayer()
 
 void VideoFullscreenControllerContext::didSetupFullscreen()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
 #if PLATFORM(IOS_FAMILY)
     dispatch_async(dispatch_get_main_queue(), [protectedThis = makeRefPtr(this), this] {
         m_interface->enterFullscreen();
     });
 #else
+#if USE(WEB_THREAD)
     WebThreadRun([protectedThis = makeRefPtr(this), this, videoFullscreenLayer = retainPtr([m_videoFullscreenView layer])] () mutable {
+#endif
         [videoFullscreenLayer setBackgroundColor:cachedCGColor(WebCore::Color::transparent)];
         m_fullscreenModel->setVideoFullscreenLayer(videoFullscreenLayer.get(), [protectedThis = WTFMove(protectedThis), this] () mutable {
             dispatch_async(dispatch_get_main_queue(), [protectedThis = WTFMove(protectedThis), this] {
                 m_interface->enterFullscreen();
             });
         });
+#if USE(WEB_THREAD)
     });
 #endif
+#endif
 }
 
 void VideoFullscreenControllerContext::willExitFullscreen()
 {
 #if PLATFORM(WATCHOS)
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] () mutable {
+#endif
         m_fullscreenModel->willExitFullscreen();
+#if USE(WEB_THREAD)
     });
 #endif
+#endif
 }
 
 void VideoFullscreenControllerContext::didExitFullscreen()
@@ -304,25 +326,33 @@ void VideoFullscreenControllerContext::didExitFullscreen()
         m_interface->cleanupFullscreen();
     });
 #else
+#if USE(WEB_THREAD)
     WebThreadRun([protectedThis = makeRefPtr(this), this] () mutable {
+#endif
         m_fullscreenModel->setVideoFullscreenLayer(nil, [protectedThis = WTFMove(protectedThis), this] () mutable {
             dispatch_async(dispatch_get_main_queue(), [protectedThis = WTFMove(protectedThis), this] {
                 m_interface->cleanupFullscreen();
             });
         });
+#if USE(WEB_THREAD)
     });
 #endif
+#endif
 }
 
 void VideoFullscreenControllerContext::didCleanupFullscreen()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     m_interface->setVideoFullscreenModel(nullptr);
     m_interface->setVideoFullscreenChangeObserver(nullptr);
     m_interface = nullptr;
     m_videoFullscreenView = nil;
 
+#if USE(WEB_THREAD)
     WebThreadRun([protectedThis = makeRefPtr(this), this] {
+#endif
         m_fullscreenModel->setVideoFullscreenLayer(nil);
         m_fullscreenModel->setVideoElement(nullptr);
         m_playbackModel->setMediaElement(nullptr);
@@ -332,18 +362,24 @@ void VideoFullscreenControllerContext::didCleanupFullscreen()
         m_videoElement = nullptr;
 
         [m_controller didFinishFullscreen:this];
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::fullscreenMayReturnToInline()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] () mutable {
+#endif
         IntRect clientRect = elementRectInWindow(m_videoElement.get());
         dispatch_async(dispatch_get_main_queue(), [protectedThis = WTFMove(protectedThis), this, clientRect] {
             m_interface->preparedToReturnToInline(true, clientRect);
         });
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 #pragma mark PlaybackSessionModelClient
@@ -555,21 +591,29 @@ void VideoFullscreenControllerContext::removeClient(VideoFullscreenModelClient&
 
 void VideoFullscreenControllerContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode, bool finishedWithMedia)
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, mode, finishedWithMedia] {
+#endif
         if (m_fullscreenModel)
             m_fullscreenModel->requestFullscreenMode(mode, finishedWithMedia);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::setVideoLayerFrame(FloatRect frame)
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     RetainPtr<CALayer> videoFullscreenLayer = [m_videoFullscreenView layer];
     [videoFullscreenLayer setSublayerTransform:[videoFullscreenLayer transform]];
 
     dispatch_async(dispatch_get_main_queue(), [protectedThis = makeRefPtr(this), this, frame, videoFullscreenLayer = WTFMove(videoFullscreenLayer)] () mutable {
+#if USE(WEB_THREAD)
         WebThreadRun([protectedThis = WTFMove(protectedThis), this, frame, videoFullscreenLayer = WTFMove(videoFullscreenLayer)] {
+#endif
             [CATransaction begin];
             [CATransaction setDisableActions:YES];
             [CATransaction setAnimationDuration:0];
@@ -579,26 +623,36 @@ void VideoFullscreenControllerContext::setVideoLayerFrame(FloatRect frame)
             if (m_fullscreenModel)
                 m_fullscreenModel->setVideoLayerFrame(frame);
             [CATransaction commit];
+#if USE(WEB_THREAD)
         });
+#endif
     });
 }
 
 void VideoFullscreenControllerContext::setVideoLayerGravity(MediaPlayerEnums::VideoGravity videoGravity)
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, videoGravity] {
+#endif
         if (m_fullscreenModel)
             m_fullscreenModel->setVideoLayerGravity(videoGravity);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode mode)
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, mode] {
+#endif
         if (m_fullscreenModel)
             m_fullscreenModel->fullscreenModeChanged(mode);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 bool VideoFullscreenControllerContext::hasVideo() const
@@ -688,205 +742,289 @@ void VideoFullscreenControllerContext::removeClient(PlaybackSessionModelClient&
 
 void VideoFullscreenControllerContext::play()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] {
+#endif
         if (m_playbackModel)
             m_playbackModel->play();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::pause()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] {
+#endif
         if (m_playbackModel)
             m_playbackModel->pause();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::togglePlayState()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] {
+#endif
         if (m_playbackModel)
             m_playbackModel->togglePlayState();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::toggleMuted()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] {
+#endif
         if (m_playbackModel)
             m_playbackModel->toggleMuted();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::setMuted(bool muted)
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, muted] {
+#endif
         if (m_playbackModel)
             m_playbackModel->setMuted(muted);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::setVolume(double volume)
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, volume] {
+#endif
         if (m_playbackModel)
             m_playbackModel->setVolume(volume);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::setPlayingOnSecondScreen(bool value)
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, value] {
+#endif
         if (m_playbackModel)
             m_playbackModel->setPlayingOnSecondScreen(value);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::beginScrubbing()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] {
+#endif
         if (m_playbackModel)
             m_playbackModel->beginScrubbing();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::endScrubbing()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] {
+#endif
         if (m_playbackModel)
             m_playbackModel->endScrubbing();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::seekToTime(double time, double toleranceBefore, double toleranceAfter)
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, time, toleranceBefore, toleranceAfter] {
+#endif
         if (m_playbackModel)
             m_playbackModel->seekToTime(time, toleranceBefore, toleranceAfter);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::fastSeek(double time)
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, time] {
+#endif
         if (m_playbackModel)
             m_playbackModel->fastSeek(time);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::beginScanningForward()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] {
+#endif
         if (m_playbackModel)
             m_playbackModel->beginScanningForward();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::beginScanningBackward()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] {
+#endif
         if (m_playbackModel)
             m_playbackModel->beginScanningBackward();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::endScanning()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this] {
+#endif
         if (m_playbackModel)
             m_playbackModel->endScanning();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::selectAudioMediaOption(uint64_t index)
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, index] {
+#endif
         if (m_playbackModel)
             m_playbackModel->selectAudioMediaOption(index);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 void VideoFullscreenControllerContext::selectLegibleMediaOption(uint64_t index)
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
     WebThreadRun([protectedThis = makeRefPtr(this), this, index] {
+#endif
         if (m_playbackModel)
             m_playbackModel->selectLegibleMediaOption(index);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 double VideoFullscreenControllerContext::duration() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->duration() : 0;
 }
 
 double VideoFullscreenControllerContext::currentTime() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->currentTime() : 0;
 }
 
 double VideoFullscreenControllerContext::bufferedTime() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->bufferedTime() : 0;
 }
 
 bool VideoFullscreenControllerContext::isPlaying() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->isPlaying() : false;
 }
 
 float VideoFullscreenControllerContext::playbackRate() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->playbackRate() : 0;
 }
 
 Ref<TimeRanges> VideoFullscreenControllerContext::seekableRanges() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->seekableRanges() : TimeRanges::create();
 }
 
 double VideoFullscreenControllerContext::seekableTimeRangesLastModifiedTime() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->seekableTimeRangesLastModifiedTime() : 0;
 }
 
 double VideoFullscreenControllerContext::liveUpdateInterval() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->liveUpdateInterval() : 0;
 }
 
 bool VideoFullscreenControllerContext::canPlayFastReverse() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->canPlayFastReverse() : false;
 }
 
 Vector<MediaSelectionOption> VideoFullscreenControllerContext::audioMediaSelectionOptions() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     if (m_playbackModel)
         return m_playbackModel->audioMediaSelectionOptions();
     return { };
@@ -894,13 +1032,17 @@ Vector<MediaSelectionOption> VideoFullscreenControllerContext::audioMediaSelecti
 
 uint64_t VideoFullscreenControllerContext::audioMediaSelectedIndex() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->audioMediaSelectedIndex() : -1;
 }
 
 Vector<MediaSelectionOption> VideoFullscreenControllerContext::legibleMediaSelectionOptions() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     if (m_playbackModel)
         return m_playbackModel->legibleMediaSelectionOptions();
     return { };
@@ -908,31 +1050,41 @@ Vector<MediaSelectionOption> VideoFullscreenControllerContext::legibleMediaSelec
 
 uint64_t VideoFullscreenControllerContext::legibleMediaSelectedIndex() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->legibleMediaSelectedIndex() : -1;
 }
 
 bool VideoFullscreenControllerContext::externalPlaybackEnabled() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->externalPlaybackEnabled() : false;
 }
 
 PlaybackSessionModel::ExternalPlaybackTargetType VideoFullscreenControllerContext::externalPlaybackTargetType() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->externalPlaybackTargetType() : TargetTypeNone;
 }
 
 String VideoFullscreenControllerContext::externalPlaybackLocalizedDeviceName() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->externalPlaybackLocalizedDeviceName() : String();
 }
 
 bool VideoFullscreenControllerContext::wirelessVideoPlaybackDisabled() const
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     return m_playbackModel ? m_playbackModel->wirelessVideoPlaybackDisabled() : true;
 }
 
@@ -940,7 +1092,9 @@ bool VideoFullscreenControllerContext::wirelessVideoPlaybackDisabled() const
 
 void VideoFullscreenControllerContext::setUpFullscreen(HTMLVideoElement& videoElement, UIView *view, HTMLMediaElementEnums::VideoFullscreenMode mode)
 {
+#if USE(WEB_THREAD)
     ASSERT(isMainThread());
+#endif
     RetainPtr<UIView> viewRef = view;
     m_videoElement = &videoElement;
     m_playbackModel = PlaybackSessionModelMediaElement::create();
@@ -958,7 +1112,9 @@ void VideoFullscreenControllerContext::setUpFullscreen(HTMLVideoElement& videoEl
     m_fullscreenModel->setVideoLayerFrame(videoLayerFrame);
 
     dispatch_async(dispatch_get_main_queue(), [protectedThis = makeRefPtr(this), this, videoElementClientRect, viewRef, mode, allowsPictureInPicture] {
+#if USE(WEB_THREAD)
         ASSERT(isUIThread());
+#endif
 
         Ref<PlaybackSessionInterfaceAVKit> sessionInterface = PlaybackSessionInterfaceAVKit::create(*this);
         m_interface = VideoFullscreenInterfaceAVKit::create(sessionInterface.get());
@@ -974,17 +1130,23 @@ void VideoFullscreenControllerContext::setUpFullscreen(HTMLVideoElement& videoEl
 
 void VideoFullscreenControllerContext::exitFullscreen()
 {
+#if USE(WEB_THREAD)
     ASSERT(WebThreadIsCurrent() || isMainThread());
+#endif
     IntRect clientRect = elementRectInWindow(m_videoElement.get());
     dispatch_async(dispatch_get_main_queue(), [protectedThis = makeRefPtr(this), this, clientRect] {
+#if USE(WEB_THREAD)
         ASSERT(isUIThread());
+#endif
         m_interface->exitFullscreen(clientRect);
     });
 }
 
 void VideoFullscreenControllerContext::requestHideAndExitFullscreen()
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     m_interface->requestHideAndExitFullscreen();
 }
 
@@ -1013,7 +1175,9 @@ void VideoFullscreenControllerContext::requestHideAndExitFullscreen()
 
 - (void)enterFullscreen:(UIView *)view mode:(HTMLMediaElementEnums::VideoFullscreenMode)mode
 {
+#if USE(WEB_THREAD)
     ASSERT(isMainThread());
+#endif
     _context = VideoFullscreenControllerContext::create();
     _context->setController(self);
     _context->setUpFullscreen(*_videoElement.get(), view, mode);
@@ -1021,13 +1185,17 @@ void VideoFullscreenControllerContext::requestHideAndExitFullscreen()
 
 - (void)exitFullscreen
 {
+#if USE(WEB_THREAD)
     ASSERT(WebThreadIsCurrent() || isMainThread());
+#endif
     _context->exitFullscreen();
 }
 
 - (void)requestHideAndExitFullscreen
 {
+#if USE(WEB_THREAD)
     ASSERT(isUIThread());
+#endif
     if (_context)
         _context->requestHideAndExitFullscreen();
 }
index 8fcd052..7b0b45e 100644 (file)
@@ -199,9 +199,13 @@ static id<OrientationProvider> gOrientationProvider;
 
     _visible = visible;
 
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         [[NSNotificationCenter defaultCenter] postNotificationName:WAKWindowVisibilityDidChangeNotification object:self userInfo:nil];
     });
+#else
+    [[NSNotificationCenter defaultCenter] postNotificationName:WAKWindowVisibilityDidChangeNotification object:self userInfo:nil];
+#endif
 }
 
 - (NSSelectionDirection)keyViewSelectionDirection
@@ -292,9 +296,13 @@ static id<OrientationProvider> gOrientationProvider;
 {
     _screenScale = scale;
 
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         [[NSNotificationCenter defaultCenter] postNotificationName:WAKWindowScreenScaleDidChangeNotification object:self userInfo:nil];
     });
+#else
+    [[NSNotificationCenter defaultCenter] postNotificationName:WAKWindowScreenScaleDidChangeNotification object:self userInfo:nil];
+#endif
 }
 
 - (CGFloat)screenScale
@@ -315,9 +323,13 @@ static id<OrientationProvider> gOrientationProvider;
 - (void)sendEvent:(WebEvent *)anEvent
 {
     ASSERT(anEvent);
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         [self sendEventSynchronously:anEvent];
     });
+#else
+    [self sendEventSynchronously:anEvent];
+#endif
 }
 
 - (void)sendEventSynchronously:(WebEvent *)anEvent
@@ -358,12 +370,16 @@ static id<OrientationProvider> gOrientationProvider;
 
 - (void)sendMouseMoveEvent:(WebEvent *)anEvent contentChange:(WKContentChange *)aContentChange
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
         [self sendEvent:anEvent];
 
         if (aContentChange)
             *aContentChange = WKObservedContentChange();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 - (void)setExposedScrollViewRect:(CGRect)exposedScrollViewRect
index 2102192..df81c32 100644 (file)
@@ -84,9 +84,13 @@ void NetworkStateNotifier::startObserving()
     if (DeprecatedGlobalSettings::shouldOptOutOfNetworkStateObservation())
         return;
     m_observer = adoptNS([[WebNetworkStateObserver alloc] initWithBlock:^ {
+#if USE(WEB_THREAD)
         WebThreadRun(^ {
             NetworkStateNotifier::singleton().updateStateSoon();
         });
+#else
+        NetworkStateNotifier::singleton().updateStateSoon();
+#endif
     }]);
 }
 
index 3215dce..72eb887 100644 (file)
@@ -280,9 +280,13 @@ static IOSGradientRef gradientWithName(IOSGradientType gradientType)
 static void contentSizeCategoryDidChange(CFNotificationCenterRef, void*, CFStringRef name, const void*, CFDictionaryRef)
 {
     ASSERT_UNUSED(name, CFEqual(name, PAL::get_UIKit_UIContentSizeCategoryDidChangeNotification()));
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
     });
+#else
+    Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
+#endif
 }
 
 RenderThemeIOS::RenderThemeIOS()
index d093f3e..d5c40d7 100644 (file)
@@ -1,3 +1,19 @@
+2019-01-22  Conrad Shultz  <conrad_shultz@apple.com>
+
+        Clean up USE(WEB_THREAD)
+        https://bugs.webkit.org/show_bug.cgi?id=193698
+
+        Rubber-stamped by Tim Horton.
+
+        * Misc/WebGeolocationProviderIOS.mm:
+        (-[_WebCoreLocationUpdateThreadingProxy geolocationAuthorizationGranted]):
+        (-[_WebCoreLocationUpdateThreadingProxy geolocationAuthorizationDenied]):
+        (-[_WebCoreLocationUpdateThreadingProxy positionChanged:]):
+        (-[_WebCoreLocationUpdateThreadingProxy errorOccurred:]):
+        (-[_WebCoreLocationUpdateThreadingProxy resetGeolocation]):
+        * WebCoreSupport/WebFixedPositionContent.mm:
+        (-[WebFixedPositionContent didFinishScrollingOrZooming]):
+
 2019-01-22  Daniel Bates  <dabates@apple.com>
 
         [iOS] Interpret text key commands on keydown and app key commands on keypress
index c2ff350..3d13a07 100644 (file)
@@ -336,38 +336,58 @@ static inline void abortSendLastPosition(WebGeolocationProviderIOS* provider)
 
 - (void)geolocationAuthorizationGranted
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         [_provider geolocationAuthorizationGranted];
     });
+#else
+    [_provider geolocationAuthorizationGranted];
+#endif
 }
 
 - (void)geolocationAuthorizationDenied
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         [_provider geolocationAuthorizationDenied];
     });
+#else
+    [_provider geolocationAuthorizationDenied];
+#endif
 }
 
 - (void)positionChanged:(WebCore::GeolocationPosition&&)position
 {
     RetainPtr<WebGeolocationPosition> webPosition = adoptNS([[WebGeolocationPosition alloc] initWithGeolocationPosition:WTFMove(position)]);
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         [_provider positionChanged:webPosition.get()];
     });
+#else
+    [_provider positionChanged:webPosition.get()];
+#endif
 }
 
 - (void)errorOccurred:(NSString *)errorMessage
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         [_provider errorOccurred:errorMessage];
     });
+#else
+    [_provider errorOccurred:errorMessage];
+#endif
 }
 
 - (void)resetGeolocation
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         [_provider resetGeolocation];
     });
+#else
+    [_provider resetGeolocation];
+#endif
 }
 @end
 
index 217a4ed..d4f7466 100644 (file)
@@ -164,10 +164,15 @@ WebFixedPositionContentData::~WebFixedPositionContentData()
 // FIXME: share code with 'sendScrollEvent'?
 - (void)didFinishScrollingOrZooming
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         if (Frame* frame = [_private->m_webView _mainCoreFrame])
             frame->viewportOffsetChanged(Frame::CompletedScrollOffset);
     });
+#else
+    if (Frame* frame = [_private->m_webView _mainCoreFrame])
+        frame->viewportOffsetChanged(Frame::CompletedScrollOffset);
+#endif
 }
 
 - (void)setViewportConstrainedLayers:(WTF::HashMap<CALayer *, std::unique_ptr<WebCore::ViewportConstraints>>&)layerMap stickyContainerMap:(const WTF::HashMap<CALayer*, CALayer*>&)stickyContainers
index 00717e0..603a5dc 100644 (file)
@@ -1,3 +1,38 @@
+2019-01-22  Conrad Shultz  <conrad_shultz@apple.com>
+
+        Clean up USE(WEB_THREAD)
+        https://bugs.webkit.org/show_bug.cgi?id=193698
+
+        Rubber-stamped by Tim Horton.
+
+        * Misc/WebCache.mm:
+        (+[WebCache emptyInMemoryResources]):
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (-[WebFramePolicyListener use]):
+        * WebCoreSupport/WebGeolocationClient.mm:
+        (-[WebGeolocationPolicyListener allow]):
+        (-[WebGeolocationPolicyListener deny]):
+        (-[WebGeolocationPolicyListener denyOnlyThisRequest]):
+        * WebView/WebFrame.mm:
+        (-[WebFrame deviceOrientationChanged]):
+        * WebView/WebHTMLView.mm:
+        (hardwareKeyboardAvailabilityChangedCallback):
+        * WebView/WebView.mm:
+        (+[WebView _releaseMemoryNow]):
+        (+[WebView willEnterBackgroundWithCompletionHandler:]):
+        (-[WebView updateLayoutIgnorePendingStyleSheets]):
+        (-[WebView _dispatchUnloadEvent]):
+        (-[WebView _close]):
+        (-[WebView _preferencesChangedNotification:]):
+        (-[WebView _setCustomFixedPositionLayoutRectInWebThread:synchronize:]):
+        (-[WebView goBack]):
+        (-[WebView goForward]):
+        (+[WebView _cacheModelChangedNotification:]):
+        (-[WebView stopLoading:]):
+        (-[WebView stopLoadingAndClear]):
+        (-[WebView reload:]):
+        (WebInstallMemoryPressureHandler):
+
 2019-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Introduce UndoStep::label() and adopt it in WebKitLegacy and WebKit
index 3b6cd92..4a2c330 100644 (file)
@@ -139,7 +139,9 @@ class DefaultStorageSessionProvider : public WebCore::StorageSessionProvider {
     // _close]. [WebView _close] schedules its work on the WebThread. So we
     // schedule this method on the WebThread as well so as to pick up all the
     // dead resources left behind after closing the WebViews
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
         WebKit::MemoryMeasure measurer("[WebCache emptyInMemoryResources]");
 
         // Toggling the cache model like this forces the cache to evict all its in-memory resources.
@@ -148,7 +150,9 @@ class DefaultStorageSessionProvider : public WebCore::StorageSessionProvider {
         [WebView _setCacheModel:cacheModel];
 
         WebCore::MemoryCache::singleton().pruneLiveResources(true);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 + (void)sizeOfDeadResources:(int *)resources
index ae8b9ef..73de0ed 100644 (file)
@@ -2454,12 +2454,16 @@ void WebFrameLoaderClient::finishedLoadingIcon(uint64_t callbackID, SharedBuffer
 #if HAVE(APP_LINKS)
     if (_appLinkURL && _frame) {
         [LSAppLink openWithURL:_appLinkURL.get() completionHandler:^(BOOL success, NSError *) {
+#if USE(WEB_THREAD)
             WebThreadRun(^{
+#endif
                 if (success)
                     [self receivedPolicyDecision:PolicyAction::Ignore];
                 else
                     [self receivedPolicyDecision:PolicyAction::Use];
+#if USE(WEB_THREAD)
             });
+#endif
         }];
         return;
     }
index 2cf715e..012d04b 100644 (file)
@@ -174,25 +174,37 @@ Optional<GeolocationPosition> WebGeolocationClient::lastPosition()
 
 - (void)allow
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         _geolocation->setIsAllowed(true);
     });
+#else
+    _geolocation->setIsAllowed(true);
+#endif
 }
 
 - (void)deny
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         _geolocation->setIsAllowed(false);
     });
+#else
+    _geolocation->setIsAllowed(false);
+#endif
 }
 
 - (void)denyOnlyThisRequest
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
         // A soft deny does not prevent subsequent request from the Geolocation object.
         [self deny];
         _geolocation->resetIsAllowed();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 - (BOOL)shouldClearCache
index a93def6..7d16fc9 100644 (file)
@@ -1296,14 +1296,18 @@ static WebFrameLoadType toWebFrameLoadType(FrameLoadType frameLoadType)
 
 - (void)deviceOrientationChanged
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
 #if ENABLE(ORIENTATION_EVENTS)
         WebView *webView = getWebView(self);
         [webView _setDeviceOrientation:[[webView _UIKitDelegateForwarder] deviceOrientation]];
 #endif
         if (WebCore::Frame* frame = core(self))
             frame->orientationChanged();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 - (void)setNeedsLayout
index 7b4394a..c4208f2 100644 (file)
@@ -820,11 +820,15 @@ static NSString * const WebMarkedTextUpdatedNotification = @"WebMarkedTextUpdate
 static void hardwareKeyboardAvailabilityChangedCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef)
 {
     ASSERT(observer);
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
         WebHTMLView *webView = (__bridge WebHTMLView *)observer;
         if (Frame* coreFrame = core([webView _frame]))
             coreFrame->eventHandler().capsLockStateMayHaveChanged();
+#if USE(WEB_THREAD)
     });
+#endif
 }
 #endif
 
index ed0e0df..e201353 100644 (file)
@@ -1783,9 +1783,13 @@ static void WebKitInitializeGamepadProviderIfNecessary()
 
 + (void)_releaseMemoryNow
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         WebCore::releaseMemory(Critical::Yes, Synchronous::Yes);
     });
+#else
+    WebCore::releaseMemory(Critical::Yes, Synchronous::Yes);
+#endif
 }
 
 - (void)_replaceCurrentHistoryItem:(WebHistoryItem *)item
@@ -1797,10 +1801,14 @@ static void WebKitInitializeGamepadProviderIfNecessary()
 
 + (void)willEnterBackgroundWithCompletionHandler:(void(^)(void))handler
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
         [WebView _releaseMemoryNow];
         dispatch_async(dispatch_get_main_queue(), handler);
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 + (BOOL)isCharacterSmartReplaceExempt:(unichar)character isPreviousCharacter:(BOOL)b
@@ -1810,13 +1818,17 @@ static void WebKitInitializeGamepadProviderIfNecessary()
 
 - (void)updateLayoutIgnorePendingStyleSheets
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
         for (Frame* frame = [self _mainCoreFrame]; frame; frame = frame->tree().traverseNext()) {
             Document *document = frame->document();
             if (document)
                 document->updateLayoutIgnorePendingStylesheets();
         }
+#if USE(WEB_THREAD)
     });
+#endif
 }
 #endif
 
@@ -2155,7 +2167,9 @@ static NSMutableSet *knownPluginMIMETypes()
 
 - (void)_dispatchUnloadEvent
 {
+#if USE(WEB_THREAD)
     WebThreadRun(^{
+#endif
         WebFrame *mainFrame = [self mainFrame];
         Frame *coreMainFrame = core(mainFrame);
         if (coreMainFrame) {
@@ -2163,7 +2177,9 @@ static NSMutableSet *knownPluginMIMETypes()
             if (document)
                 document->dispatchWindowEvent(Event::create(eventNames().unloadEvent, Event::CanBubble::No, Event::IsCancelable::No));
         }
+#if USE(WEB_THREAD)
     });
+#endif
 }
 
 - (DOMCSSStyleDeclaration *)styleAtSelectionStart
@@ -2312,8 +2328,10 @@ static bool fastDocumentTeardownEnabled()
 
     [self _clearDelegates];
 
+#if USE(WEB_THREAD)
     // Fix for problems such as <rdar://problem/5774587> Crash closing tab in WebCore::Frame::page() from -[WebCoreFrameBridge pauseTimeouts]
     WebThreadRun(^{
+#endif
 #endif            
 
     if (!_private || _private->closed)
@@ -2419,7 +2437,7 @@ static bool fastDocumentTeardownEnabled()
         [WebCache setDisabled:YES];
     }
 #endif
-#if PLATFORM(IOS_FAMILY)
+#if PLATFORM(IOS_FAMILY) && USE(WEB_THREAD)
     // Fix for problems such as <rdar://problem/5774587> Crash closing tab in WebCore::Frame::page() from -[WebCoreFrameBridge pauseTimeouts]
     });
 #endif            
@@ -2792,14 +2810,18 @@ static bool needsSelfRetainWhileLoadingQuirk()
 
 #if PLATFORM(IOS_FAMILY)
     } else {
+#if USE(WEB_THREAD)
         WebThreadRun(^{
+#endif
             // It is possible that the prefs object has already changed before the invocation could be called
             // on the web thread. This is not possible on TOT which is why they have a simple ASSERT.
             WebPreferences *preferences = (WebPreferences *)[notification object];
             if (preferences != [self preferences])
                 return;
             [self _preferencesChanged:preferences];
+#if USE(WEB_THREAD)
         });
+#endif
     }
 #endif
 }
@@ -4359,9 +4381,14 @@ IGNORE_WARNINGS_END
     }
     if (!synchronize)
         return;
+
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         [self _synchronizeCustomFixedPositionLayoutRect];
     });
+#else
+    [self _synchronizeCustomFixedPositionLayoutRect];
+#endif
 }
 
 - (void)_setCustomFixedPositionLayoutRect:(CGRect)rect
@@ -6441,11 +6468,11 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
     if (!_private->page)
         return NO;
     
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     if (WebThreadIsCurrent() || !WebThreadIsEnabled())
 #endif
     return _private->page->backForward().goBack();
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         _private->page->backForward().goBack();
     });
@@ -6459,11 +6486,11 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
     if (!_private->page)
         return NO;
 
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     if (WebThreadIsCurrent() || !WebThreadIsEnabled())
 #endif
     return _private->page->backForward().goForward();
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     WebThreadRun(^{
         _private->page->backForward().goForward();
     });
@@ -7414,7 +7441,7 @@ static WebFrameView *containingFrameView(NSView *view)
 
 + (void)_cacheModelChangedNotification:(NSNotification *)notification
 {
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     // This needs to happen on the Web Thread
     WebThreadRun(^{
 #endif
@@ -7426,7 +7453,7 @@ static WebFrameView *containingFrameView(NSView *view)
         [self _setCacheModel:cacheModel];
     else if (cacheModel < [self _cacheModel])
         [self _setCacheModel:std::max([[WebPreferences standardPreferences] cacheModel], [self _maxCacheModelInAnyInstance])];
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     });
 #endif
 }
@@ -7573,7 +7600,7 @@ static WebFrameView *containingFrameView(NSView *view)
 
 - (IBAction)stopLoading:(id)sender
 {
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     if (WebThreadNotCurrent()) {
         _private->isStopping = true;
         WebThreadSetShouldYield();
@@ -7582,7 +7609,7 @@ static WebFrameView *containingFrameView(NSView *view)
         _private->isStopping = false;
 #endif
     [[self mainFrame] stopLoading];
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     });
 #endif
 }
@@ -7590,11 +7617,13 @@ static WebFrameView *containingFrameView(NSView *view)
 #if PLATFORM(IOS_FAMILY)
 - (void)stopLoadingAndClear
 {
+#if USE(WEB_THREAD)
     if (WebThreadNotCurrent() && !WebThreadIsLocked()) {
         _private->isStopping = true;
         WebThreadSetShouldYield();
     }
     WebThreadRun(^{
+#endif
         _private->isStopping = false;
 
         WebFrame *frame = [self mainFrame];
@@ -7609,17 +7638,19 @@ static WebFrameView *containingFrameView(NSView *view)
         [mainFrameView _setDocumentView:plainWhiteView];
         [plainWhiteView setNeedsDisplay:YES];
         [plainWhiteView release];
+#if USE(WEB_THREAD)
     });
+#endif
 }
 #endif
 
 - (IBAction)reload:(id)sender
 {
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     WebThreadRun(^{
 #endif            
     [[self mainFrame] reload];
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
     });
 #endif            
 }
@@ -10279,11 +10310,11 @@ void WebInstallMemoryPressureHandler(void)
         std::call_once(onceFlag, [] {
             auto& memoryPressureHandler = MemoryPressureHandler::singleton();
             memoryPressureHandler.setLowMemoryHandler([] (Critical critical, Synchronous synchronous) {
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
                 WebThreadRun(^{
 #endif
                 WebCore::releaseMemory(critical, synchronous);
-#if PLATFORM(IOS_FAMILY)
+#if USE(WEB_THREAD)
                 });
 #endif
             });