[Cocoa] Update more code to be more ARC-compatible to prepare for future ARC adoption
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jun 2018 04:13:38 +0000 (04:13 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jun 2018 04:13:38 +0000 (04:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186245

Reviewed by Daniel Bates.

* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(convertToNSArray): Explicitly cast to WebAccessibilityObjectWrapperBase so we don't
make method calls on WebAccessibilityObjectWrapper, a forward-declared class.
(-[WebAccessibilityObjectWrapperBase convertPathToScreenSpace:]): Use CFAutorelease
for the CGPathRef return value instead of Objective-C autorelease. Another option
would be to use RetainPtr for the return type instead.

* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(AXObjectIsTextMarker): Use __bridge for bridging typecast.
(AXObjectIsTextMarkerRange): Ditto.
(AXTextMarkerRange): Ditto.
(AXTextMarkerRangeStart): Ditto.
(AXTextMarkerRangeEnd): Ditto.
(isTextMarkerIgnored): Ditto.
(accessibilityObjectForTextMarker): Ditto.
(-[WebAccessibilityObjectWrapper characterOffsetForTextMarker:]): Ditto.
(-[WebAccessibilityObjectWrapper visiblePositionForTextMarker:]): Ditto.
(visiblePositionForStartOfTextMarkerRange): Ditto.
(visiblePositionForEndOfTextMarkerRange): Ditto.
(AXAttributeStringSetFont): Ditto. Also use @{} syntax to make NSDictionary
and @() to make NSNumber.
(AXAttributeStringSetColor): Use __bridge for bridging typecast, rearranging
code so that the typecasts are on function arguments, not local variables,
which makes lifetimes clearer.
(AXAttributeStringSetElement): Use __bridge for bridging typecast.
(WebTransformCGPathToNSBezierPath):
(-[WebAccessibilityObjectWrapper bezierPathFromPath:]): Added a bridging
typecast when passing an NSBezierPath through as a void* context argument;
silent conversion to void* is not compatible with ARC.
(createAccessibilityRoleMap): Use __unsafe_unretained for a table of
NSString constants.

* bindings/js/ScriptControllerMac.mm:
(WebCore::ScriptController::createScriptInstanceForWidget): Use __bridge
for bridging typecast.

* bridge/objc/objc_class.mm:
(JSC::Bindings::ObjcClass::classForIsA): Added bridging typecasts
to convert a Class into a CFTypeRef.
(JSC::Bindings::ObjcClass::methodNamed const): Use __bridge for bridging
typecast.
(JSC::Bindings::ObjcClass::fieldNamed const): Ditto.
* bridge/objc/objc_instance.mm:
(ObjcInstance::invokeObjcMethod): Ditto.
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::ObjcField::valueFromInstance const): Ditto.
(JSC::Bindings::ObjcField::setValueToInstance const): Ditto.
* bridge/objc/objc_utility.mm:
(JSC::Bindings::convertObjcValueToValue): Ditto. Also add a missing const
to make it clearer to the compiler that the code is correct.
* crypto/mac/SerializedCryptoKeyWrapMac.mm:
(WebCore::createAndStoreMasterKey): Ditto.
(WebCore::findMasterKey): Ditto.
* editing/cocoa/DataDetection.mm:
(WebCore::detectItemAtPositionWithRange): Ditto.
* editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::fontAttributesForSelectionStart const): Ditto.
* editing/cocoa/HTMLConverter.mm:
(_font): Ditto.
(fileWrapperForElement): Ditto.
* fileapi/FileCocoa.mm:
(WebCore::File::shouldReplaceFile): Ditto.
* loader/archive/cf/LegacyWebArchiveMac.mm:
(WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Ditto.
* page/mac/TextIndicatorWindow.mm:
(-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]): Ditto.
(createContentCrossfadeAnimation): Ditto.
* platform/cocoa/LocalizedStringsCocoa.mm:
(WebCore::localizedString): Ditto.
* platform/cocoa/SharedBufferCocoa.mm:
(WebCore::SharedBuffer::create): Ditto.
(WebCore::SharedBuffer::append): Ditto.
* platform/graphics/FontPlatformData.h:
(WebCore::toCTFont): Ditto.
(WebCore::toNSFont): Ditto.
* platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
(WebCore::assetTrackMeetsHardwareDecodeRequirements): Ditto.
* platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
(WebCore::ImageDecoderAVFObjC::storeSampleBuffer): Ditto.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Ditto.
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage): Ditto.
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::MediaDescriptionAVFObjC::MediaDescriptionAVFObjC): Ditto.
(WebCore::bufferWasConsumedCallback): Ditto.
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Ditto.
* platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
(WebCore::VideoFullscreenLayerManagerObjC::updateVideoFullscreenInlineImage): Ditto.
(WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): Ditto.
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(PlatformCALayerCocoa::create): Ditto.
(PlatformCALayer::platformCALayer): Ditto.
(PlatformCALayerCocoa::superlayer const): Ditto.
(PlatformCALayerCocoa::contents const): Ditto.
(PlatformCALayerCocoa::setContents): Ditto.
* platform/graphics/cocoa/IOSurface.h: Ditto.
* platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
(TextTrackRepresentationCocoa::update): Ditto.
* platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample): Ditto.
(WebCore::WebCoreDecompressionSession::resetQosTier): Ditto.
* platform/graphics/cocoa/WebGLLayer.mm:
(-[WebGLLayer display]): Ditto.
* platform/graphics/mac/ImageMac.mm:
(WebCore::BitmapImage::nsImage): Ditto.
(WebCore::BitmapImage::snapshotNSImage): Ditto.
* platform/graphics/mac/WebLayer.mm:
(-[WebLayer drawInContext:]): Ditto.
(-[WebSimpleLayer setNeedsDisplay]): Ditto.
(-[WebSimpleLayer setNeedsDisplayInRect:]): Ditto.
(-[WebSimpleLayer display]): Ditto.
(-[WebSimpleLayer drawInContext:]): Ditto.

* platform/mac/CursorMac.mm:
(WebCore::cursor): Mark pointer __strong to match the globals it points to.

* platform/mac/FileSystemMac.mm:
(WebCore::FileSystem::setMetadataURL): Use RetainPtr instead of autorelease.

* platform/mac/PlatformPasteboardMac.mm:
(WebCore::PlatformPasteboard::bufferForType): Use __bridge for bridging
typecast.
* platform/mac/PlatformSpeechSynthesizerMac.mm:
(WebCore::speechSynthesisGetVoiceIdentifiers): Ditto.
(WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale): Ditto.

* platform/mac/PluginBlacklist.h: Use RetainPtr instead of explicit retain
and release for NSDictionary and NSSet.
* platform/mac/PluginBlacklist.mm:
(WebCore::PluginBlacklist::create): Use __bridge for bridging typecast.
(WebCore::PluginBlacklist::~PluginBlacklist): Remove explicit CFRelease calls.
(WebCore::PluginBlacklist::PluginBlacklist): Add adoptNS calls and remove
explciit CFRetain/release pairs.

* platform/mac/PublicSuffixMac.mm:
(WebCore::isPublicSuffix): Use __bridge for bridging typecast.
* platform/mac/RemoteCommandListenerMac.mm:
(WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac): Ditto.
* platform/mac/SerializedPlatformRepresentationMac.mm:
(WebCore::jsValueWithDictionaryInContext): Ditto.
* platform/mac/URLMac.mm:
(WebCore::URL::URL): Ditto.
(WebCore::URL::createCFURL const): Ditto.

* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::collectRangesThatNeedMapping): Mark pointer __strong to match the
local variable it eventually points to.
(WebCore::stringByTrimmingWhitespace): Use __bridge for bridging typecast.
(WebCore::URLByTruncatingOneCharacterBeforeComponent): Use
CFBridgingRelease instead of autorelease, reducing typecasts.
(WebCore::URLByRemovingComponentAndSubsequentCharacter): Ditto.
(WebCore::userVisibleString): Use __bridge for bridging typecast.
(WebCore::isUserVisibleURL): Ditto.

* platform/mac/WebGLBlacklist.mm:
(WebCore::WebGLBlacklist::create): Use __bridge for bridging typecast.
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setPreset): Ditto.
(WebCore::AVVideoCaptureSource::setupCaptureSession): Ditto. Also use @()
instead of NSNumber.
* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
(WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): Ditto.
* platform/network/cocoa/ResourceRequestCocoa.mm:
(WebCore::ResourceRequest::doUpdatePlatformHTTPBody): Ditto.

* platform/network/cocoa/ResourceResponseCocoa.mm: Use CFStringRef and
CFSTR for constant string array commonHeaderFields rather than using
NSString * and then relying on implicit bridging conversion.

* platform/network/mac/CertificateInfoMac.mm:
(WebCore::CertificateInfo::dump const): Use __bridge for bridging typecast.
* platform/network/mac/FormDataStreamMac.mm:
(WebCore::createHTTPBodyNSInputStream): Ditto.
(WebCore::httpBodyFromStream): Ditto.
* platform/network/mac/ResourceErrorMac.mm:
(WebCore::ResourceError::ResourceError): Ditto.
(WebCore::ResourceError::cfError const): Ditto.

* rendering/RenderThemeMac.mm:
(-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]):
Use CFSTR("") instead of @"" for a string that is passed to CFDIctionaryRef.
(WebCore::AttachmentLayout::layOutTitle): Use __bridge for bridging typecast.
(WebCore::AttachmentLayout::layOutSubtitle): Ditto.

* testing/cocoa/WebArchiveDumpSupport.mm:
(WebCoreTestSupport::createCFURLResponseFromResponseData): Use __bridge for
bridging typecast.
(WebCoreTestSupport::supportedNonImageMIMETypes): Deleted.
(WebCoreTestSupport::convertWebResourceDataToString): Use the
MIMETypeRegistry::isSupportedNonImageMIMEType function directly instead of
building a CFArray out of MIMETypeRegistry::getSupportedNonImageMIMETypes
and using CFArrayContainsValue. This is both much more direct and much more
efficient as well.

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

52 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
Source/WebCore/bindings/js/ScriptControllerMac.mm
Source/WebCore/bridge/objc/objc_class.mm
Source/WebCore/bridge/objc/objc_instance.mm
Source/WebCore/bridge/objc/objc_runtime.mm
Source/WebCore/bridge/objc/objc_utility.mm
Source/WebCore/crypto/mac/SerializedCryptoKeyWrapMac.mm
Source/WebCore/editing/cocoa/DataDetection.mm
Source/WebCore/editing/cocoa/EditorCocoa.mm
Source/WebCore/editing/cocoa/HTMLConverter.mm
Source/WebCore/fileapi/FileCocoa.mm
Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm
Source/WebCore/page/mac/TextIndicatorWindow.mm
Source/WebCore/platform/cocoa/LocalizedStringsCocoa.mm
Source/WebCore/platform/cocoa/SharedBufferCocoa.mm
Source/WebCore/platform/graphics/FontPlatformData.h
Source/WebCore/platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm
Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm
Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
Source/WebCore/platform/graphics/cocoa/IOSurface.h
Source/WebCore/platform/graphics/cocoa/TextTrackRepresentationCocoa.mm
Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm
Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm
Source/WebCore/platform/graphics/mac/ImageMac.mm
Source/WebCore/platform/graphics/mac/WebLayer.mm
Source/WebCore/platform/mac/CursorMac.mm
Source/WebCore/platform/mac/FileSystemMac.mm
Source/WebCore/platform/mac/PlatformPasteboardMac.mm
Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm
Source/WebCore/platform/mac/PluginBlacklist.h
Source/WebCore/platform/mac/PluginBlacklist.mm
Source/WebCore/platform/mac/PublicSuffixMac.mm
Source/WebCore/platform/mac/RemoteCommandListenerMac.mm
Source/WebCore/platform/mac/SerializedPlatformRepresentationMac.mm
Source/WebCore/platform/mac/URLMac.mm
Source/WebCore/platform/mac/WebCoreNSURLExtras.mm
Source/WebCore/platform/mac/WebGLBlacklist.mm
Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
Source/WebCore/platform/mediastream/mac/MockRealtimeVideoSourceMac.mm
Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm
Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm
Source/WebCore/platform/network/mac/CertificateInfoMac.mm
Source/WebCore/platform/network/mac/FormDataStreamMac.mm
Source/WebCore/platform/network/mac/ResourceErrorMac.mm
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/testing/cocoa/WebArchiveDumpSupport.mm

index ab142c5..8bd67f2 100644 (file)
@@ -1,3 +1,205 @@
+2018-06-03  Darin Adler  <darin@apple.com>
+
+        [Cocoa] Update more code to be more ARC-compatible to prepare for future ARC adoption
+        https://bugs.webkit.org/show_bug.cgi?id=186245
+
+        Reviewed by Daniel Bates.
+
+        * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
+        (convertToNSArray): Explicitly cast to WebAccessibilityObjectWrapperBase so we don't
+        make method calls on WebAccessibilityObjectWrapper, a forward-declared class.
+        (-[WebAccessibilityObjectWrapperBase convertPathToScreenSpace:]): Use CFAutorelease
+        for the CGPathRef return value instead of Objective-C autorelease. Another option
+        would be to use RetainPtr for the return type instead.
+
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (AXObjectIsTextMarker): Use __bridge for bridging typecast.
+        (AXObjectIsTextMarkerRange): Ditto.
+        (AXTextMarkerRange): Ditto.
+        (AXTextMarkerRangeStart): Ditto.
+        (AXTextMarkerRangeEnd): Ditto.
+        (isTextMarkerIgnored): Ditto.
+        (accessibilityObjectForTextMarker): Ditto.
+        (-[WebAccessibilityObjectWrapper characterOffsetForTextMarker:]): Ditto.
+        (-[WebAccessibilityObjectWrapper visiblePositionForTextMarker:]): Ditto.
+        (visiblePositionForStartOfTextMarkerRange): Ditto.
+        (visiblePositionForEndOfTextMarkerRange): Ditto.
+        (AXAttributeStringSetFont): Ditto. Also use @{} syntax to make NSDictionary
+        and @() to make NSNumber.
+        (AXAttributeStringSetColor): Use __bridge for bridging typecast, rearranging
+        code so that the typecasts are on function arguments, not local variables,
+        which makes lifetimes clearer.
+        (AXAttributeStringSetElement): Use __bridge for bridging typecast.
+        (WebTransformCGPathToNSBezierPath):
+        (-[WebAccessibilityObjectWrapper bezierPathFromPath:]): Added a bridging
+        typecast when passing an NSBezierPath through as a void* context argument;
+        silent conversion to void* is not compatible with ARC.
+        (createAccessibilityRoleMap): Use __unsafe_unretained for a table of
+        NSString constants.
+
+        * bindings/js/ScriptControllerMac.mm:
+        (WebCore::ScriptController::createScriptInstanceForWidget): Use __bridge
+        for bridging typecast.
+
+        * bridge/objc/objc_class.mm:
+        (JSC::Bindings::ObjcClass::classForIsA): Added bridging typecasts
+        to convert a Class into a CFTypeRef.
+        (JSC::Bindings::ObjcClass::methodNamed const): Use __bridge for bridging
+        typecast.
+        (JSC::Bindings::ObjcClass::fieldNamed const): Ditto.
+        * bridge/objc/objc_instance.mm:
+        (ObjcInstance::invokeObjcMethod): Ditto.
+        * bridge/objc/objc_runtime.mm:
+        (JSC::Bindings::ObjcField::valueFromInstance const): Ditto.
+        (JSC::Bindings::ObjcField::setValueToInstance const): Ditto.
+        * bridge/objc/objc_utility.mm:
+        (JSC::Bindings::convertObjcValueToValue): Ditto. Also add a missing const
+        to make it clearer to the compiler that the code is correct.
+        * crypto/mac/SerializedCryptoKeyWrapMac.mm:
+        (WebCore::createAndStoreMasterKey): Ditto.
+        (WebCore::findMasterKey): Ditto.
+        * editing/cocoa/DataDetection.mm:
+        (WebCore::detectItemAtPositionWithRange): Ditto.
+        * editing/cocoa/EditorCocoa.mm:
+        (WebCore::Editor::fontAttributesForSelectionStart const): Ditto.
+        * editing/cocoa/HTMLConverter.mm:
+        (_font): Ditto.
+        (fileWrapperForElement): Ditto.
+        * fileapi/FileCocoa.mm:
+        (WebCore::File::shouldReplaceFile): Ditto.
+        * loader/archive/cf/LegacyWebArchiveMac.mm:
+        (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Ditto.
+        * page/mac/TextIndicatorWindow.mm:
+        (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]): Ditto.
+        (createContentCrossfadeAnimation): Ditto.
+        * platform/cocoa/LocalizedStringsCocoa.mm:
+        (WebCore::localizedString): Ditto.
+        * platform/cocoa/SharedBufferCocoa.mm:
+        (WebCore::SharedBuffer::create): Ditto.
+        (WebCore::SharedBuffer::append): Ditto.
+        * platform/graphics/FontPlatformData.h:
+        (WebCore::toCTFont): Ditto.
+        (WebCore::toNSFont): Ditto.
+        * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
+        (WebCore::assetTrackMeetsHardwareDecodeRequirements): Ditto.
+        * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
+        (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): Ditto.
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage): Ditto.
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage): Ditto.
+        * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+        (WebCore::MediaDescriptionAVFObjC::MediaDescriptionAVFObjC): Ditto.
+        (WebCore::bufferWasConsumedCallback): Ditto.
+        (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Ditto.
+        * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
+        (WebCore::VideoFullscreenLayerManagerObjC::updateVideoFullscreenInlineImage): Ditto.
+        (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): Ditto.
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+        (PlatformCALayerCocoa::create): Ditto.
+        (PlatformCALayer::platformCALayer): Ditto.
+        (PlatformCALayerCocoa::superlayer const): Ditto.
+        (PlatformCALayerCocoa::contents const): Ditto.
+        (PlatformCALayerCocoa::setContents): Ditto.
+        * platform/graphics/cocoa/IOSurface.h: Ditto.
+        * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
+        (TextTrackRepresentationCocoa::update): Ditto.
+        * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
+        (WebCore::WebCoreDecompressionSession::ensureDecompressionSessionForSample): Ditto.
+        (WebCore::WebCoreDecompressionSession::resetQosTier): Ditto.
+        * platform/graphics/cocoa/WebGLLayer.mm:
+        (-[WebGLLayer display]): Ditto.
+        * platform/graphics/mac/ImageMac.mm:
+        (WebCore::BitmapImage::nsImage): Ditto.
+        (WebCore::BitmapImage::snapshotNSImage): Ditto.
+        * platform/graphics/mac/WebLayer.mm:
+        (-[WebLayer drawInContext:]): Ditto.
+        (-[WebSimpleLayer setNeedsDisplay]): Ditto.
+        (-[WebSimpleLayer setNeedsDisplayInRect:]): Ditto.
+        (-[WebSimpleLayer display]): Ditto.
+        (-[WebSimpleLayer drawInContext:]): Ditto.
+
+        * platform/mac/CursorMac.mm:
+        (WebCore::cursor): Mark pointer __strong to match the globals it points to.
+
+        * platform/mac/FileSystemMac.mm:
+        (WebCore::FileSystem::setMetadataURL): Use RetainPtr instead of autorelease.
+
+        * platform/mac/PlatformPasteboardMac.mm:
+        (WebCore::PlatformPasteboard::bufferForType): Use __bridge for bridging
+        typecast.
+        * platform/mac/PlatformSpeechSynthesizerMac.mm:
+        (WebCore::speechSynthesisGetVoiceIdentifiers): Ditto.
+        (WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale): Ditto.
+
+        * platform/mac/PluginBlacklist.h: Use RetainPtr instead of explicit retain
+        and release for NSDictionary and NSSet.
+        * platform/mac/PluginBlacklist.mm:
+        (WebCore::PluginBlacklist::create): Use __bridge for bridging typecast.
+        (WebCore::PluginBlacklist::~PluginBlacklist): Remove explicit CFRelease calls.
+        (WebCore::PluginBlacklist::PluginBlacklist): Add adoptNS calls and remove
+        explciit CFRetain/release pairs.
+
+        * platform/mac/PublicSuffixMac.mm:
+        (WebCore::isPublicSuffix): Use __bridge for bridging typecast.
+        * platform/mac/RemoteCommandListenerMac.mm:
+        (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac): Ditto.
+        * platform/mac/SerializedPlatformRepresentationMac.mm:
+        (WebCore::jsValueWithDictionaryInContext): Ditto.
+        * platform/mac/URLMac.mm:
+        (WebCore::URL::URL): Ditto.
+        (WebCore::URL::createCFURL const): Ditto.
+
+        * platform/mac/WebCoreNSURLExtras.mm:
+        (WebCore::collectRangesThatNeedMapping): Mark pointer __strong to match the
+        local variable it eventually points to.
+        (WebCore::stringByTrimmingWhitespace): Use __bridge for bridging typecast.
+        (WebCore::URLByTruncatingOneCharacterBeforeComponent): Use
+        CFBridgingRelease instead of autorelease, reducing typecasts.
+        (WebCore::URLByRemovingComponentAndSubsequentCharacter): Ditto.
+        (WebCore::userVisibleString): Use __bridge for bridging typecast.
+        (WebCore::isUserVisibleURL): Ditto.
+
+        * platform/mac/WebGLBlacklist.mm:
+        (WebCore::WebGLBlacklist::create): Use __bridge for bridging typecast.
+        * platform/mediastream/mac/AVVideoCaptureSource.mm:
+        (WebCore::AVVideoCaptureSource::setPreset): Ditto.
+        (WebCore::AVVideoCaptureSource::setupCaptureSession): Ditto. Also use @()
+        instead of NSNumber.
+        * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
+        (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): Ditto.
+        * platform/network/cocoa/ResourceRequestCocoa.mm:
+        (WebCore::ResourceRequest::doUpdatePlatformHTTPBody): Ditto.
+
+        * platform/network/cocoa/ResourceResponseCocoa.mm: Use CFStringRef and
+        CFSTR for constant string array commonHeaderFields rather than using
+        NSString * and then relying on implicit bridging conversion.
+
+        * platform/network/mac/CertificateInfoMac.mm:
+        (WebCore::CertificateInfo::dump const): Use __bridge for bridging typecast.
+        * platform/network/mac/FormDataStreamMac.mm:
+        (WebCore::createHTTPBodyNSInputStream): Ditto.
+        (WebCore::httpBodyFromStream): Ditto.
+        * platform/network/mac/ResourceErrorMac.mm:
+        (WebCore::ResourceError::ResourceError): Ditto.
+        (WebCore::ResourceError::cfError const): Ditto.
+
+        * rendering/RenderThemeMac.mm:
+        (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]):
+        Use CFSTR("") instead of @"" for a string that is passed to CFDIctionaryRef.
+        (WebCore::AttachmentLayout::layOutTitle): Use __bridge for bridging typecast.
+        (WebCore::AttachmentLayout::layOutSubtitle): Ditto.
+
+        * testing/cocoa/WebArchiveDumpSupport.mm:
+        (WebCoreTestSupport::createCFURLResponseFromResponseData): Use __bridge for
+        bridging typecast.
+        (WebCoreTestSupport::supportedNonImageMIMETypes): Deleted.
+        (WebCoreTestSupport::convertWebResourceDataToString): Use the
+        MIMETypeRegistry::isSupportedNonImageMIMEType function directly instead of
+        building a CFArray out of MIMETypeRegistry::getSupportedNonImageMIMETypes
+        and using CFArrayContainsValue. This is both much more direct and much more
+        efficient as well.
+
 2018-06-04  Timothy Hatcher  <timothy@apple.com>
 
         [Win] REGRESSION(r232486) 'WebCore::RenderTheme::activeListBoxSelectionBackgroundColor': function does not take 0 arguments
index 8b45f0d..d544d42 100644 (file)
@@ -245,16 +245,15 @@ static NSArray *convertMathPairsToNSArray(const AccessibilityObject::Accessibili
     return array;
 }
 
-
 NSArray *convertToNSArray(const AccessibilityObject::AccessibilityChildrenVector& vector)
 {
     NSMutableArray *array = [NSMutableArray arrayWithCapacity:vector.size()];
     for (const auto& child : vector) {
-        WebAccessibilityObjectWrapper* wrapper = child->wrapper();
+        auto wrapper = (WebAccessibilityObjectWrapperBase *)child->wrapper();
         ASSERT(wrapper);
         if (wrapper) {
-            // we want to return the attachment view instead of the object representing the attachment.
-            // otherwise, we get palindrome errors in the AX hierarchy
+            // We want to return the attachment view instead of the object representing the attachment,
+            // otherwise, we get palindrome errors in the AX hierarchy.
             if (child->isAttachment() && [wrapper attachmentView])
                 [array addObject:[wrapper attachmentView]];
             else
@@ -503,7 +502,8 @@ static void convertPathToScreenSpaceFunction(PathConversionInfo& conversion, con
     path.apply([&conversion](const PathElement& pathElement) {
         convertPathToScreenSpaceFunction(conversion, pathElement);
     });
-    return (CGPathRef)[(id)conversion.path autorelease];
+    CFAutorelease(conversion.path);
+    return conversion.path;
 }
 
 - (CGPoint)convertPointToScreenSpace:(FloatPoint &)point
index d1a2095..1e86237 100644 (file)
@@ -442,36 +442,36 @@ extern "C" AXUIElementRef NSAccessibilityCreateAXUIElementRef(id element);
 
 #pragma mark SystemInterface wrappers
 
-static inline BOOL AXObjectIsTextMarker(id obj)
+static inline BOOL AXObjectIsTextMarker(id object)
 {
-    return obj != nil && CFGetTypeID(obj) == AXTextMarkerGetTypeID();
+    return object && CFGetTypeID((__bridge CFTypeRef)object) == AXTextMarkerGetTypeID();
 }
 
-static inline BOOL AXObjectIsTextMarkerRange(id obj)
+static inline BOOL AXObjectIsTextMarkerRange(id object)
 {
-    return obj != nil && CFGetTypeID(obj) == AXTextMarkerRangeGetTypeID();
+    return object && CFGetTypeID((__bridge CFTypeRef)object) == AXTextMarkerRangeGetTypeID();
 }
 
 static id AXTextMarkerRange(id startMarker, id endMarker)
 {
     ASSERT(startMarker != nil);
     ASSERT(endMarker != nil);
-    ASSERT(CFGetTypeID(startMarker) == AXTextMarkerGetTypeID());
-    ASSERT(CFGetTypeID(endMarker) == AXTextMarkerGetTypeID());
+    ASSERT(CFGetTypeID((__bridge CFTypeRef)startMarker) == AXTextMarkerGetTypeID());
+    ASSERT(CFGetTypeID((__bridge CFTypeRef)endMarker) == AXTextMarkerGetTypeID());
     return CFBridgingRelease(AXTextMarkerRangeCreate(kCFAllocatorDefault, (AXTextMarkerRef)startMarker, (AXTextMarkerRef)endMarker));
 }
 
 static id AXTextMarkerRangeStart(id range)
 {
     ASSERT(range != nil);
-    ASSERT(CFGetTypeID(range) == AXTextMarkerRangeGetTypeID());
+    ASSERT(CFGetTypeID((__bridge CFTypeRef)range) == AXTextMarkerRangeGetTypeID());
     return CFBridgingRelease(AXTextMarkerRangeCopyStartMarker((AXTextMarkerRangeRef)range));
 }
 
 static id AXTextMarkerRangeEnd(id range)
 {
     ASSERT(range != nil);
-    ASSERT(CFGetTypeID(range) == AXTextMarkerRangeGetTypeID());
+    ASSERT(CFGetTypeID((__bridge CFTypeRef)range) == AXTextMarkerRangeGetTypeID());
     return CFBridgingRelease(AXTextMarkerRangeCopyEndMarker((AXTextMarkerRangeRef)range));
 }
 
@@ -565,7 +565,7 @@ static bool isTextMarkerIgnored(id textMarker)
         return false;
     
     TextMarkerData textMarkerData;
-    if (!getBytesFromAXTextMarker(textMarker, &textMarkerData, sizeof(textMarkerData)))
+    if (!getBytesFromAXTextMarker((__bridge CFTypeRef)textMarker, &textMarkerData, sizeof(textMarkerData)))
         return false;
     
     return textMarkerData.ignored;
@@ -582,7 +582,7 @@ static AccessibilityObject* accessibilityObjectForTextMarker(AXObjectCache* cach
         return nullptr;
     
     TextMarkerData textMarkerData;
-    if (!getBytesFromAXTextMarker(textMarker, &textMarkerData, sizeof(textMarkerData)))
+    if (!getBytesFromAXTextMarker((__bridge CFTypeRef)textMarker, &textMarkerData, sizeof(textMarkerData)))
         return nullptr;
     return cache->accessibilityObjectForTextMarkerData(textMarkerData);
 }
@@ -703,7 +703,7 @@ static CharacterOffset characterOffsetForTextMarker(AXObjectCache* cache, CFType
 
 - (CharacterOffset)characterOffsetForTextMarker:(id)textMarker
 {
-    return characterOffsetForTextMarker(m_object->axObjectCache(), textMarker);
+    return characterOffsetForTextMarker(m_object->axObjectCache(), (__bridge CFTypeRef)textMarker);
 }
 
 static id textMarkerForVisiblePosition(AXObjectCache* cache, const VisiblePosition& visiblePos)
@@ -750,17 +750,17 @@ static VisiblePosition visiblePositionForTextMarker(AXObjectCache* cache, CFType
 
 - (VisiblePosition)visiblePositionForTextMarker:(id)textMarker
 {
-    return visiblePositionForTextMarker(m_object->axObjectCache(), textMarker);
+    return visiblePositionForTextMarker(m_object->axObjectCache(), (__bridge CFTypeRef)textMarker);
 }
 
 static VisiblePosition visiblePositionForStartOfTextMarkerRange(AXObjectCache* cache, id textMarkerRange)
 {
-    return visiblePositionForTextMarker(cache, AXTextMarkerRangeStart(textMarkerRange));
+    return visiblePositionForTextMarker(cache, (__bridge CFTypeRef)AXTextMarkerRangeStart(textMarkerRange));
 }
 
 static VisiblePosition visiblePositionForEndOfTextMarkerRange(AXObjectCache* cache, id textMarkerRange)
 {
-    return visiblePositionForTextMarker(cache, AXTextMarkerRangeEnd(textMarkerRange));
+    return visiblePositionForTextMarker(cache, (__bridge CFTypeRef)AXTextMarkerRangeEnd(textMarkerRange));
 }
 
 static id textMarkerRangeFromMarkers(id textMarker1, id textMarker2)
@@ -784,14 +784,13 @@ static void AXAttributeStringSetFont(NSMutableAttributedString *attrString, NSSt
         return;
 
     if (font) {
-        NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
-            static_cast<NSString *>(adoptCF(CTFontCopyPostScriptName(font)).get()), NSAccessibilityFontNameKey,
-            static_cast<NSString *>(adoptCF(CTFontCopyFamilyName(font)).get()), NSAccessibilityFontFamilyKey,
-            static_cast<NSString *>(adoptCF(CTFontCopyDisplayName(font)).get()), NSAccessibilityVisibleNameKey,
-            [NSNumber numberWithFloat:CTFontGetSize(font)], NSAccessibilityFontSizeKey,
-            nil];
-        
-        [attrString addAttribute:attribute value:dict range:range];
+        NSDictionary *dictionary = @{
+            NSAccessibilityFontNameKey: (__bridge NSString *)adoptCF(CTFontCopyPostScriptName(font)).get(),
+            NSAccessibilityFontFamilyKey: (__bridge NSString *)adoptCF(CTFontCopyFamilyName(font)).get(),
+            NSAccessibilityVisibleNameKey: (__bridge NSString *)adoptCF(CTFontCopyDisplayName(font)).get(),
+            NSAccessibilityFontSizeKey: @(CTFontGetSize(font)),
+        };
+        [attrString addAttribute:attribute value:dictionary range:range];
     } else
         [attrString removeAttribute:attribute range:range];
     
@@ -804,9 +803,9 @@ static void AXAttributeStringSetColor(NSMutableAttributedString* attrString, NSS
 
     if (color) {
         CGColorRef cgColor = color.CGColor;
-        CGColorRef existingColor = (CGColorRef)[attrString attribute:attribute atIndex:range.location effectiveRange:nil];
-        if (!existingColor || !CGColorEqualToColor(existingColor, cgColor))
-            [attrString addAttribute:attribute value:(id)cgColor range:range];
+        id existingColor = [attrString attribute:attribute atIndex:range.location effectiveRange:nil];
+        if (!existingColor || !CGColorEqualToColor((__bridge CGColorRef)existingColor, cgColor))
+            [attrString addAttribute:attribute value:(__bridge id)cgColor range:range];
     } else
         [attrString removeAttribute:attribute range:range];
 }
@@ -997,7 +996,7 @@ static void AXAttributeStringSetElement(NSMutableAttributedString* attrString, N
         
         AXUIElementRef axElement = NSAccessibilityCreateAXUIElementRef(objectWrapper);
         if (axElement) {
-            [attrString addAttribute:attribute value:(id)axElement range:range];
+            [attrString addAttribute:attribute value:(__bridge id)axElement range:range];
             CFRelease(axElement);
         }
     } else
@@ -1789,9 +1788,9 @@ static NSMutableArray *convertStringsToNSArray(const Vector<String>& vector)
     }
 }
 
-static void WebTransformCGPathToNSBezierPath(void *info, const CGPathElement *element)
+static void WebTransformCGPathToNSBezierPath(voidinfo, const CGPathElement *element)
 {
-    NSBezierPath *bezierPath = (NSBezierPath *)info;
+    NSBezierPath *bezierPath = (__bridge NSBezierPath *)info;
     switch (element->type) {
     case kCGPathElementMoveToPoint:
         [bezierPath moveToPoint:NSPointFromCGPoint(element->points[0])];
@@ -1813,7 +1812,7 @@ static void WebTransformCGPathToNSBezierPath(void *info, const CGPathElement *el
 - (NSBezierPath *)bezierPathFromPath:(CGPathRef)path
 {
     NSBezierPath *bezierPath = [NSBezierPath bezierPath];
-    CGPathApply(path, bezierPath, WebTransformCGPathToNSBezierPath);
+    CGPathApply(path, (__bridge void*)bezierPath, WebTransformCGPathToNSBezierPath);
     return bezierPath;
 }
 
@@ -1851,7 +1850,7 @@ static const AccessibilityRoleMap& createAccessibilityRoleMap()
 {
     struct RoleEntry {
         AccessibilityRole value;
-        NSString* string;
+        __unsafe_unretained NSString *string;
     };
     
     static const RoleEntry roles[] = {
index de7938e..ca4f871 100644 (file)
@@ -66,7 +66,7 @@ RefPtr<JSC::Bindings::Instance> ScriptController::createScriptInstanceForWidget(
     if (!widgetView)
         return nullptr;
 
-    auto rootObject = createRootObject(widgetView);
+    auto rootObject = createRootObject((__bridge void*)widgetView);
 
     if ([widgetView respondsToSelector:@selector(createPluginBindingsInstance:)])
         return [widgetView createPluginBindingsInstance:WTFMove(rootObject)];
index 4ee4650..ca4a6c2 100644 (file)
@@ -50,10 +50,10 @@ ObjcClass* ObjcClass::classForIsA(ClassStructPtr isa)
 {
     _createClassesByIsAIfNecessary();
 
-    ObjcClass* aClass = reinterpret_cast<ObjcClass*>(const_cast<void*>(CFDictionaryGetValue(classesByIsA, isa)));
+    auto aClass = reinterpret_cast<ObjcClass*>(const_cast<void*>(CFDictionaryGetValue(classesByIsA, (__bridge CFTypeRef)isa)));
     if (!aClass) {
         aClass = new ObjcClass(isa);
-        CFDictionaryAddValue(classesByIsA, isa, aClass);
+        CFDictionaryAddValue(classesByIsA, (__bridge CFTypeRef)isa, aClass);
     }
 
     return aClass;
@@ -133,7 +133,7 @@ Method* ObjcClass::methodNamed(PropertyName propertyName, Instance*) const
             if ([thisClass respondsToSelector:@selector(webScriptNameForSelector:)])
                 mappedName = [thisClass webScriptNameForSelector:objcMethodSelector];
 
-            if ((mappedName && [mappedName isEqual:(NSString*)methodName.get()]) || strcmp(objcMethodSelectorName, buffer.data()) == 0) {
+            if ((mappedName && [mappedName isEqual:(__bridge NSString*)methodName.get()]) || !strcmp(objcMethodSelectorName, buffer.data())) {
                 auto method = std::make_unique<ObjcMethod>(thisClass, objcMethodSelector);
                 methodPtr = method.get();
                 m_methodCache.add(name.impl(), WTFMove(method));
@@ -189,8 +189,8 @@ Field* ObjcClass::fieldNamed(PropertyName propertyName, Instance* instance) cons
             if ([thisClass respondsToSelector:@selector(webScriptNameForKey:)])
                 mappedName = [thisClass webScriptNameForKey:UTF8KeyName];
 
-            if ((mappedName && [mappedName isEqual:(NSString*)fieldName.get()]) || [keyName isEqual:(NSString*)fieldName.get()]) {
-                auto newField = std::make_unique<ObjcField>((CFStringRef)keyName);
+            if ((mappedName && [mappedName isEqual:(__bridge NSString *)fieldName.get()]) || [keyName isEqual:(__bridge NSString *)fieldName.get()]) {
+                auto newField = std::make_unique<ObjcField>((__bridge CFStringRef)keyName);
                 field = newField.get();
                 m_fieldCache.add(name.impl(), WTFMove(newField));
                 break;
@@ -220,7 +220,7 @@ Field* ObjcClass::fieldNamed(PropertyName propertyName, Instance* instance) cons
                 if ([thisClass respondsToSelector:@selector(webScriptNameForKey:)])
                     mappedName = [thisClass webScriptNameForKey:objcIvarName];
 
-                if ((mappedName && [mappedName isEqual:(NSString*)fieldName.get()]) || strcmp(objcIvarName, jsName.data()) == 0) {
+                if ((mappedName && [mappedName isEqual:(__bridge NSString *)fieldName.get()]) || !strcmp(objcIvarName, jsName.data())) {
                     auto newField = std::make_unique<ObjcField>(objcIVar);
                     field = newField.get();
                     m_fieldCache.add(name.impl(), WTFMove(newField));
index d8fab76..68e5731 100644 (file)
@@ -241,7 +241,7 @@ JSC::JSValue ObjcInstance::invokeObjcMethod(ExecState* exec, ObjcMethod* method)
 
         // Invoke invokeUndefinedMethodFromWebScript:withArguments:, pass JavaScript function
         // name as first (actually at 2) argument and array of args as second.
-        NSString* jsName = (NSString* )method->javaScriptName();
+        NSString* jsName = (__bridge NSString *)method->javaScriptName();
         [invocation setArgument:&jsName atIndex:2];
 
         NSMutableArray* objcArgs = [NSMutableArray array];
index 163c1da..87d0387 100644 (file)
@@ -104,7 +104,7 @@ JSValue ObjcField::valueFromInstance(ExecState* exec, const Instance* instance)
     JSLock::DropAllLocks dropAllLocks(exec); // Can't put this inside the @try scope because it unwinds incorrectly.
 
     @try {
-        if (id objcValue = [targetObject valueForKey:(NSString *)_name.get()])
+        if (id objcValue = [targetObject valueForKey:(__bridge NSString *)_name.get()])
             result = convertObjcValueToValue(exec, &objcValue, ObjcObjectType, instance->rootObject());
         {
             JSLockHolder lock(exec);
@@ -139,7 +139,7 @@ bool ObjcField::setValueToInstance(ExecState* exec, const Instance* instance, JS
     JSLock::DropAllLocks dropAllLocks(exec); // Can't put this inside the @try scope because it unwinds incorrectly.
 
     @try {
-        [targetObject setValue:value forKey:(NSString *)_name.get()];
+        [targetObject setValue:value forKey:(__bridge NSString *)_name.get()];
         {
             JSLockHolder lock(exec);
             ObjcInstance::moveGlobalExceptionToExecState(exec);
index 7c5d799..12d052d 100644 (file)
@@ -180,14 +180,14 @@ JSValue convertObjcValueToValue(ExecState* exec, void* buffer, ObjcValueType typ
     
     switch (type) {
         case ObjcObjectType: {
-            id obj = *(id*)buffer;
+            id obj = *(const id*)buffer;
             if ([obj isKindOfClass:[NSString class]])
                 return convertNSStringToString(exec, (NSString *)obj);
             if ([obj isKindOfClass:webUndefinedClass()])
                 return jsUndefined();
-            if ((CFBooleanRef)obj == kCFBooleanTrue)
+            if ((__bridge CFBooleanRef)obj == kCFBooleanTrue)
                 return jsBoolean(true);
-            if ((CFBooleanRef)obj == kCFBooleanFalse)
+            if ((__bridge CFBooleanRef)obj == kCFBooleanFalse)
                 return jsBoolean(false);
             if ([obj isKindOfClass:[NSNumber class]])
                 return jsNumber([obj doubleValue]);
index 17caee3..a517f92 100644 (file)
@@ -103,7 +103,7 @@ static bool createAndStoreMasterKey(Vector<uint8_t>& masterKeyData)
 
 #if USE(KEYCHAIN_ACCESS_CONTROL_LISTS)
     SecAccessRef accessRef;
-    status = SecAccessCreate((CFStringRef)localizedItemName, nullptr, &accessRef);
+    status = SecAccessCreate((__bridge CFStringRef)localizedItemName, nullptr, &accessRef);
     if (status) {
         WTFLogAlways("Cannot create a security access object for storing WebCrypto master key, error %d", (int)status);
         return false;
@@ -121,7 +121,7 @@ static bool createAndStoreMasterKey(Vector<uint8_t>& masterKeyData)
     }
     RetainPtr<SecTrustedApplicationRef> trustedApp = adoptCF(trustedAppRef);
 
-    status = SecACLSetContents(acl, (CFArrayRef)@[ (id)trustedApp.get() ], (CFStringRef)localizedItemName, kSecKeychainPromptRequirePassphase);
+    status = SecACLSetContents(acl, (__bridge CFArrayRef)@[ (__bridge id)trustedApp.get() ], (__bridge CFStringRef)localizedItemName, kSecKeychainPromptRequirePassphase);
     if (status) {
         WTFLogAlways("Cannot set ACL for WebCrypto master key, error %d", (int)status);
         return false;
@@ -136,7 +136,7 @@ static bool createAndStoreMasterKey(Vector<uint8_t>& masterKeyData)
         (id)kSecClass : (id)kSecClassGenericPassword,
         (id)kSecAttrSynchronizable : @NO,
 #if USE(KEYCHAIN_ACCESS_CONTROL_LISTS)
-        (id)kSecAttrAccess : (id)access.get(),
+        (id)kSecAttrAccess : (__bridge id)access.get(),
 #endif
         (id)kSecAttrComment : webCryptoMasterKeyKeychainComment(),
         (id)kSecAttrLabel : localizedItemName,
@@ -171,7 +171,7 @@ static bool findMasterKey(Vector<uint8_t>& masterKeyData)
     }
     RetainPtr<CFDataRef> keyData = adoptCF(keyDataRef);
 
-    Vector<uint8_t> base64EncodedMasterKeyData = vectorFromNSData((NSData *)keyData.get());
+    Vector<uint8_t> base64EncodedMasterKeyData = vectorFromNSData((__bridge NSData *)keyData.get());
     return base64Decode((const char*)base64EncodedMasterKeyData.data(), base64EncodedMasterKeyData.size(), masterKeyData);
 }
 
index ad4955b..4e87535 100644 (file)
@@ -103,7 +103,7 @@ static RetainPtr<DDActionContext> detectItemAtPositionWithRange(VisiblePosition
         return nullptr;
 
     RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]);
-    [actionContext setAllResults:@[ (id)mainResult ]];
+    [actionContext setAllResults:@[ (__bridge id)mainResult ]];
     [actionContext setMainResult:mainResult];
 
     Vector<FloatQuad> quads;
index 31d7b2e..063d723 100644 (file)
@@ -89,7 +89,7 @@ RetainPtr<NSDictionary> Editor::fontAttributesForSelectionStart() const
     RetainPtr<NSMutableDictionary> attributes = adoptNS([[NSMutableDictionary alloc] init]);
 
     if (auto ctFont = style->fontCascade().primaryFont().getCTFont())
-        [attributes setObject:(id)ctFont forKey:NSFontAttributeName];
+        [attributes setObject:(__bridge id)ctFont forKey:NSFontAttributeName];
 
     // FIXME: Why would we not want to retrieve these attributes on iOS?
 #if PLATFORM(MAC)
index 9f3efa0..2144652 100644 (file)
@@ -1031,7 +1031,7 @@ static PlatformFont *_font(Element& element)
     auto* renderer = element.renderer();
     if (!renderer)
         return nil;
-    return (PlatformFont *)renderer->style().fontCascade().primaryFont().getCTFont();
+    return (__bridge PlatformFont *)renderer->style().fontCascade().primaryFont().getCTFont();
 }
 
 #define UIFloatIsZero(number) (fabs(number - 0) < FLT_EPSILON)
@@ -2447,7 +2447,7 @@ static RetainPtr<NSFileWrapper> fileWrapperForElement(HTMLImageElement& element)
     if (is<RenderImage>(renderer)) {
         auto* image = downcast<RenderImage>(*renderer).cachedImage();
         if (image && !image->errorOccurred()) {
-            RetainPtr<NSFileWrapper> wrapper = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:(NSData *)image->imageForRenderer(renderer)->tiffRepresentation()]);
+            RetainPtr<NSFileWrapper> wrapper = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:(__bridge NSData *)image->imageForRenderer(renderer)->tiffRepresentation()]);
             [wrapper setPreferredFilename:@"image.tiff"];
             return wrapper;
         }
index caa21d5..44cccb8 100644 (file)
@@ -54,7 +54,7 @@ bool File::shouldReplaceFile(const String& path)
         return false;
     }
 
-    return UTTypeConformsTo((CFStringRef)uti, kUTTypePackage);
+    return UTTypeConformsTo((__bridge CFStringRef)uti, kUTTypePackage);
 }
 
 void File::computeNameAndContentTypeForReplacedFile(const String& path, const String& nameOverride, String& effectiveName, String& effectiveContentType)
index 7b0525a..2d5b29c 100644 (file)
@@ -45,7 +45,7 @@ ResourceResponse LegacyWebArchive::createResourceResponseFromMacArchivedData(CFD
     
     NSURLResponse *response = nil;
 #if USE(SECURE_ARCHIVER_API)
-    auto unarchiver = secureUnarchiverFromData((NSData *)responseData);
+    auto unarchiver = secureUnarchiverFromData((__bridge NSData *)responseData);
     @try {
         response = [unarchiver decodeObjectOfClass:[NSURLResponse class] forKey:LegacyWebArchiveResourceResponseKey];
 #else
index cd1a56e..2bb2761 100644 (file)
@@ -228,7 +228,7 @@ static bool indicatorWantsManualAnimation(const TextIndicator& indicator)
         [textLayer setBorderColor:borderColor.get()];
         [textLayer setBorderWidth:borderWidth];
         [textLayer setDelegate:[WebActionDisablingCALayerDelegate shared]];
-        [textLayer setContents:(id)contentsImage.get()];
+        [textLayer setContents:(__bridge id)contentsImage.get()];
 
         RetainPtr<CAShapeLayer> maskLayer = adoptNS([[CAShapeLayer alloc] init]);
         [maskLayer setPath:translatedPath.platformPath()];
@@ -266,7 +266,7 @@ static RetainPtr<CABasicAnimation> createContentCrossfadeAnimation(CFTimeInterva
 {
     RetainPtr<CABasicAnimation> crossfadeAnimation = [CABasicAnimation animationWithKeyPath:@"contents"];
     RetainPtr<CGImageRef> contentsImage = textIndicator.contentImage()->nativeImage();
-    [crossfadeAnimation setToValue:(id)contentsImage.get()];
+    [crossfadeAnimation setToValue:(__bridge id)contentsImage.get()];
     [crossfadeAnimation setFillMode:kCAFillModeForwards];
     [crossfadeAnimation setRemovedOnCompletion:NO];
     [crossfadeAnimation setDuration:duration];
index a36b8fb..2c8323b 100644 (file)
@@ -50,7 +50,7 @@ NSString *localizedNSString(NSString *key)
 String localizedString(const char* key)
 {
     RetainPtr<CFStringRef> keyString = adoptCF(CFStringCreateWithCStringNoCopy(0, key, kCFStringEncodingUTF8, kCFAllocatorNull));
-    return localizedNSString((NSString *)keyString.get());
+    return localizedNSString((__bridge NSString *)keyString.get());
 }
 
 String copyImageUnknownFileLabel()
index 594d110..c9694d2 100644 (file)
@@ -85,12 +85,12 @@ namespace WebCore {
 
 Ref<SharedBuffer> SharedBuffer::create(NSData *nsData)
 {
-    return adoptRef(*new SharedBuffer((CFDataRef)nsData));
+    return adoptRef(*new SharedBuffer((__bridge CFDataRef)nsData));
 }
 
 void SharedBuffer::append(NSData *nsData)
 {
-    return append((CFDataRef)nsData);
+    return append((__bridge CFDataRef)nsData);
 }
 
 RetainPtr<NSData> SharedBuffer::createNSData() const
index c37654a..11dd54c 100644 (file)
@@ -278,12 +278,12 @@ private:
 // NSFonts and CTFontRefs are toll-free-bridged.
 inline CTFontRef toCTFont(NSFont *font)
 {
-    return (CTFontRef)font;
+    return (__bridge CTFontRef)font;
 }
 
 inline NSFont *toNSFont(CTFontRef font)
 {
-    return (NSFont *)font;
+    return (__bridge NSFont *)font;
 }
 
 #endif
index 4ddfb9c..e82f8a8 100644 (file)
@@ -108,7 +108,7 @@ bool assetTrackMeetsHardwareDecodeRequirements(AVAssetTrack *track, const Vector
 {
     Vector<FourCC> codecs;
     for (NSUInteger i = 0, count = track.formatDescriptions.count; i < count; ++i) {
-        CMFormatDescriptionRef description = (CMFormatDescriptionRef)track.formatDescriptions[i];
+        CMFormatDescriptionRef description = (__bridge CMFormatDescriptionRef)track.formatDescriptions[i];
         if (PAL::CMFormatDescriptionGetMediaType(description) == kCMMediaType_Video)
             codecs.append(FourCC(PAL::CMFormatDescriptionGetMediaSubType(description)));
     }
index 53bb050..b3b6bb5 100644 (file)
@@ -440,14 +440,14 @@ bool ImageDecoderAVFObjC::storeSampleBuffer(CMSampleBufferRef sampleBuffer)
         }
 
         if (!m_rotationPool) {
-            auto pixelAttributes = (CFDictionaryRef)@{
-                (NSString *)kCVPixelBufferWidthKey: @(m_size.value().width()),
-                (NSString *)kCVPixelBufferHeightKey: @(m_size.value().height()),
-                (NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA),
-                (NSString *)kCVPixelBufferCGImageCompatibilityKey: @YES,
+            auto pixelAttributes = @{
+                (__bridge NSString *)kCVPixelBufferWidthKey: @(m_size.value().width()),
+                (__bridge NSString *)kCVPixelBufferHeightKey: @(m_size.value().height()),
+                (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA),
+                (__bridge NSString *)kCVPixelBufferCGImageCompatibilityKey: @YES,
             };
             CVPixelBufferPoolRef rawPool = nullptr;
-            CVPixelBufferPoolCreate(kCFAllocatorDefault, nullptr, pixelAttributes, &rawPool);
+            CVPixelBufferPoolCreate(kCFAllocatorDefault, nullptr, (__bridge CFDictionaryRef)pixelAttributes, &rawPool);
             m_rotationPool = adoptCF(rawPool);
         }
 
index b9d725d..b8a3395 100644 (file)
@@ -559,8 +559,8 @@ bool MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage()
     ASSERT(m_lastPixelBuffer);
 
     if (!m_rgbConformer) {
-        NSDictionary *attributes = @{ (NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA) };
-        m_rgbConformer = std::make_unique<PixelBufferConformerCV>((CFDictionaryRef)attributes);
+        auto attributes = @{ (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA) };
+        m_rgbConformer = std::make_unique<PixelBufferConformerCV>((__bridge CFDictionaryRef)attributes);
     }
 
     m_lastImage = m_rgbConformer->createImageFromPixelBuffer(m_lastPixelBuffer.get());
index 9d12ce6..7f7d03f 100644 (file)
@@ -1056,7 +1056,7 @@ void MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage()
         return;
 
     if (!m_imagePainter.pixelBufferConformer)
-        m_imagePainter.pixelBufferConformer = std::make_unique<PixelBufferConformerCV>((CFDictionaryRef)@{ (NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA) });
+        m_imagePainter.pixelBufferConformer = std::make_unique<PixelBufferConformerCV>((__bridge CFDictionaryRef)@{ (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA) });
 
     ASSERT(m_imagePainter.pixelBufferConformer);
     if (!m_imagePainter.pixelBufferConformer)
@@ -1178,7 +1178,6 @@ WTFLogChannel& MediaPlayerPrivateMediaStreamAVFObjC::logChannel() const
 }
 #endif
 
-
 }
 
 #endif
index 54cfb8e..5416018 100644 (file)
@@ -457,7 +457,7 @@ protected:
         , m_isText([track hasMediaCharacteristic:AVMediaCharacteristicLegible])
     {
         NSArray* formatDescriptions = [track formatDescriptions];
-        CMFormatDescriptionRef description = [formatDescriptions count] ? (CMFormatDescriptionRef)[formatDescriptions objectAtIndex:0] : 0;
+        CMFormatDescriptionRef description = [formatDescriptions count] ? (__bridge CMFormatDescriptionRef)[formatDescriptions objectAtIndex:0] : 0;
         if (description) {
             FourCharCode codec = CMFormatDescriptionGetMediaSubType(description);
             m_codec = AtomicString(reinterpret_cast<LChar*>(&codec), 4);
@@ -488,7 +488,7 @@ static void bufferWasConsumedCallback(CMNotificationCenterRef, const void*, CFSt
         return;
 
     ASSERT(CFGetTypeID(payload) == CFDictionaryGetTypeID());
-    auto context = (WebBufferConsumedContext *)[(NSDictionary *)payload valueForKey:kBufferConsumedContext];
+    WebBufferConsumedContext *context = [(__bridge NSDictionary *)payload valueForKey:kBufferConsumedContext];
     if (!context)
         return;
 
@@ -1099,7 +1099,7 @@ void SourceBufferPrivateAVFObjC::enqueueSample(Ref<MediaSample>&& sample, const
                 CMSampleBufferRef rawSampleCopy;
                 CMSampleBufferCreateCopy(kCFAllocatorDefault, platformSample.sample.cmSampleBuffer, &rawSampleCopy);
                 auto sampleCopy = adoptCF(rawSampleCopy);
-                CMSetAttachment(sampleCopy.get(), kCMSampleBufferAttachmentKey_PostNotificationWhenConsumed, @{kBufferConsumedContext: context.get()}, kCMAttachmentMode_ShouldNotPropagate);
+                CMSetAttachment(sampleCopy.get(), kCMSampleBufferAttachmentKey_PostNotificationWhenConsumed, (__bridge CFDictionaryRef)@{kBufferConsumedContext: context.get()}, kCMAttachmentMode_ShouldNotPropagate);
                 [m_displayLayer enqueueSampleBuffer:sampleCopy.get()];
             } else
                 [m_displayLayer enqueueSampleBuffer:platformSample.sample.cmSampleBuffer];
index 1f71d43..cc05b2a 100644 (file)
@@ -89,7 +89,7 @@ void VideoFullscreenLayerManagerObjC::setVideoLayer(PlatformLayer *videoLayer, I
 void VideoFullscreenLayerManagerObjC::updateVideoFullscreenInlineImage(NativeImagePtr image)
 {
     if (m_videoInlineLayer)
-        [m_videoInlineLayer setContents:(id)image.get()];
+        [m_videoInlineLayer setContents:(__bridge id)image.get()];
 }
 
 void VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer(PlatformLayer *videoFullscreenLayer, WTF::Function<void()>&& completionHandler, NativeImagePtr currentImage)
@@ -108,7 +108,7 @@ void VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer(PlatformLayer *vid
         CAContext *oldContext = [m_videoLayer context];
 
         if (m_videoInlineLayer)
-            [m_videoInlineLayer setContents:(id)currentImage.get()];
+            [m_videoInlineLayer setContents:(__bridge id)currentImage.get()];
 
         if (m_videoFullscreenLayer) {
             [m_videoFullscreenLayer insertSublayer:m_videoLayer.get() atIndex:0];
index 25cf28a..ca1c45f 100644 (file)
@@ -75,7 +75,7 @@ Ref<PlatformCALayer> PlatformCALayerCocoa::create(LayerType layerType, PlatformC
 
 Ref<PlatformCALayer> PlatformCALayerCocoa::create(void* platformLayer, PlatformCALayerClient* owner)
 {
-    return adoptRef(*new PlatformCALayerCocoa(static_cast<PlatformLayer*>(platformLayer), owner));
+    return adoptRef(*new PlatformCALayerCocoa((__bridge CALayer *)platformLayer, owner));
 }
 
 static NSString * const platformCALayerPointer = @"WKPlatformCALayer";
@@ -87,7 +87,7 @@ PlatformCALayer* PlatformCALayer::platformCALayer(void* platformLayer)
     // Pointer to PlatformCALayer is kept in a key of the CALayer
     PlatformCALayer* platformCALayer = nil;
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    platformCALayer = static_cast<PlatformCALayer*>([[static_cast<CALayer*>(platformLayer) valueForKey:platformCALayerPointer] pointerValue]);
+    platformCALayer = static_cast<PlatformCALayer*>([[(__bridge CALayer *)platformLayer valueForKey:platformCALayerPointer] pointerValue]);
     END_BLOCK_OBJC_EXCEPTIONS
     return platformCALayer;
 }
@@ -416,7 +416,7 @@ void PlatformCALayerCocoa::copyContentsFromLayer(PlatformCALayer* layer)
 
 PlatformCALayer* PlatformCALayerCocoa::superlayer() const
 {
-    return platformCALayer([m_layer superlayer]);
+    return platformCALayer((__bridge void*)[m_layer superlayer]);
 }
 
 void PlatformCALayerCocoa::removeFromSuperlayer()
@@ -741,13 +741,13 @@ void PlatformCALayerCocoa::setSupportsSubpixelAntialiasedText(bool supportsSubpi
 
 CFTypeRef PlatformCALayerCocoa::contents() const
 {
-    return [m_layer contents];
+    return (__bridge CFTypeRef)[m_layer contents];
 }
 
 void PlatformCALayerCocoa::setContents(CFTypeRef value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
-    [m_layer setContents:static_cast<id>(const_cast<void*>(value))];
+    [m_layer setContents:(__bridge id)value];
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
index f68220e..2d1f273 100644 (file)
@@ -102,7 +102,9 @@ public:
     WEBCORE_EXPORT RetainPtr<CGImageRef> createImage();
     WEBCORE_EXPORT static RetainPtr<CGImageRef> sinkIntoImage(std::unique_ptr<IOSurface>);
 
-    id asLayerContents() const { return reinterpret_cast<id>(m_surface.get()); }
+#ifdef __OBJC__
+    id asLayerContents() const { return (__bridge id)m_surface.get(); }
+#endif
     IOSurfaceRef surface() const { return m_surface.get(); }
     WEBCORE_EXPORT GraphicsContext& ensureGraphicsContext();
     WEBCORE_EXPORT CGContextRef ensurePlatformContext();
index 679e5ac..8595456 100644 (file)
@@ -129,7 +129,7 @@ TextTrackRepresentationCocoa::~TextTrackRepresentationCocoa()
 void TextTrackRepresentationCocoa::update()
 {
     if (auto representation = m_client.createTextTrackRepresentationImage())
-        [m_layer.get() setContents:(id)representation->nativeImage().get()];
+        [m_layer.get() setContents:(__bridge id)representation->nativeImage().get()];
 }
 
 void TextTrackRepresentationCocoa::setContentScale(float scale)
index 3abcbdc..b762ea9 100644 (file)
@@ -219,17 +219,17 @@ void WebCoreDecompressionSession::ensureDecompressionSessionForSample(CMSampleBu
 
     if (!m_decompressionSession) {
         CMVideoFormatDescriptionRef videoFormatDescription = CMSampleBufferGetFormatDescription(sample);
-        NSDictionary* videoDecoderSpecification = @{ (NSString *)kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder: @YES };
+        auto videoDecoderSpecification = @{ (__bridge NSString *)kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder: @YES };
 
         NSDictionary *attributes;
         if (m_mode == OpenGL) {
             attributes = nil;
         } else {
             ASSERT(m_mode == RGB);
-            attributes = @{(NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA)};
+            attributes = @{ (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_32BGRA) };
         }
         VTDecompressionSessionRef decompressionSessionOut = nullptr;
-        if (noErr == VTDecompressionSessionCreate(kCFAllocatorDefault, videoFormatDescription, (CFDictionaryRef)videoDecoderSpecification, (CFDictionaryRef)attributes, nullptr, &decompressionSessionOut)) {
+        if (noErr == VTDecompressionSessionCreate(kCFAllocatorDefault, videoFormatDescription, (__bridge CFDictionaryRef)videoDecoderSpecification, (__bridge CFDictionaryRef)attributes, nullptr, &decompressionSessionOut)) {
             m_decompressionSession = adoptCF(decompressionSessionOut);
             CFArrayRef rawSuggestedQualityOfServiceTiers = nullptr;
             VTSessionCopyProperty(decompressionSessionOut, kVTDecompressionPropertyKey_SuggestedQualityOfServiceTiers, kCFAllocatorDefault, &rawSuggestedQualityOfServiceTiers);
@@ -562,7 +562,7 @@ void WebCoreDecompressionSession::resetQosTier()
         return;
 
     auto tier = (CFDictionaryRef)CFArrayGetValueAtIndex(m_qosTiers.get(), m_currentQosTier);
-    LOG(Media, "WebCoreDecompressionSession::resetQosTier(%p) - currentQosTier(%ld), tier(%@)", this, m_currentQosTier, [(NSDictionary *)tier description]);
+    LOG(Media, "WebCoreDecompressionSession::resetQosTier(%p) - currentQosTier(%ld), tier(%@)", this, m_currentQosTier, [(__bridge NSDictionary *)tier description]);
 
     VTSessionSetProperties(m_decompressionSession.get(), tier);
     m_framesSinceLastQosCheck = 0;
index fa77dc4..3ed7e41 100644 (file)
@@ -141,7 +141,7 @@ static void freeData(void *, const void *data, size_t /* size */)
 #endif
 
     _context->markLayerComposited();
-    PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
+    PlatformCALayer* layer = PlatformCALayer::platformCALayer((__bridge void*)self);
     if (layer && layer->owner())
         layer->owner()->platformCALayerLayerDidDisplay(layer);
 }
index 9f67575..5ca9e7d 100644 (file)
@@ -118,7 +118,7 @@ NSImage* BitmapImage::nsImage()
     if (!data)
         return nullptr;
     
-    m_nsImage = adoptNS([[NSImage alloc] initWithData:(NSData*)data]);
+    m_nsImage = adoptNS([[NSImage alloc] initWithData:(__bridge NSData *)data]);
     return m_nsImage.get();
 }
 
@@ -132,7 +132,7 @@ RetainPtr<NSImage> BitmapImage::snapshotNSImage()
     if (!data)
         return nullptr;
 
-    return adoptNS([[NSImage alloc] initWithData:(NSData*)data.get()]);
+    return adoptNS([[NSImage alloc] initWithData:(__bridge NSData *)data.get()]);
 }
 #endif
 
index 98338ab..d692905 100644 (file)
@@ -51,7 +51,7 @@ using namespace WebCore;
 
 - (void)drawInContext:(CGContextRef)context
 {
-    PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
+    PlatformCALayer* layer = PlatformCALayer::platformCALayer((__bridge void*)self);
     if (layer) {
         PlatformCALayer::RepaintRectList rectsToPaint = PlatformCALayer::collectRectsToPaint(context, layer);
         PlatformCALayer::drawLayerContents(context, layer, rectsToPaint, self.isRenderingInContext ? GraphicsLayerPaintSnapshotting : GraphicsLayerPaintNormal);
@@ -81,14 +81,14 @@ using namespace WebCore;
 
 - (void)setNeedsDisplay
 {
-    PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
+    PlatformCALayer* layer = PlatformCALayer::platformCALayer((__bridge void*)self);
     if (layer && layer->owner() && layer->owner()->platformCALayerDrawsContent())
         [super setNeedsDisplay];
 }
 
 - (void)setNeedsDisplayInRect:(CGRect)dirtyRect
 {
-    PlatformCALayer* platformLayer = PlatformCALayer::platformCALayer(self);
+    PlatformCALayer* platformLayer = PlatformCALayer::platformCALayer((__bridge void*)self);
     if (!platformLayer) {
         [super setNeedsDisplayInRect:dirtyRect];
         return;
@@ -115,7 +115,7 @@ using namespace WebCore;
 #endif
     ASSERT(isMainThread());
     [super display];
-    PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
+    PlatformCALayer* layer = PlatformCALayer::platformCALayer((__bridge void*)self);
     if (layer && layer->owner())
         layer->owner()->platformCALayerLayerDidDisplay(layer);
 }
@@ -127,7 +127,7 @@ using namespace WebCore;
         WebThreadLock();
 #endif
     ASSERT(isMainThread());
-    PlatformCALayer* layer = PlatformCALayer::platformCALayer(self);
+    PlatformCALayer* layer = PlatformCALayer::platformCALayer((__bridge void*)self);
     if (layer && layer->owner()) {
         GraphicsContext graphicsContext(context);
         graphicsContext.setIsCALayerContext(true);
index 39d42d6..7fed940 100644 (file)
@@ -125,7 +125,7 @@ static Class coreCursorClass()
 
 static NSCursor *cursor(const char *name)
 {
-    NSCursor **slot = 0;
+    __strong NSCursor **slot = nullptr;
     
     if (!strcmp(name, "BusyButClickable"))
         slot = &busyButClickableNSCursor;
index 640dfc1..071d0c9 100644 (file)
@@ -66,8 +66,8 @@ void FileSystem::setMetadataURL(const String& path, const String& metadataURLStr
         if (!referrer.isNull())
             [whereFromAttribute addObject:referrer];
 
-        MDItemSetAttribute(item.get(), kMDItemWhereFroms, whereFromAttribute.get());
-        MDItemSetAttribute(item.get(), kMDItemDownloadedDate, @[ [NSDate date] ]);
+        MDItemSetAttribute(item.get(), kMDItemWhereFroms, (__bridge CFArrayRef)whereFromAttribute.get());
+        MDItemSetAttribute(item.get(), kMDItemDownloadedDate, (__bridge CFArrayRef)@[ [NSDate date] ]);
     });
 }
 
index d4b1f06..2f0e524 100644 (file)
@@ -59,7 +59,7 @@ RefPtr<SharedBuffer> PlatformPasteboard::bufferForType(const String& pasteboardT
     NSData *data = [m_pasteboard.get() dataForType:pasteboardType];
     if (!data)
         return nullptr;
-    return SharedBuffer::create([[data copy] autorelease]);
+    return SharedBuffer::create(adoptNS([data copy]).get());
 }
 
 int PlatformPasteboard::numberOfFiles() const
index 3f00ff9..ad5debe 100644 (file)
@@ -219,7 +219,7 @@ static NSArray *speechSynthesisGetVoiceIdentifiers()
     // Get all the voices offered by TTS.
     // By default speech only returns "premium" voices, which does not include all the
     // international voices. This allows us to offer speech synthesis for all supported languages.
-    return [(NSArray *)CopySpeechSynthesisVoicesForMode((CFArrayRef)@[ @"VoiceGroupDefault", @"VoiceGroupCompact" ]) autorelease];
+    return CFBridgingRelease(CopySpeechSynthesisVoicesForMode((__bridge CFArrayRef)@[ @"VoiceGroupDefault", @"VoiceGroupCompact" ]));
 }
 
 static NSString *speechSynthesisGetDefaultVoiceIdentifierForLocale(NSLocale *userLocale)
@@ -227,7 +227,7 @@ static NSString *speechSynthesisGetDefaultVoiceIdentifierForLocale(NSLocale *use
     if (!userLocale)
         return nil;
 
-    return (NSString *)GetIdentifierStringForPreferredVoiceInListWithLocale((CFArrayRef)speechSynthesisGetVoiceIdentifiers(), (CFLocaleRef)userLocale);
+    return (__bridge NSString *)GetIdentifierStringForPreferredVoiceInListWithLocale((__bridge CFArrayRef)speechSynthesisGetVoiceIdentifiers(), (__bridge CFLocaleRef)userLocale);
 }
 
 void PlatformSpeechSynthesizer::initializeVoiceList()
index 85365fb..0f72509 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -28,8 +28,7 @@
 #if PLATFORM(MAC)
 
 #include <memory>
-#include <string>
-#include <vector>
+#include <wtf/RetainPtr.h>
 
 OBJC_CLASS NSArray;
 OBJC_CLASS NSDictionary;
@@ -60,10 +59,10 @@ public:
 private:
     PluginBlacklist(NSDictionary *bundleIDToMinimumSecureVersion, NSDictionary *bundleIDToMinimumCompatibleVersion, NSDictionary *bundleIDToBlockedVersions, NSSet *bundleIDsWithAvailableUpdates);
 
-    NSDictionary *m_bundleIDToMinimumSecureVersion;
-    NSDictionary *m_bundleIDToMinimumCompatibleVersion;
-    NSDictionary *m_bundleIDToBlockedVersions;
-    NSSet *m_bundleIDsWithAvailableUpdates;
+    RetainPtr<NSDictionary> m_bundleIDToMinimumSecureVersion;
+    RetainPtr<NSDictionary> m_bundleIDToMinimumCompatibleVersion;
+    RetainPtr<NSDictionary> m_bundleIDToBlockedVersions;
+    RetainPtr<NSSet> m_bundleIDsWithAvailableUpdates;
 };
 
 }
index cf19a5c..6815bba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -79,7 +79,7 @@ std::unique_ptr<PluginBlacklist> PluginBlacklist::create(NSDictionary *propertyL
     NSMutableDictionary *bundleIDToBlockedVersions = [NSMutableDictionary dictionary];
     NSMutableSet *bundleIDsWithAvailableUpdates = [NSMutableSet set];
     
-    for (NSString *osVersionComponent in splitOSVersion((NSString *)osVersion)) {
+    for (NSString *osVersionComponent in splitOSVersion((__bridge NSString *)osVersion)) {
         NSDictionary *bundleIDs = [dictionary objectForKey:osVersionComponent];
         if (!bundleIDs)
             continue;
@@ -119,10 +119,6 @@ std::unique_ptr<PluginBlacklist> PluginBlacklist::create(NSDictionary *propertyL
 
 PluginBlacklist::~PluginBlacklist()
 {
-    CFRelease(m_bundleIDToMinimumSecureVersion);
-    CFRelease(m_bundleIDToMinimumCompatibleVersion);
-    CFRelease(m_bundleIDToBlockedVersions);
-    CFRelease(m_bundleIDsWithAvailableUpdates);
 }
 
 NSArray *PluginBlacklist::splitOSVersion(NSString *osVersion)
@@ -173,20 +169,11 @@ bool PluginBlacklist::isUpdateAvailable(NSString *bundleIdentifier) const
 }
 
 PluginBlacklist::PluginBlacklist(NSDictionary *bundleIDToMinimumSecureVersion, NSDictionary *bundleIDToMinimumCompatibleVersion, NSDictionary *bundleIDToBlockedVersions, NSSet *bundleIDsWithAvailableUpdates)
-    : m_bundleIDToMinimumSecureVersion([bundleIDToMinimumSecureVersion copy])
-    , m_bundleIDToMinimumCompatibleVersion([bundleIDToMinimumCompatibleVersion copy])
-    , m_bundleIDToBlockedVersions([bundleIDToBlockedVersions copy])
-    , m_bundleIDsWithAvailableUpdates([bundleIDsWithAvailableUpdates copy])
+    : m_bundleIDToMinimumSecureVersion { adoptNS([bundleIDToMinimumSecureVersion copy]) }
+    , m_bundleIDToMinimumCompatibleVersion { adoptNS([bundleIDToMinimumCompatibleVersion copy]) }
+    , m_bundleIDToBlockedVersions { adoptNS([bundleIDToBlockedVersions copy]) }
+    , m_bundleIDsWithAvailableUpdates { adoptNS([bundleIDsWithAvailableUpdates copy]) }
 {
-    // This ensures that the dictionaries do not get destroyed under Objective-C grabage collection.
-    CFRetain(m_bundleIDToMinimumSecureVersion);
-    [m_bundleIDToMinimumSecureVersion release];
-    CFRetain(m_bundleIDToMinimumCompatibleVersion);
-    [m_bundleIDToMinimumCompatibleVersion release];
-    CFRetain(m_bundleIDToBlockedVersions);
-    [m_bundleIDToBlockedVersions release];
-    CFRetain(m_bundleIDsWithAvailableUpdates);
-    [m_bundleIDsWithAvailableUpdates release];
 }
 
 }
index b3889fb..2303817 100644 (file)
@@ -38,7 +38,7 @@ bool isPublicSuffix(const String& domain)
 {
     // Explicitly cast the domain to a NSString before calling decodeHostName() so we get a NSString back instead of a String.
     NSString *host = decodeHostName((NSString *)domain);
-    return host && _CFHostIsDomainTopLevel((CFStringRef)host);
+    return host && _CFHostIsDomainTopLevel((__bridge CFStringRef)host);
 }
 
 String topPrivatelyControlledDomain(const String& domain)
index 9c6c9db..3d74722 100644 (file)
@@ -143,7 +143,7 @@ RemoteCommandListenerMac::RemoteCommandListenerMac(RemoteCommandListenerClient&
         if (!weakThis)
             return;
         weakThis->m_client.didReceiveRemoteControlCommand(platformCommand, &argument);
-        completion(static_cast<CFArrayRef>(@[@(status)]));
+        completion((__bridge CFArrayRef)@[@(status)]);
     });
 #endif // USE(MEDIAREMOTE)
 }
index 977b608..ded7ec0 100644 (file)
@@ -190,7 +190,7 @@ static JSValue *jsValueWithDictionaryInContext(NSDictionary *dictionary, JSConte
         if (!value)
             continue;
 
-        JSStringRef name = JSStringCreateWithCFString((CFStringRef)key);
+        JSStringRef name = JSStringCreateWithCFString((__bridge CFStringRef)key);
         JSObjectSetProperty([context JSGlobalContextRef], resultObject, name, [value JSValueRef], 0, &exception);
         JSStringRelease(name);
         if (exception)
index 9bb2560..bbbf9a2 100644 (file)
@@ -47,14 +47,14 @@ URL::URL(NSURL *url)
 
     // FIXME: Why is it OK to ignore base URL here?
     CString urlBytes;
-    getURLBytes(reinterpret_cast<CFURLRef>(url), urlBytes);
+    getURLBytes((__bridge CFURLRef)url, urlBytes);
     URLParser parser(urlBytes.data());
     *this = parser.result();
 }
 
 URL::operator NSURL *() const
 {
-    // Creating a toll-free bridged CFURL, because a real NSURL would not preserve the original string.
+    // Creating a toll-free bridged CFURL because creation with NSURL methods would not preserve the original string.
     // We'll need fidelity when round-tripping via CFURLGetBytes().
     return (NSURL *)createCFURL().autorelease();
 }
@@ -66,7 +66,7 @@ RetainPtr<CFURLRef> URL::createCFURL() const
 
     if (isEmpty()) {
         // We use the toll-free bridge between NSURL and CFURL to create a CFURLRef supporting both empty and null values.
-        return reinterpret_cast<CFURLRef>(adoptNS([[NSURL alloc] initWithString:@""]).get());
+        return (__bridge CFURLRef)adoptNS([[NSURL alloc] initWithString:@""]).get();
     }
 
     RetainPtr<CFURLRef> cfURL;
index 8df8554..bd777f0 100644 (file)
@@ -539,7 +539,7 @@ static NSString *mapHostNameWithRange(NSString *string, NSRange range, BOOL enco
     
     if (encode && [string rangeOfString:@"%" options:NSLiteralSearch range:range].location != NSNotFound) {
         NSString *substring = [string substringWithRange:range];
-        substring = CFBridgingRelease(CFURLCreateStringByReplacingPercentEscapes(NULL, (CFStringRef)substring, CFSTR("")));
+        substring = CFBridgingRelease(CFURLCreateStringByReplacingPercentEscapes(nullptr, (CFStringRef)substring, CFSTR("")));
         if (substring) {
             string = substring;
             range = NSMakeRange(0, [string length]);
@@ -622,7 +622,7 @@ static void collectRangesThatNeedMapping(NSString *string, NSRange range, void *
     if (!error && !needsMapping)
         return;
     
-    NSMutableArray **array = (NSMutableArray **)context;
+    __strong NSMutableArray **array = (__strong NSMutableArray **)context;
     if (!*array)
         *array = [[NSMutableArray alloc] init];
     
@@ -795,7 +795,7 @@ static NSString *mapHostNames(NSString *string, BOOL encode)
 static NSString *stringByTrimmingWhitespace(NSString *string)
 {
     NSMutableString *trimmed = [[string mutableCopy] autorelease];
-    CFStringTrimWhitespace((CFMutableStringRef)trimmed);
+    CFStringTrimWhitespace((__bridge CFMutableStringRef)trimmed);
     return trimmed;
 }
 
@@ -804,23 +804,23 @@ NSURL *URLByTruncatingOneCharacterBeforeComponent(NSURL *URL, CFURLComponentType
     if (!URL)
         return nil;
     
-    CFRange fragRg = CFURLGetByteRangeForComponent((CFURLRef)URL, component, NULL);
+    CFRange fragRg = CFURLGetByteRangeForComponent((__bridge CFURLRef)URL, component, nullptr);
     if (fragRg.location == kCFNotFound)
         return URL;
-    
+
     Vector<UInt8, URL_BYTES_BUFFER_LENGTH> urlBytes(URL_BYTES_BUFFER_LENGTH);
-    CFIndex numBytes = CFURLGetBytes((CFURLRef)URL, urlBytes.data(), urlBytes.size());
+    CFIndex numBytes = CFURLGetBytes((__bridge CFURLRef)URL, urlBytes.data(), urlBytes.size());
     if (numBytes == -1) {
-        numBytes = CFURLGetBytes((CFURLRef)URL, NULL, 0);
+        numBytes = CFURLGetBytes((__bridge CFURLRef)URL, nullptr, 0);
         urlBytes.grow(numBytes);
-        CFURLGetBytes((CFURLRef)URL, urlBytes.data(), numBytes);
+        CFURLGetBytes((__bridge CFURLRef)URL, urlBytes.data(), numBytes);
     }
 
-    NSURL *result = (NSURL *)CFURLCreateWithBytes(NULL, urlBytes.data(), fragRg.location - 1, kCFStringEncodingUTF8, NULL);
+    CFURLRef result = CFURLCreateWithBytes(nullptr, urlBytes.data(), fragRg.location - 1, kCFStringEncodingUTF8, nullptr);
     if (!result)
-        result = (NSURL *)CFURLCreateWithBytes(NULL, urlBytes.data(), fragRg.location - 1, kCFStringEncodingISOLatin1, NULL);
+        result = CFURLCreateWithBytes(nullptr, urlBytes.data(), fragRg.location - 1, kCFStringEncodingISOLatin1, nullptr);
         
-    return result ? [result autorelease] : URL;
+    return result ? CFBridgingRelease(result) : URL;
 }
 
 static NSURL *URLByRemovingResourceSpecifier(NSURL *URL)
@@ -849,9 +849,9 @@ NSURL *URLWithData(NSData *data, NSURL *baseURL)
         // (e.g calls to NSURL -path). However, this function is not tolerant of illegal UTF-8 sequences, which
         // could either be a malformed string or bytes in a different encoding, like shift-jis, so we fall back
         // onto using ISO Latin 1 in those cases.
-        result = CFBridgingRelease(CFURLCreateAbsoluteURLWithBytes(NULL, bytes, length, kCFStringEncodingUTF8, (CFURLRef)baseURL, YES));
+        result = CFBridgingRelease(CFURLCreateAbsoluteURLWithBytes(nullptr, bytes, length, kCFStringEncodingUTF8, (__bridge CFURLRef)baseURL, YES));
         if (!result)
-            result = CFBridgingRelease(CFURLCreateAbsoluteURLWithBytes(NULL, bytes, length, kCFStringEncodingISOLatin1, (CFURLRef)baseURL, YES));
+            result = CFBridgingRelease(CFURLCreateAbsoluteURLWithBytes(nullptr, bytes, length, kCFStringEncodingISOLatin1, (__bridge CFURLRef)baseURL, YES));
     } else
         result = [NSURL URLWithString:@""];
 
@@ -928,7 +928,7 @@ NSURL *URLWithUserTypedStringDeprecated(NSString *string, NSURL *URL)
 static BOOL hasQuestionMarkOnlyQueryString(NSURL *URL)
 {
     CFRange rangeWithSeparators;
-    CFURLGetByteRangeForComponent((CFURLRef)URL, kCFURLComponentQuery, &rangeWithSeparators);
+    CFURLGetByteRangeForComponent((__bridge CFURLRef)URL, kCFURLComponentQuery, &rangeWithSeparators);
     if (rangeWithSeparators.location != kCFNotFound && rangeWithSeparators.length == 1)
         return YES;
 
@@ -938,17 +938,17 @@ static BOOL hasQuestionMarkOnlyQueryString(NSURL *URL)
 NSData *dataForURLComponentType(NSURL *URL, CFURLComponentType componentType)
 {
     Vector<UInt8, URL_BYTES_BUFFER_LENGTH> allBytesBuffer(URL_BYTES_BUFFER_LENGTH);
-    CFIndex bytesFilled = CFURLGetBytes((CFURLRef)URL, allBytesBuffer.data(), allBytesBuffer.size());
+    CFIndex bytesFilled = CFURLGetBytes((__bridge CFURLRef)URL, allBytesBuffer.data(), allBytesBuffer.size());
     if (bytesFilled == -1) {
-        CFIndex bytesToAllocate = CFURLGetBytes((CFURLRef)URL, NULL, 0);
+        CFIndex bytesToAllocate = CFURLGetBytes((__bridge CFURLRef)URL, nullptr, 0);
         allBytesBuffer.grow(bytesToAllocate);
-        bytesFilled = CFURLGetBytes((CFURLRef)URL, allBytesBuffer.data(), bytesToAllocate);
+        bytesFilled = CFURLGetBytes((__bridge CFURLRef)URL, allBytesBuffer.data(), bytesToAllocate);
     }
     
     const CFURLComponentType completeURL = (CFURLComponentType)-1;
     CFRange range;
     if (componentType != completeURL) {
-        range = CFURLGetByteRangeForComponent((CFURLRef)URL, componentType, NULL);
+        range = CFURLGetByteRangeForComponent((__bridge CFURLRef)URL, componentType, nullptr);
         if (range.location == kCFNotFound)
             return nil;
     } else {
@@ -986,7 +986,7 @@ NSData *dataForURLComponentType(NSURL *URL, CFURLComponentType componentType)
 
 static NSURL *URLByRemovingComponentAndSubsequentCharacter(NSURL *URL, CFURLComponentType component)
 {
-    CFRange range = CFURLGetByteRangeForComponent((CFURLRef)URL, component, 0);
+    CFRange range = CFURLGetByteRangeForComponent((__bridge CFURLRef)URL, component, 0);
     if (range.location == kCFNotFound)
         return URL;
     
@@ -994,11 +994,11 @@ static NSURL *URLByRemovingComponentAndSubsequentCharacter(NSURL *URL, CFURLComp
     range.length++;
 
     Vector<UInt8, URL_BYTES_BUFFER_LENGTH> buffer(URL_BYTES_BUFFER_LENGTH);
-    CFIndex numBytes = CFURLGetBytes((CFURLRef)URL, buffer.data(), buffer.size());
+    CFIndex numBytes = CFURLGetBytes((__bridge CFURLRef)URL, buffer.data(), buffer.size());
     if (numBytes == -1) {
-        numBytes = CFURLGetBytes((CFURLRef)URL, NULL, 0);
+        numBytes = CFURLGetBytes((__bridge CFURLRef)URL, nullptr, 0);
         buffer.grow(numBytes);
-        CFURLGetBytes((CFURLRef)URL, buffer.data(), numBytes);
+        CFURLGetBytes((__bridge CFURLRef)URL, buffer.data(), numBytes);
     }
     UInt8* urlBytes = buffer.data();
         
@@ -1009,11 +1009,11 @@ static NSURL *URLByRemovingComponentAndSubsequentCharacter(NSURL *URL, CFURLComp
         
     memmove(urlBytes + range.location, urlBytes + range.location + range.length, numBytes - range.location + range.length);
     
-    NSURL *result = (NSURL *)CFURLCreateWithBytes(NULL, urlBytes, numBytes - range.length, kCFStringEncodingUTF8, NULL);
+    CFURLRef result = CFURLCreateWithBytes(nullptr, urlBytes, numBytes - range.length, kCFStringEncodingUTF8, nullptr);
     if (!result)
-        result = (NSURL *)CFURLCreateWithBytes(NULL, urlBytes, numBytes - range.length, kCFStringEncodingISOLatin1, NULL);
+        result = CFURLCreateWithBytes(nullptr, urlBytes, numBytes - range.length, kCFStringEncodingISOLatin1, nullptr);
                 
-    return result ? [result autorelease] : URL;
+    return result ? CFBridgingRelease(result) : URL;
 }
 
 NSURL *URLByRemovingUserInfo(NSURL *URL)
@@ -1041,18 +1041,18 @@ NSURL *URLByCanonicalizingURL(NSURL *URL)
 NSData *originalURLData(NSURL *URL)
 {
     UInt8 *buffer = (UInt8 *)malloc(URL_BYTES_BUFFER_LENGTH);
-    CFIndex bytesFilled = CFURLGetBytes((CFURLRef)URL, buffer, URL_BYTES_BUFFER_LENGTH);
+    CFIndex bytesFilled = CFURLGetBytes((__bridge CFURLRef)URL, buffer, URL_BYTES_BUFFER_LENGTH);
     if (bytesFilled == -1) {
-        CFIndex bytesToAllocate = CFURLGetBytes((CFURLRef)URL, NULL, 0);
+        CFIndex bytesToAllocate = CFURLGetBytes((__bridge CFURLRef)URL, nullptr, 0);
         buffer = (UInt8 *)realloc(buffer, bytesToAllocate);
-        bytesFilled = CFURLGetBytes((CFURLRef)URL, buffer, bytesToAllocate);
+        bytesFilled = CFURLGetBytes((__bridge CFURLRef)URL, buffer, bytesToAllocate);
         ASSERT(bytesFilled == bytesToAllocate);
     }
     
     // buffer is adopted by the NSData
     NSData *data = [NSData dataWithBytesNoCopy:buffer length:bytesFilled freeWhenDone:YES];
     
-    NSURL *baseURL = (NSURL *)CFURLGetBaseURL((CFURLRef)URL);
+    NSURL *baseURL = (__bridge NSURL *)CFURLGetBaseURL((__bridge CFURLRef)URL);
     if (baseURL)
         return originalURLData(URLWithData(data, baseURL));
     return data;
@@ -1096,7 +1096,7 @@ static CFStringRef createStringWithEscapedUnsafeCharacters(CFStringRef string)
         previousCodePoint = c;
     }
     
-    return CFStringCreateWithCharacters(NULL, outBuffer.data(), outBuffer.size());
+    return CFStringCreateWithCharacters(nullptr, outBuffer.data(), outBuffer.size());
 }
 
 NSString *userVisibleString(NSURL *URL)
@@ -1170,7 +1170,7 @@ NSString *userVisibleString(NSURL *URL)
     }
 
     result = [result precomposedStringWithCanonicalMapping];
-    return CFBridgingRelease(createStringWithEscapedUnsafeCharacters((CFStringRef)result));
+    return CFBridgingRelease(createStringWithEscapedUnsafeCharacters((__bridge CFStringRef)result));
 }
 
 BOOL isUserVisibleURL(NSString *string)
@@ -1180,7 +1180,7 @@ BOOL isUserVisibleURL(NSString *string)
     
     char static_buffer[1024];
     const char *p;
-    BOOL success = CFStringGetCString((CFStringRef)string, static_buffer, 1023, kCFStringEncodingUTF8);
+    BOOL success = CFStringGetCString((__bridge CFStringRef)string, static_buffer, 1023, kCFStringEncodingUTF8);
     p = success ? static_buffer : [string UTF8String];
     
     int length = strlen(p);
index bb7e331..6fadcd3 100644 (file)
@@ -170,7 +170,7 @@ std::unique_ptr<WebGLBlacklist> WebGLBlacklist::create(NSDictionary *propertyLis
 {
     CFDictionaryRef systemVersionDictionary = _CFCopySystemVersionDictionary();
     CFStringRef osBuild = static_cast<CFStringRef>(CFDictionaryGetValue(systemVersionDictionary, _kCFSystemVersionBuildVersionKey));
-    OSBuildInfo buildInfo = buildInfoFromOSBuildString((NSString *)osBuild);
+    OSBuildInfo buildInfo = buildInfoFromOSBuildString((__bridge NSString *)osBuild);
     CFRelease(systemVersionDictionary);
 
     if (!buildInfo.major)
index 0f54eb5..9e37fb9 100644 (file)
@@ -285,7 +285,7 @@ bool AVVideoCaptureSource::setPreset(NSString *preset)
     @try {
         session().sessionPreset = preset;
 #if PLATFORM(MAC)
-        auto settingsDictionary = @{ (NSString*)kCVPixelBufferPixelFormatTypeKey: @(videoCaptureFormat), (NSString*)kCVPixelBufferWidthKey: @(size.width()), (NSString*)kCVPixelBufferHeightKey: @(size.height()), };
+        auto settingsDictionary = @{ (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(videoCaptureFormat), (__bridge NSString *)kCVPixelBufferWidthKey: @(size.width()), (__bridge NSString *)kCVPixelBufferHeightKey: @(size.height()), };
         [m_videoOutput setVideoSettings:settingsDictionary];
 #endif
     } @catch(NSException *exception) {
@@ -405,8 +405,8 @@ bool AVVideoCaptureSource::setupCaptureSession()
     if (m_pendingPreset) {
 #if PLATFORM(MAC)
         auto size = sizeForPreset(m_pendingPreset.get());
-        [settingsDictionary.get() setObject:[NSNumber numberWithInt:size.width()] forKey:(NSString*)kCVPixelBufferWidthKey];
-        [settingsDictionary.get() setObject:[NSNumber numberWithInt:size.height()] forKey:(NSString*)kCVPixelBufferHeightKey];
+        [settingsDictionary setObject:@(size.width()) forKey:(__bridge NSString *)kCVPixelBufferWidthKey];
+        [settingsDictionary setObject:@(size.height()) forKey:(__bridge NSString *)kCVPixelBufferHeightKey];
 #endif
     }
 
index 272e668..2ad4d01 100644 (file)
@@ -72,7 +72,7 @@ RetainPtr<CMSampleBufferRef> MockRealtimeVideoSourceMac::CMSampleBufferFromPixel
         return nullptr;
 
     if (!m_pixelBufferConformer)
-        m_pixelBufferConformer = std::make_unique<PixelBufferConformerCV>((CFDictionaryRef)@{ (NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_420YpCbCr8Planar) });
+        m_pixelBufferConformer = std::make_unique<PixelBufferConformerCV>((__bridge CFDictionaryRef)@{ (__bridge NSString *)kCVPixelBufferPixelFormatTypeKey: @(kCVPixelFormatType_420YpCbCr8Planar) });
 
     auto convertedPixelBuffer = m_pixelBufferConformer->convert(pixelBuffer);
 
index b650b01..eea777d 100644 (file)
@@ -243,7 +243,7 @@ void ResourceRequest::doUpdatePlatformHTTPBody()
 
     if (NSInputStream *bodyStream = [nsRequest HTTPBodyStream]) {
         // For streams, provide a Content-Length to avoid using chunked encoding, and to get accurate total length in callbacks.
-        NSString *lengthString = [bodyStream propertyForKey:(NSString *)formDataStreamLengthPropertyName()];
+        NSString *lengthString = [bodyStream propertyForKey:(__bridge NSString *)formDataStreamLengthPropertyName()];
         if (lengthString) {
             [nsRequest setValue:lengthString forHTTPHeaderField:@"Content-Length"];
             // Since resource request is already marked updated, we need to keep it up to date too.
index d68bef3..3d8f396 100644 (file)
@@ -111,8 +111,8 @@ CertificateInfo ResourceResponse::platformCertificateInfo() const
 #endif
 }
 
-static NSString* const commonHeaderFields[] = {
-    @"Age", @"Cache-Control", @"Content-Type", @"Date", @"Etag", @"Expires", @"Last-Modified", @"Pragma"
+static CFStringRef const commonHeaderFields[] = {
+    CFSTR("Age"), CFSTR("Cache-Control"), CFSTR("Content-Type"), CFSTR("Date"), CFSTR("Etag"), CFSTR("Expires"), CFSTR("Last-Modified"), CFSTR("Pragma")
 };
 
 NSURLResponse *ResourceResponse::nsURLResponse() const
index ffc99be..8b2aeba 100644 (file)
@@ -108,7 +108,7 @@ void CertificateInfo::dump() const
         NSLog(@"  Entries: %ld\n", entries);
         for (CFIndex i = 0; i < entries; ++i) {
             RetainPtr<CFStringRef> summary = adoptCF(SecCertificateCopySubjectSummary(SecTrustGetCertificateAtIndex(trust(), i)));
-            NSLog(@"  %@", (NSString *)summary.get());
+            NSLog(@"  %@", (__bridge NSString *)summary.get());
         }
 
         return;
@@ -121,7 +121,7 @@ void CertificateInfo::dump() const
         NSLog(@"  Entries: %ld\n", entries);
         for (CFIndex i = 0; i < entries; ++i) {
             RetainPtr<CFStringRef> summary = adoptCF(SecCertificateCopySubjectSummary(checked_cf_cast<SecCertificateRef>(CFArrayGetValueAtIndex(m_certificateChain.get(), i))));
-            NSLog(@"  %@", (NSString *)summary.get());
+            NSLog(@"  %@", (__bridge NSString *)summary.get());
         }
 
         return;
index d9caf40..7a748d9 100644 (file)
@@ -41,12 +41,12 @@ void setHTTPBody(NSMutableURLRequest *request, FormData* formData)
 
 RetainPtr<NSInputStream> createHTTPBodyNSInputStream(FormData& formData)
 {
-    return reinterpret_cast<NSInputStream *>(createHTTPBodyCFReadStream(formData).get());
+    return (__bridge NSInputStream *)createHTTPBodyCFReadStream(formData).get();
 }
 
 FormData* httpBodyFromStream(NSInputStream *stream)
 {
-    return httpBodyFromStream(reinterpret_cast<CFReadStreamRef>(stream));
+    return httpBodyFromStream((__bridge CFReadStreamRef)stream);
 }
 
 } // namespace WebCore
index a27a9b1..2ecf428 100644 (file)
@@ -118,7 +118,7 @@ ResourceError::ResourceError(NSError *nsError)
 }
 
 ResourceError::ResourceError(CFErrorRef cfError)
-    : ResourceError((NSError *)cfError)
+    : ResourceError { (__bridge NSError *)cfError }
 {
 }
 
@@ -201,7 +201,7 @@ ResourceError::operator NSError *() const
 
 CFErrorRef ResourceError::cfError() const
 {
-    return (CFErrorRef)nsError();
+    return (__bridge CFErrorRef)nsError();
 }
 
 ResourceError::operator CFErrorRef() const
index 4a3dd46..34fa174 100644 (file)
@@ -157,7 +157,7 @@ static const double progressAnimationNumFrames = 256;
 {
     // FIXME: This is a workaround for <rdar://problem/11385461>. When that bug is resolved, we should remove this code.
     CFMutableDictionaryRef coreUIDrawOptions = CFDictionaryCreateMutableCopy(NULL, 0, [super _coreUIDrawOptionsWithFrame:cellFrame inView:controlView includeFocus:includeFocus]);
-    CFDictionarySetValue(coreUIDrawOptions, @"borders only", kCFBooleanTrue);
+    CFDictionarySetValue(coreUIDrawOptions, CFSTR("borders only"), kCFBooleanTrue);
     CFAutorelease(coreUIDrawOptions);
     return coreUIDrawOptions;
 }
@@ -2270,8 +2270,8 @@ void AttachmentLayout::layOutTitle(const RenderAttachment& attachment)
         return;
 
     NSDictionary *textAttributes = @{
-        (id)kCTFontAttributeName: (id)font.get(),
-        (id)kCTForegroundColorAttributeName: (NSColor *)cachedCGColor(titleTextColorForAttachment(attachment))
+        (__bridge id)kCTFontAttributeName: (__bridge id)font.get(),
+        (__bridge id)kCTForegroundColorAttributeName: (__bridge NSColor *)cachedCGColor(titleTextColorForAttachment(attachment))
     };
     RetainPtr<NSAttributedString> attributedTitle = adoptNS([[NSAttributedString alloc] initWithString:title attributes:textAttributes]);
     RetainPtr<CTFramesetterRef> titleFramesetter = adoptCF(CTFramesetterCreateWithAttributedString((CFAttributedStringRef)attributedTitle.get()));
@@ -2328,8 +2328,8 @@ void AttachmentLayout::layOutSubtitle(const RenderAttachment& attachment)
     CFStringRef language = 0; // By not specifying a language we use the system language.
     RetainPtr<CTFontRef> font = adoptCF(CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, attachmentSubtitleFontSize, language));
     NSDictionary *textAttributes = @{
-        (id)kCTFontAttributeName: (id)font.get(),
-        (id)kCTForegroundColorAttributeName: (NSColor *)cachedCGColor(subtitleColor)
+        (__bridge id)kCTFontAttributeName: (__bridge id)font.get(),
+        (__bridge id)kCTForegroundColorAttributeName: (__bridge NSColor *)cachedCGColor(subtitleColor)
     };
     RetainPtr<NSAttributedString> attributedSubtitleText = adoptNS([[NSAttributedString alloc] initWithString:subtitleText attributes:textAttributes]);
     subtitleLine = adoptCF(CTLineCreateWithAttributedString((CFAttributedStringRef)attributedSubtitleText.get()));
index 7459669..30ebf74 100644 (file)
@@ -44,7 +44,7 @@ static CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseDa
 {
     NSURLResponse *response;
 #if USE(SECURE_ARCHIVER_API)
-    auto unarchiver = secureUnarchiverFromData((NSData *)responseData);
+    auto unarchiver = secureUnarchiverFromData((__bridge NSData *)responseData);
     @try {
         response = [unarchiver decodeObjectOfClass:[NSURLResponse class] forKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
 #else
@@ -60,7 +60,7 @@ static CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseDa
     }
 
     if (![response isKindOfClass:[NSHTTPURLResponse class]])
-        return CFURLResponseCreate(kCFAllocatorDefault, (CFURLRef)response.URL, (CFStringRef)response.MIMEType, response.expectedContentLength, (CFStringRef)response.textEncodingName, kCFURLCacheStorageAllowed);
+        return CFURLResponseCreate(kCFAllocatorDefault, (__bridge CFURLRef)response.URL, (__bridge CFStringRef)response.MIMEType, response.expectedContentLength, (__bridge CFStringRef)response.textEncodingName, kCFURLCacheStorageAllowed);
 
     NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
 
@@ -69,17 +69,9 @@ static CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseDa
 
     NSDictionary *headerFields = httpResponse.allHeaderFields;
     for (NSString *headerField in [headerFields keyEnumerator])
-        CFHTTPMessageSetHeaderFieldValue(httpMessage.get(), (CFStringRef)headerField, (CFStringRef)[headerFields objectForKey:headerField]);
+        CFHTTPMessageSetHeaderFieldValue(httpMessage.get(), (__bridge CFStringRef)headerField, (__bridge CFStringRef)[headerFields objectForKey:headerField]);
 
-    return CFURLResponseCreateWithHTTPResponse(kCFAllocatorDefault, (CFURLRef)response.URL, httpMessage.get(), kCFURLCacheStorageAllowed);
-}
-
-static CFArrayRef supportedNonImageMIMETypes()
-{
-    auto array = adoptNS([[NSMutableArray alloc] init]);
-    for (auto& mimeType : MIMETypeRegistry::getSupportedNonImageMIMETypes())
-        [array addObject:mimeType];
-    return (CFArrayRef)array.autorelease();
+    return CFURLResponseCreateWithHTTPResponse(kCFAllocatorDefault, (__bridge CFURLRef)response.URL, httpMessage.get(), kCFURLCacheStorageAllowed);
 }
 
 static void convertMIMEType(CFMutableStringRef mimeType)
@@ -95,8 +87,7 @@ static void convertWebResourceDataToString(CFMutableDictionaryRef resource)
     CFStringLowercase(mimeType, CFLocaleGetSystem());
     convertMIMEType(mimeType);
 
-    CFArrayRef supportedMIMETypes = supportedNonImageMIMETypes();
-    if (CFStringHasPrefix(mimeType, CFSTR("text/")) || CFArrayContainsValue(supportedMIMETypes, CFRangeMake(0, CFArrayGetCount(supportedMIMETypes)), mimeType)) {
+    if (CFStringHasPrefix(mimeType, CFSTR("text/")) || MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) {
         CFStringRef textEncodingName = static_cast<CFStringRef>(CFDictionaryGetValue(resource, CFSTR("WebResourceTextEncodingName")));
         CFStringEncoding stringEncoding;
         if (textEncodingName && CFStringGetLength(textEncodingName))