[webkit-changes] [WebKit/WebKit] 13873b: Annotate some main-thread-only classes and protoco...

geoffreygaren noreply at github.com
Fri May 17 16:12:39 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 13873b2f58fb7748c641b8f29ebc19e5ea73f267
      https://github.com/WebKit/WebKit/commit/13873b2f58fb7748c641b8f29ebc19e5ea73f267
  Author: Geoffrey Garen <ggaren at apple.com>
  Date:   2024-05-17 (Fri, 17 May 2024)

  Changed paths:
    M Source/WebKit/Shared/API/Cocoa/WKFoundation.h
    M Source/WebKit/UIProcess/API/Cocoa/WKBackForwardList.h
    M Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItem.h
    M Source/WebKit/UIProcess/API/Cocoa/WKContentRuleList.h
    M Source/WebKit/UIProcess/API/Cocoa/WKContentRuleListStore.h
    M Source/WebKit/UIProcess/API/Cocoa/WKContentWorld.h
    M Source/WebKit/UIProcess/API/Cocoa/WKContextMenuElementInfo.h
    M Source/WebKit/UIProcess/API/Cocoa/WKDownload.h
    M Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegate.h
    M Source/WebKit/UIProcess/API/Cocoa/WKFindConfiguration.h
    M Source/WebKit/UIProcess/API/Cocoa/WKFindResult.h
    M Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.h
    M Source/WebKit/UIProcess/API/Cocoa/WKHTTPCookieStore.h
    M Source/WebKit/UIProcess/API/Cocoa/WKNavigation.h
    M Source/WebKit/UIProcess/API/Cocoa/WKNavigationAction.h
    M Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h
    M Source/WebKit/UIProcess/API/Cocoa/WKNavigationResponse.h
    M Source/WebKit/UIProcess/API/Cocoa/WKOpenPanelParameters.h
    M Source/WebKit/UIProcess/API/Cocoa/WKPDFConfiguration.h
    M Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h
    M Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.h
    M Source/WebKit/UIProcess/API/Cocoa/WKScriptMessage.h
    M Source/WebKit/UIProcess/API/Cocoa/WKScriptMessageHandler.h
    M Source/WebKit/UIProcess/API/Cocoa/WKScriptMessageHandlerWithReply.h
    M Source/WebKit/UIProcess/API/Cocoa/WKSecurityOrigin.h
    M Source/WebKit/UIProcess/API/Cocoa/WKSnapshotConfiguration.h
    M Source/WebKit/UIProcess/API/Cocoa/WKUIDelegate.h
    M Source/WebKit/UIProcess/API/Cocoa/WKURLSchemeHandler.h
    M Source/WebKit/UIProcess/API/Cocoa/WKUserContentController.h
    M Source/WebKit/UIProcess/API/Cocoa/WKUserScript.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataRecord.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWindowFeatures.h

  Log Message:
  -----------
  Annotate some main-thread-only classes and protocols in WebKit API
https://bugs.webkit.org/show_bug.cgi?id=273798
rdar://127629908

Reviewed by Brady Eidson.

Most WebKit APIs are main-thread-only so let's say so for better
ergonomics and error checking for clients.

I manually tested these classes:

WKBackForwardList
WKBackForwardListItem
WKWebViewConfiguration
WKUserContentController
WKContentRuleList
WKContentRuleListStore
WKContentWorld
WKContextMenuElementInfo
WKDownload
WKFindConfiguration
WKFindResult
WKFrameInfo
WKHTTPCookieStore
WKNavigation
WKNavigationAction
WKNavigationResponse
WKPreferences
WKProcessPool
WKScriptMessage
WKWebsiteDataStore
WKOpenPanelParameters
WKPDFConfiguration
WKSecurityOrigin
WKSnapshotConfiguration
WKUserScript
WKWebpagePreferences
WKWebsiteDataRecord
WKWebView
WKWindowFeatures

...and these callback-to-WebKit APIs:

WKDownloadDelegate
   - decideDestinationUsingResponse
   - willPerformHTTPRedirection
   - didReceiveAuthenticationChallenge

WKUIDelegate
   - runJavaScriptAlertPanelWithMessage
   - runJavaScriptConfirmPanelWithMessage
   - runJavaScriptTextInputPanelWithPrompt
   - requestMediaCapturePermissionForOrigin
   - requestDeviceOrientationAndMotionPermissionForOrigin
   - contextMenuConfigurationForElement
   - showLockdownModeFirstUseMessage
   - runOpenPanelWithParameters

WKScriptMessageHandlerWithReply
   - didReceiveScriptMessage

...and verified that they compile when used in "isolated" (i.e. main thread)
code and fail to compile when used in "nonisolated" (i.e. secondary thread)
code.

I manually tested these protocols:

WKHTTPCookieStoreObserver
WKUIDelegate
WKURLSchemeHandler
WKScriptMessageHandler
WKScriptMessageHandlerWithReply
WKDownloadDelegate
WKNavigationDelegate

...and these callback-to-client APIs:

WKContentRuleListStore
   - compileContentRuleListForIdentifier
   - lookUpContentRuleListForIdentifier
   - removeContentRuleListForIdentifier
   - getAvailableContentRuleListIdentifiers

WKDownload
   - cancel

WKHTTPCookieStore
   - getAllCookies
   - setCookie
   - deleteCookie
   - setCookiePolicy
   - getCookiePolicy

WKWebsiteDataStore
   - fetchDataRecordsOfTypes
   - removeDataOfTypes
   - removeDataOfTypes
   - removeDataStoreForIdentifier
   - fetchAllDataStoreIdentifiers

* WKWebView.h
   - evaluateJavaScript
   - evaluateJavaScript
   - callAsyncJavaScript
   - closeAllMediaPresentationsWithCompletionHandler
   - pauseAllMediaPlaybackWithCompletionHandler
   - setAllMediaPlaybackSuspended
   - requestMediaPlaybackStateWithCompletionHandler
   - setCameraCaptureState
   - setMicrophoneCaptureState
   - takeSnapshotWithConfiguration
   - createPDFWithConfiguration
   - createWebArchiveDataWithCompletionHandler
   - findString
   - startDownloadUsingRequest
   - resumeDownloadFromResumeData

...and verified that they compile when implemented in "isolated" (i.e. main
thread) code.

These classes are thread safe and need no annotation:

WKURLSchemeTask

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list