[Cocoa] Update some code to be more ARC-compatible to prepare for future ARC adoption
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Jun 2018 19:46:17 +0000 (19:46 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Jun 2018 19:46:17 +0000 (19:46 +0000)
commit5a5cdd5f2c96ebca98b7b91c769a5ea41e08a3b8
tree64dfa4bfd8bcdc795d0bba9650786d2b4e6e5257
parentec5052638a290a23561c0acc256484dca1655e00
[Cocoa] Update some code to be more ARC-compatible to prepare for future ARC adoption
https://bugs.webkit.org/show_bug.cgi?id=186227

Reviewed by Dan Bernstein.

Source/JavaScriptCore:

* API/JSContext.mm:
(-[JSContext name]): Use CFBridgingRelease instead of autorelease.
* API/JSValue.mm:
(valueToObjectWithoutCopy): Use CFBridgingRelease instead of autorelease.
(containerValueToObject): Use adoptCF instead of autorelease. This is not only more
ARC-compatible, but more efficient.
(valueToString): Use CFBridgingRelease instead of autorelease.

Source/WebCore:

* bridge/objc/objc_instance.mm:
(ObjcInstance::~ObjcInstance): Use @autoreleasepool instead of NSAutoreleasePool.
* platform/ios/wak/WAKView.mm:
(-[WAKView _appendDescriptionToString:atLevel:]): Ditto.

Source/WebKitLegacy/mac:

* Misc/WebKitErrors.m:
(+[NSError _registerWebKitErrors]): Use @autoreleasepool instead of NSAutoreleasePool.
* Plugins/WebPluginDatabase.mm:
(-[WebPluginDatabase refresh]): Ditto.
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::setStatusbarText): Ditto.

Tools:

* DumpRenderTree/mac/AccessibilityCommonMac.mm:
(+[NSString stringWithJSStringRef:]): Use CFBridgingRelease instead of autorelease.
(-[NSString createJSStringRef]): Add __bridge to a bridging typecast.

* DumpRenderTree/mac/AccessibilityControllerMac.mm: Add a missing include.

* DumpRenderTree/mac/AccessibilityNotificationHandler.mm:
(-[NSString createJSStringRef]): Add __bridge to a bridging typecast.
* DumpRenderTree/mac/AccessibilityTextMarkerMac.mm:
(AccessibilityTextMarker::isEqual): Ditto.
(AccessibilityTextMarkerRange::isEqual): Ditto.

* DumpRenderTree/mac/DumpRenderTree.mm:
(-[DumpRenderTree _waitForWebThread]): Use @autoreleasepool instead of NSAutoreleasePool.
(DumpRenderTreeMain): Ditto.
(WebThreadLockAfterDelegateCallbacksHaveCompleted): Ditto.
(runTest): Ditto.

* DumpRenderTree/mac/DumpRenderTreeDraggingInfo.mm:
(copyFile): Use a std::pair to return both a URL and an error rather than using an
out argument for the NSError.
(-[DumpRenderTreeFilePromiseReceiver receivePromisedFilesAtDestination:options:operationQueue:reader:]):
Updated for the above change.

* DumpRenderTree/mac/DumpRenderTreeWindow.mm:
(-[DumpRenderTreeWindow _addToOpenWindows]): Add __bridge to a bridging typecast.
(-[DumpRenderTreeWindow close]): Ditto.
* DumpRenderTree/mac/LayoutTestHelper.m:
(setDisplayColorProfile): Ditto.

* DumpRenderTree/mac/PolicyDelegate.mm: Add a missing include.

* DumpRenderTree/mac/ResourceLoadDelegate.mm:
(-[ResourceLoadDelegate webView:resource:willSendRequest:redirectResponse:fromDataSource:]):
Add __bridge to a bridging typecast.
* DumpRenderTree/mac/TestRunnerMac.mm:
(-[APITestDelegateIPhone initWithTestRunner:utf8Data:baseURL:]): Ditto.
(TestRunner::apiTestNewWindowDataLoadBaseURL): Use @autoreleasepool instead of NSAutoreleasePool.

* DumpRenderTree/mac/TextInputControllerMac.m: Fix a comment.

* DumpRenderTree/mac/UIScriptControllerMac.mm:
(WTR::UIScriptController::replaceTextAtRange): Add __bridge to a bridging typecast.
(WTR::UIScriptController::contentsOfUserInterfaceItem const): Ditto.
(WTR::UIScriptController::overridePreference): Ditto.
* DumpRenderTree/mac/WorkQueueItemMac.mm:
(LoadItem::invoke const): Ditto.
(LoadHTMLStringItem::invoke const): Ditto.
(ScriptItem::invoke const): Ditto.

* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(+[NSString stringWithJSStringRef:]): Use CFBridgingRelease instead of autorelease.
(-[NSString createJSStringRef]): Add __bridge to a bridging typecast.

* WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm:
(+[NSString stringWithJSStringRef:]): Use CFBridgingRelease instead of autorelease.
(-[NSString createJSStringRef]): Add __bridge to a bridging typecast.

* WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm:
(WTR::AccessibilityController::accessibleElementById): Add __bridge to a bridging typecast.
* WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm:
(-[NSString createJSStringRef]): Ditto.
* WebKitTestRunner/InjectedBundle/mac/AccessibilityTextMarkerMac.mm:
(WTR::AccessibilityTextMarker::isEqual): Ditto.
* WebKitTestRunner/InjectedBundle/mac/AccessibilityTextMarkerRangeMac.mm:
(WTR::AccessibilityTextMarkerRange::isEqual): Ditto.
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::AccessibilityUIElement::setSelectedVisibleTextRange): Ditto.
(WTR::AccessibilityUIElement::lineTextMarkerRangeForTextMarker): Ditto.
(WTR::AccessibilityUIElement::textMarkerRangeLength): Ditto.
(WTR::AccessibilityUIElement::previousTextMarker): Ditto.
(WTR::AccessibilityUIElement::nextTextMarker): Ditto.
(WTR::AccessibilityUIElement::stringForTextMarkerRange): Ditto.
(WTR::AccessibilityUIElement::textMarkerRangeForMarkers): Ditto.
(WTR::AccessibilityUIElement::startTextMarkerForTextMarkerRange): Ditto.
(WTR::AccessibilityUIElement::endTextMarkerForTextMarkerRange): Ditto.
(WTR::AccessibilityUIElement::accessibilityElementForTextMarker): Ditto.
(WTR::createJSStringRef): Ditto.
(WTR::AccessibilityUIElement::attributedStringForTextMarkerRange): Ditto.
(WTR::AccessibilityUIElement::attributedStringForTextMarkerRangeWithOptions): Ditto.
(WTR::AccessibilityUIElement::attributedStringForTextMarkerRangeContainsAttribute): Ditto.
(WTR::AccessibilityUIElement::indexForTextMarker): Ditto.
(WTR::AccessibilityUIElement::isTextMarkerValid): Ditto.
(WTR::AccessibilityUIElement::leftWordTextMarkerRangeForTextMarker): Ditto.
(WTR::AccessibilityUIElement::rightWordTextMarkerRangeForTextMarker): Ditto.
(WTR::AccessibilityUIElement::previousWordStartTextMarkerForTextMarker): Ditto.
(WTR::AccessibilityUIElement::nextWordEndTextMarkerForTextMarker): Ditto.
(WTR::AccessibilityUIElement::paragraphTextMarkerRangeForTextMarker): Ditto.
(WTR::AccessibilityUIElement::previousParagraphStartTextMarkerForTextMarker): Ditto.
(WTR::AccessibilityUIElement::nextParagraphEndTextMarkerForTextMarker): Ditto.
(WTR::AccessibilityUIElement::sentenceTextMarkerRangeForTextMarker): Ditto.
(WTR::AccessibilityUIElement::previousSentenceStartTextMarkerForTextMarker): Ditto.
(WTR::AccessibilityUIElement::nextSentenceEndTextMarkerForTextMarker): Ditto.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::initializeWebViewConfiguration): Ditto.
(WTR::TestController::platformContext): Ditto.
(WTR::TestController::platformPreferences): Ditto.
(WTR::TestController::platformAdjustContext): Ditto.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView): Ditto.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::initializeInjectedBundlePath): Ditto.
(WTR::TestController::initializeTestPluginDirectory): Ditto.
(WTR::TestController::platformConfigureViewForTest): Ditto.

* WebKitTestRunner/mac/UIScriptControllerMac.mm:
(WTR::nsString): Use CFBridgingRelease instead of autorelease.
(WTR::UIScriptController::platformPlayBackEventStream): Add __bridge to a bridging
typecast.

* WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.mm: Add a missing include.

* WebKitTestRunner/mac/WebKitTestRunnerPasteboard.mm:
(-[LocalPasteboard setPropertyList:forType:]): Add _bridge to a bridging typecast.
(-[LocalPasteboard setString:forType:]): Ditto.

* WebKitTestRunner/mac/main.mm:
(main): Use @autoreleasepool instead of NSAutoreleasePool.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232452 268f45cc-cd09-0410-ab3c-d52691b4dbfc
39 files changed:
Source/JavaScriptCore/API/JSContext.mm
Source/JavaScriptCore/API/JSValue.mm
Source/JavaScriptCore/ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/bridge/objc/objc_instance.mm
Source/WebCore/platform/ios/wak/WAKView.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Misc/WebKitErrors.m
Source/WebKitLegacy/mac/Plugins/WebPluginDatabase.mm
Source/WebKitLegacy/mac/WebCoreSupport/WebChromeClient.mm
Tools/ChangeLog
Tools/DumpRenderTree/mac/AccessibilityCommonMac.mm
Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm
Tools/DumpRenderTree/mac/AccessibilityNotificationHandler.mm
Tools/DumpRenderTree/mac/AccessibilityTextMarkerMac.mm
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/mac/DumpRenderTreeDraggingInfo.mm
Tools/DumpRenderTree/mac/DumpRenderTreeWindow.mm
Tools/DumpRenderTree/mac/LayoutTestHelper.m
Tools/DumpRenderTree/mac/PolicyDelegate.mm
Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm
Tools/DumpRenderTree/mac/TestRunnerMac.mm
Tools/DumpRenderTree/mac/TextInputControllerMac.m
Tools/DumpRenderTree/mac/UIScriptControllerMac.mm
Tools/DumpRenderTree/mac/WorkQueueItemMac.mm
Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityControllerMac.mm
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityNotificationHandler.mm
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityTextMarkerMac.mm
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityTextMarkerRangeMac.mm
Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
Tools/WebKitTestRunner/mac/TestControllerMac.mm
Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm
Tools/WebKitTestRunner/mac/WebKitTestRunnerDraggingInfo.mm
Tools/WebKitTestRunner/mac/WebKitTestRunnerPasteboard.mm
Tools/WebKitTestRunner/mac/main.mm