Title: [294982] trunk/Source/WebKit
Revision
294982
Author
wenson_hs...@apple.com
Date
2022-05-27 21:05:00 -0700 (Fri, 27 May 2022)

Log Message

Rename the WebKit2 `Image` logging category to `ImageAnalysis`
https://bugs.webkit.org/show_bug.cgi?id=241032

Reviewed by Devin Rousso.

This existing logging category is only used for image analysis -- as such, the logging category
should be renamed to reflect that. This also avoids confusing these logs with the Images logging
category in WebCore, which is really about image decoding, rendering and painting.

No change in behavior.

* Source/WebKit/Platform/Logging.h:
* Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::requestTextRecognition):
(WebKit::WebViewImpl::computeHasVisualSearchResults):
(WebKit::WebViewImpl::installImageAnalysisOverlayView): Deleted.
(WebKit::WebViewImpl::uninstallImageAnalysisOverlayView): Deleted.
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _cancelImageAnalysis]):
(-[WKContentView validateImageAnalysisRequestIdentifier:]):
(-[WKContentView imageAnalysisGestureDidBegin:]):
(-[WKContentView _completeImageAnalysisRequestForContextMenu:requestIdentifier:hasTextResults:]):
(-[WKContentView imageAnalysisGestureDidTimeOut:]):
(-[WKContentView installImageAnalysisInteraction:]): Deleted.
(-[WKContentView uninstallImageAnalysisInteraction]): Deleted.

Canonical link: https://commits.webkit.org/251086@main

Modified Paths

Diff

Modified: trunk/Source/WebKit/Platform/Logging.h (294981 => 294982)


--- trunk/Source/WebKit/Platform/Logging.h	2022-05-28 03:37:10 UTC (rev 294981)
+++ trunk/Source/WebKit/Platform/Logging.h	2022-05-28 04:05:00 UTC (rev 294982)
@@ -59,7 +59,7 @@
     M(IPCMessages) \
     M(ITPDebug) \
     M(IconDatabase) \
-    M(Images) \
+    M(ImageAnalysis) \
     M(IncrementalPDF) \
     M(IncrementalPDFVerbose) \
     M(IndexedDB) \

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (294981 => 294982)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2022-05-28 03:37:10 UTC (rev 294981)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2022-05-28 04:05:00 UTC (rev 294982)
@@ -276,7 +276,7 @@
     auto startTime = MonotonicTime::now();
     processImageAnalyzerRequest(request.get(), [completion = WTFMove(completion), startTime] (CocoaImageAnalysis *analysis, NSError *) mutable {
         auto result = makeTextRecognitionResult(analysis);
-        RELEASE_LOG(Images, "Image analysis completed in %.0f ms (found text? %d)", (MonotonicTime::now() - startTime).milliseconds(), !result.isEmpty());
+        RELEASE_LOG(ImageAnalysis, "Image analysis completed in %.0f ms (found text? %d)", (MonotonicTime::now() - startTime).milliseconds(), !result.isEmpty());
         completion(WTFMove(result));
     });
 }
@@ -294,7 +294,7 @@
     [ensureImageAnalyzer() processRequest:request.get() progressHandler:nil completionHandler:makeBlockPtr([completion = WTFMove(completion), startTime] (CocoaImageAnalysis *analysis, NSError *) mutable {
         BOOL result = [analysis hasResultsForAnalysisTypes:VKAnalysisTypeVisualSearch];
         CFRunLoopPerformBlock(CFRunLoopGetMain(), (__bridge CFStringRef)NSEventTrackingRunLoopMode, makeBlockPtr([completion = WTFMove(completion), result, startTime] () mutable {
-            RELEASE_LOG(Images, "Image analysis completed in %.0f ms (found visual search results? %d)", (MonotonicTime::now() - startTime).milliseconds(), result);
+            RELEASE_LOG(ImageAnalysis, "Image analysis completed in %.0f ms (found visual search results? %d)", (MonotonicTime::now() - startTime).milliseconds(), result);
             completion(result);
         }).get());
         CFRunLoopWakeUp(CFRunLoopGetMain());
@@ -5927,36 +5927,6 @@
 
 #endif // ENABLE(REVEAL)
 
-#if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
-
-void WebViewImpl::installImageAnalysisOverlayView(VKCImageAnalysis *analysis)
-{
-    if (!m_imageAnalysisOverlayView) {
-        m_imageAnalysisOverlayView = adoptNS([PAL::allocVKCImageAnalysisOverlayViewInstance() initWithFrame:[m_view bounds]]);
-        m_imageAnalysisOverlayViewDelegate = adoptNS([[WKImageAnalysisOverlayViewDelegate alloc] initWithWebViewImpl:*this]);
-        [m_imageAnalysisOverlayView setDelegate:m_imageAnalysisOverlayViewDelegate.get()];
-        [m_imageAnalysisOverlayView setActiveInteractionTypes:VKImageAnalysisInteractionTypeTextSelection | VKImageAnalysisInteractionTypeDataDetectors];
-        [m_imageAnalysisOverlayView setWantsAutomaticContentsRectCalculation:NO];
-        setUpAdditionalImageAnalysisBehaviors(m_imageAnalysisOverlayView.get());
-    }
-
-    [m_imageAnalysisOverlayView setAnalysis:analysis];
-    [m_view addSubview:m_imageAnalysisOverlayView.get()];
-}
-
-void WebViewImpl::uninstallImageAnalysisOverlayView()
-{
-    if (!m_imageAnalysisOverlayView)
-        return;
-
-    [m_imageAnalysisOverlayView removeFromSuperview];
-    m_imageAnalysisOverlayViewDelegate = nil;
-    m_imageAnalysisOverlayView = nil;
-    m_imageAnalysisInteractionBounds = { };
-}
-
-#endif // ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)
-
 bool WebViewImpl::imageAnalysisOverlayViewHasCursorAtPoint(NSPoint locationInView) const
 {
 #if ENABLE(IMAGE_ANALYSIS_ENHANCEMENTS)

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (294981 => 294982)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2022-05-28 03:37:10 UTC (rev 294981)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2022-05-28 04:05:00 UTC (rev 294982)
@@ -10677,7 +10677,7 @@
 - (void)_cancelImageAnalysis
 {
     [_imageAnalyzer cancelAllRequests];
-    RELEASE_LOG_IF(self.hasPendingImageAnalysisRequest, Images, "Image analysis request %" PRIu64 " cancelled.", _pendingImageAnalysisRequestIdentifier->toUInt64());
+    RELEASE_LOG_IF(self.hasPendingImageAnalysisRequest, ImageAnalysis, "Image analysis request %" PRIu64 " cancelled.", _pendingImageAnalysisRequestIdentifier->toUInt64());
     _pendingImageAnalysisRequestIdentifier = std::nullopt;
     _isProceedingWithTextSelectionInImage = NO;
     _elementPendingImageAnalysis = std::nullopt;
@@ -10717,7 +10717,7 @@
         [self _invokeAllActionsToPerformAfterPendingImageAnalysis:WebKit::ProceedWithTextSelectionInImage::No];
     }
 
-    RELEASE_LOG(Images, "Image analysis request %" PRIu64 " invalidated.", identifier.toUInt64());
+    RELEASE_LOG(ImageAnalysis, "Image analysis request %" PRIu64 " invalidated.", identifier.toUInt64());
     return NO;
 }
 
@@ -10812,7 +10812,7 @@
             return;
         }
 
-        RELEASE_LOG(Images, "Image analysis preflight gesture initiated (request %" PRIu64 ").", requestIdentifier.toUInt64());
+        RELEASE_LOG(ImageAnalysis, "Image analysis preflight gesture initiated (request %" PRIu64 ").", requestIdentifier.toUInt64());
 
         strongSelf->_elementPendingImageAnalysis = information.hostImageOrVideoElementContext;
 
@@ -10832,7 +10832,7 @@
                 return;
 
             BOOL hasTextResults = [result hasResultsForAnalysisTypes:VKAnalysisTypeText];
-            RELEASE_LOG(Images, "Image analysis completed in %.0f ms (request %" PRIu64 "; found text? %d)", (MonotonicTime::now() - textAnalysisStartTime).milliseconds(), requestIdentifier.toUInt64(), hasTextResults);
+            RELEASE_LOG(ImageAnalysis, "Image analysis completed in %.0f ms (request %" PRIu64 "; found text? %d)", (MonotonicTime::now() - textAnalysisStartTime).milliseconds(), requestIdentifier.toUInt64(), hasTextResults);
 
             strongSelf->_page->updateWithTextRecognitionResult(WebKit::makeTextRecognitionResult(result), elementContext, requestLocation, [requestIdentifier = WTFMove(requestIdentifier), weakSelf, hasTextResults, cgImage, gestureDeferralToken] (WebKit::TextRecognitionUpdateResult updateResult) mutable {
                 auto strongSelf = weakSelf.get();
@@ -10879,7 +10879,7 @@
 
 #if USE(QUICK_LOOK)
         BOOL hasVisualSearchResults = [result hasResultsForAnalysisTypes:VKAnalysisTypeVisualSearch];
-        RELEASE_LOG(Images, "Image analysis completed in %.0f ms (request %" PRIu64 "; found visual search results? %d)", (MonotonicTime::now() - visualSearchAnalysisStartTime).milliseconds(), requestIdentifier.toUInt64(), hasVisualSearchResults);
+        RELEASE_LOG(ImageAnalysis, "Image analysis completed in %.0f ms (request %" PRIu64 "; found visual search results? %d)", (MonotonicTime::now() - visualSearchAnalysisStartTime).milliseconds(), requestIdentifier.toUInt64(), hasVisualSearchResults);
 #else
         UNUSED_PARAM(visualSearchAnalysisStartTime);
 #endif
@@ -10938,7 +10938,7 @@
         if (!cgImage)
             return;
 
-        RELEASE_LOG(Images, "Image analysis timeout gesture initiated.");
+        RELEASE_LOG(ImageAnalysis, "Image analysis timeout gesture initiated.");
         // FIXME: We need to implement some way to cache image analysis results per element, so that we don't end up
         // making redundant image analysis requests for the same image data.
 
@@ -10960,7 +10960,7 @@
 
 #if USE(QUICK_LOOK)
             BOOL hasVisualSearchResults = [result hasResultsForAnalysisTypes:VKAnalysisTypeVisualSearch];
-            RELEASE_LOG(Images, "Image analysis completed in %.0f ms (found visual search results? %d)", (MonotonicTime::now() - visualSearchAnalysisStartTime).milliseconds(), hasVisualSearchResults);
+            RELEASE_LOG(ImageAnalysis, "Image analysis completed in %.0f ms (found visual search results? %d)", (MonotonicTime::now() - visualSearchAnalysisStartTime).milliseconds(), hasVisualSearchResults);
             strongSelf->_hasSelectableTextInImage = YES;
             strongSelf->_hasVisualSearchResults = hasVisualSearchResults;
 #else
@@ -11011,40 +11011,6 @@
     }];
 }
 
-- (void)installImageAnalysisInteraction:(VKCImageAnalysis *)analysis
-{
-    if (!_imageAnalysisInteraction) {
-        _imageAnalysisActionButtons = adoptNS([[NSMutableSet alloc] initWithCapacity:1]);
-        _imageAnalysisInteraction = adoptNS([PAL::allocVKCImageAnalysisInteractionInstance() init]);
-        [_imageAnalysisInteraction setActiveInteractionTypes:VKImageAnalysisInteractionTypeTextSelection | VKImageAnalysisInteractionTypeDataDetectors];
-        [_imageAnalysisInteraction setDelegate:self];
-        [_imageAnalysisInteraction setWantsAutomaticContentsRectCalculation:NO];
-        [_imageAnalysisInteraction setQuickActionConfigurationUpdateHandler:[weakSelf = WeakObjCPtr<WKContentView>(self)] (UIButton *button) {
-            if (auto strongSelf = weakSelf.get())
-                [strongSelf->_imageAnalysisActionButtons addObject:button];
-        }];
-        WebKit::setUpAdditionalImageAnalysisBehaviors(_imageAnalysisInteraction.get());
-        [self addInteraction:_imageAnalysisInteraction.get()];
-    }
-    [_imageAnalysisInteraction setAnalysis:analysis];
-    [_imageAnalysisDeferringGestureRecognizer setEnabled:NO];
-    [_imageAnalysisGestureRecognizer setEnabled:NO];
-}
-
-- (void)uninstallImageAnalysisInteraction
-{
-    if (!_imageAnalysisInteraction)
-        return;
-
-    [self removeInteraction:_imageAnalysisInteraction.get()];
-    [_imageAnalysisInteraction setDelegate:nil];
-    [_imageAnalysisInteraction setQuickActionConfigurationUpdateHandler:nil];
-    _imageAnalysisInteraction = nil;
-    _imageAnalysisActionButtons = nil;
-    [_imageAnalysisDeferringGestureRecognizer setEnabled:WebKit::isLiveTextAvailableAndEnabled()];
-    [_imageAnalysisGestureRecognizer setEnabled:WebKit::isLiveTextAvailableAndEnabled()];
-}
-
 #pragma mark - VKCImageAnalysisInteractionDelegate
 
 - (CGRect)contentsRectForImageAnalysisInteraction:(VKCImageAnalysisInteraction *)interaction
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to