Title: [176924] trunk/Source
Revision
176924
Author
m...@apple.com
Date
2014-12-07 09:28:01 -0800 (Sun, 07 Dec 2014)

Log Message

Introduce and deploy a function that allocates and returns an instance of a soft-linked class
https://bugs.webkit.org/show_bug.cgi?id=139348

Reviewed by Anders Carlsson.

In [[getFooClass() alloc] init*], the type of the result of +alloc is id, so the compiler
picks an arbitrary declaration of init*, not necessarily the Foo one. This can then lead
to warnings or errors if the types or attributes don’t match, or to runtime errors if Foo
doesn’t even have the expected initializer. The new allocFooInstance() returns a Foo *, thus
avoiding the ambiguity.

Source/WebCore:

* editing/mac/DataDetection.mm:
(WebCore::DataDetection::detectItemAroundHitTestResult):
* platform/audio/ios/MediaSessionManagerIOS.mm:
(-[WebMediaSessionHelper allocateVolumeView]):
(-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
* platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
(WebCore::AudioSourceProviderAVFObjC::createMix):
* platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
* platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::streamSession):
* platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::abort):
(WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):

* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayerMac::PlatformCALayerMac): Cast the result of +alloc to an instance of the
expected class.

* platform/graphics/mac/FontMac.mm:
(WebCore::showLetterpressedGlyphsWithAdvances):
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivateQTKit::createQTMovie):
(WebCore::MediaPlayerPrivateQTKit::createQTMovieLayer):
* platform/graphics/mac/PDFDocumentImageMac.mm:
(WebCore::PDFDocumentImage::createPDFDocument):
* platform/ios/PlatformSpeechSynthesizerIOS.mm:
(SOFT_LINK_CONSTANT):
(-[WebSpeechSynthesisWrapper speakUtterance:]):
* platform/ios/WebCoreMotionManager.mm:
(-[WebCoreMotionManager initializeOnMainThread]):
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
(-[WebAVPlayerController init]):
(WebVideoFullscreenInterfaceAVKit::setupFullscreen):
* platform/mac/ContentFilterMac.mm:
(WebCore::ContentFilter::ContentFilter):

* platform/mac/SoftLinking.h: Added alloc##className##instance().

* platform/mac/WebVideoFullscreenController.mm:
(-[WebVideoFullscreenController setVideoElement:]):
* platform/mediastream/mac/AVAudioCaptureSource.mm:
(WebCore::AVAudioCaptureSource::setupCaptureSession):
* platform/mediastream/mac/AVCaptureDeviceManager.mm:
(WebCore::AVCaptureDeviceManager::verifyConstraintsForMediaType):
* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::setupSession):
* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSource::setupCaptureSession):
* platform/network/ios/QuickLook.mm:
(WebCore::registerQLPreviewConverterIfNeeded):
(WebCore::QuickLookHandle::QuickLookHandle):

Source/WebKit/ios:

* Misc/WebGeolocationCoreLocationProvider.mm:
(-[WebGeolocationCoreLocationProvider createLocationManager]):

Source/WebKit/mac:

* WebView/WebActionMenuController.mm:
(-[WebActionMenuController _defaultMenuItemsForDataDetectableLink]):

Source/WebKit2:

* UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
(-[WKAirPlayRoutePicker showAirPlayPickerIPad:fromRect:]):
(-[WKAirPlayRoutePicker showAirPlayPickerIPhone:]):
(-[WKAirPlayRoutePicker show:fromRect:]):
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(-[_WKVideoFileUploadItem displayImage]):
* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController _defaultMenuItemsForDataDetectableLink]):
* WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
(WebKit::PlatformCALayerRemoteCustom::clone):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (176923 => 176924)


--- trunk/Source/WebCore/ChangeLog	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/ChangeLog	2014-12-07 17:28:01 UTC (rev 176924)
@@ -1,3 +1,78 @@
+2014-12-07  Dan Bernstein  <m...@apple.com>
+
+        Introduce and deploy a function that allocates and returns an instance of a soft-linked class
+        https://bugs.webkit.org/show_bug.cgi?id=139348
+
+        Reviewed by Anders Carlsson.
+
+        In [[getFooClass() alloc] init*], the type of the result of +alloc is id, so the compiler
+        picks an arbitrary declaration of init*, not necessarily the Foo one. This can then lead
+        to warnings or errors if the types or attributes don’t match, or to runtime errors if Foo
+        doesn’t even have the expected initializer. The new allocFooInstance() returns a Foo *, thus
+        avoiding the ambiguity.
+
+        * editing/mac/DataDetection.mm:
+        (WebCore::DataDetection::detectItemAroundHitTestResult):
+        * platform/audio/ios/MediaSessionManagerIOS.mm:
+        (-[WebMediaSessionHelper allocateVolumeView]):
+        (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
+        * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
+        (WebCore::AudioSourceProviderAVFObjC::createMix):
+        * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
+        * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
+        (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::streamSession):
+        * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+        (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
+        (WebCore::SourceBufferPrivateAVFObjC::abort):
+        (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
+
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (PlatformCALayerMac::PlatformCALayerMac): Cast the result of +alloc to an instance of the
+        expected class.
+
+        * platform/graphics/mac/FontMac.mm:
+        (WebCore::showLetterpressedGlyphsWithAdvances):
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+        (WebCore::MediaPlayerPrivateQTKit::createQTMovie):
+        (WebCore::MediaPlayerPrivateQTKit::createQTMovieLayer):
+        * platform/graphics/mac/PDFDocumentImageMac.mm:
+        (WebCore::PDFDocumentImage::createPDFDocument):
+        * platform/ios/PlatformSpeechSynthesizerIOS.mm:
+        (SOFT_LINK_CONSTANT):
+        (-[WebSpeechSynthesisWrapper speakUtterance:]):
+        * platform/ios/WebCoreMotionManager.mm:
+        (-[WebCoreMotionManager initializeOnMainThread]):
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+        (-[WebAVPlayerController init]):
+        (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
+        * platform/mac/ContentFilterMac.mm:
+        (WebCore::ContentFilter::ContentFilter):
+
+        * platform/mac/SoftLinking.h: Added alloc##className##instance().
+
+        * platform/mac/WebVideoFullscreenController.mm:
+        (-[WebVideoFullscreenController setVideoElement:]):
+        * platform/mediastream/mac/AVAudioCaptureSource.mm:
+        (WebCore::AVAudioCaptureSource::setupCaptureSession):
+        * platform/mediastream/mac/AVCaptureDeviceManager.mm:
+        (WebCore::AVCaptureDeviceManager::verifyConstraintsForMediaType):
+        * platform/mediastream/mac/AVMediaCaptureSource.mm:
+        (WebCore::AVMediaCaptureSource::setupSession):
+        * platform/mediastream/mac/AVVideoCaptureSource.mm:
+        (WebCore::AVVideoCaptureSource::setupCaptureSession):
+        * platform/network/ios/QuickLook.mm:
+        (WebCore::registerQLPreviewConverterIfNeeded):
+        (WebCore::QuickLookHandle::QuickLookHandle):
+
 2014-12-07  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Add Since tags to GObject DOM bindings documentation

Modified: trunk/Source/WebCore/editing/mac/DataDetection.mm (176923 => 176924)


--- trunk/Source/WebCore/editing/mac/DataDetection.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/editing/mac/DataDetection.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -85,7 +85,7 @@
     if (!mainResult)
         return nullptr;
 
-    RetainPtr<DDActionContext> actionContext = adoptNS([[getDDActionContextClass() alloc] init]);
+    RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]);
     [actionContext setAllResults:@[ (id)mainResult ]];
     [actionContext setMainResult:mainResult];
 

Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -241,7 +241,7 @@
         });
     }
 
-    _volumeView = adoptNS([[getMPVolumeViewClass() alloc] init]);
+    _volumeView = adoptNS([allocMPVolumeViewInstance() init]);
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(wirelessRoutesAvailableDidChange:) name:MPVolumeViewWirelessRoutesAvailableDidChangeNotification object:_volumeView.get()];
     
 }
@@ -324,7 +324,7 @@
         if (strongSelf->_airPlayPresenceRoutingController)
             return;
 
-        strongSelf->_airPlayPresenceRoutingController = adoptNS([[getMPAVRoutingControllerClass() alloc] initWithName:@"WebCore - HTML media element checking for AirPlay route presence"]);
+        strongSelf->_airPlayPresenceRoutingController = adoptNS([allocMPAVRoutingControllerInstance() initWithName:@"WebCore - HTML media element checking for AirPlay route presence"]);
         [strongSelf->_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModePresence];
     });
 }

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -184,7 +184,7 @@
     ASSERT(m_avPlayerItem);
     ASSERT(m_client);
 
-    m_avAudioMix = adoptNS([(AVMutableAudioMix *)[getAVMutableAudioMixClass() alloc] init]);
+    m_avAudioMix = adoptNS([allocAVMutableAudioMixInstance() init]);
 
     MTAudioProcessingTapCallbacks callbacks = {
         0,
@@ -201,7 +201,7 @@
     ASSERT(tap);
     ASSERT(m_tap == tap);
 
-    RetainPtr<AVMutableAudioMixInputParameters> parameters = adoptNS([(AVMutableAudioMixInputParameters *)[getAVMutableAudioMixInputParametersClass() alloc] init]);
+    RetainPtr<AVMutableAudioMixInputParameters> parameters = adoptNS([allocAVMutableAudioMixInputParametersInstance() init]);
     [parameters setAudioTapProcessor:m_tap.get()];
 
     CMPersistentTrackID firstEnabledAudioTrackID = kCMPersistentTrackID_Invalid;

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -38,14 +38,14 @@
 #import <AVFoundation/AVFoundation.h>
 #import <objc/objc-runtime.h>
 
-namespace WebCore {
-
 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
 SOFT_LINK_CLASS(AVFoundation, AVURLAsset)
 SOFT_LINK_CLASS(AVFoundation, AVAssetResourceLoadingRequest)
 #define AVURLAsset getAVURLAssetClass()
 #define AVAssetResourceLoadingRequest getAVAssetResourceLoadingRequest()
 
+namespace WebCore {
+
 CDMSessionAVFoundationObjC::CDMSessionAVFoundationObjC(MediaPlayerPrivateAVFoundationObjC* parent)
     : m_parent(parent)
     , m_client(nullptr)

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -40,9 +40,6 @@
 
 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
 
-#define AVPlayer getAVPlayerClass()
-#define AVPlayerItem getAVPlayerItemClass()
-
 SOFT_LINK_CLASS(AVFoundation, AVPlayer)
 SOFT_LINK_CLASS(AVFoundation, AVPlayerItem)
 SOFT_LINK_CLASS(AVFoundation, AVMetadataItem)
@@ -65,6 +62,8 @@
 SOFT_LINK_POINTER(AVFoundation, AVMediaCharacteristicIsMainProgramContent, NSString *)
 SOFT_LINK_POINTER(AVFoundation, AVMediaCharacteristicEasyToRead, NSString *)
 
+#define AVPlayer getAVPlayerClass()
+#define AVPlayerItem getAVPlayerItemClass()
 #define AVMetadataItem getAVMetadataItemClass()
 #define AVPlayerItemLegibleOutput getAVPlayerItemLegibleOutputClass()
 #define AVMediaCharacteristicLegible getAVMediaCharacteristicLegible()

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -37,7 +37,6 @@
 #import <objc/runtime.h>
 
 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation)
-#define AVPlayerItem getAVPlayerItemClass()
 
 SOFT_LINK_CLASS(AVFoundation, AVPlayerItem)
 SOFT_LINK_CLASS(AVFoundation, AVMetadataItem)
@@ -48,6 +47,7 @@
 SOFT_LINK_POINTER(AVFoundation, AVMetadataCommonKeyTitle, NSString *)
 SOFT_LINK_POINTER(AVFoundation, AVMetadataKeySpaceCommon, NSString *)
 
+#define AVPlayerItem getAVPlayerItemClass()
 #define AVMetadataItem getAVMetadataItemClass()
 #define AVMediaCharacteristicLegible getAVMediaCharacteristicLegible()
 #define AVMetadataCommonKeyTitle getAVMetadataCommonKeyTitle()

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -613,7 +613,7 @@
     if (!m_avPlayer)
         return;
 
-    m_videoLayer = adoptNS([[AVPlayerLayer alloc] init]);
+    m_videoLayer = adoptNS([allocAVPlayerLayerInstance() init]);
     [m_videoLayer setPlayer:m_avPlayer.get()];
     [m_videoLayer setBackgroundColor:cachedCGColor(Color::black, ColorSpaceDeviceRGB)];
 #ifndef NDEBUG
@@ -838,7 +838,7 @@
 #endif
 
     NSURL *cocoaURL = canonicalURL(url);
-    m_avAsset = adoptNS([[AVURLAsset alloc] initWithURL:cocoaURL options:options.get()]);
+    m_avAsset = adoptNS([allocAVURLAssetInstance() initWithURL:cocoaURL options:options.get()]);
 
 #if HAVE(AVFOUNDATION_LOADER_DELEGATE)
     [[m_avAsset.get() resourceLoader] setDelegate:m_loaderDelegate.get() queue:globalLoaderDelegateQueue()];
@@ -875,7 +875,7 @@
 
     setDelayCallbacks(true);
 
-    m_avPlayer = adoptNS([[AVPlayer alloc] init]);
+    m_avPlayer = adoptNS([allocAVPlayerInstance() init]);
     [m_avPlayer.get() addObserver:m_objcObserver.get() forKeyPath:@"rate" options:NSKeyValueObservingOptionNew context:(void *)MediaPlayerAVFoundationObservationContextPlayer];
 #if ENABLE(IOS_AIRPLAY)
     [m_avPlayer.get() addObserver:m_objcObserver.get() forKeyPath:@"externalPlaybackActive" options:NSKeyValueObservingOptionNew context:(void *)MediaPlayerAVFoundationObservationContextPlayer];
@@ -909,7 +909,7 @@
     setDelayCallbacks(true);
 
     // Create the player item so we can load media data. 
-    m_avPlayerItem = adoptNS([[AVPlayerItem alloc] initWithAsset:m_avAsset.get()]);
+    m_avPlayerItem = adoptNS([allocAVPlayerItemInstance() initWithAsset:m_avAsset.get()]);
 
     [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(didEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:m_avPlayerItem.get()];
 
@@ -930,7 +930,7 @@
     const NSTimeInterval legibleOutputAdvanceInterval = 2;
 
     RetainPtr<NSArray> subtypes = adoptNS([[NSArray alloc] initWithObjects:[NSNumber numberWithUnsignedInt:kCMSubtitleFormatType_WebVTT], nil]);
-    m_legibleOutput = adoptNS([[AVPlayerItemLegibleOutput alloc] initWithMediaSubtypesForNativeRepresentation:subtypes.get()]);
+    m_legibleOutput = adoptNS([allocAVPlayerItemLegibleOutputInstance() initWithMediaSubtypesForNativeRepresentation:subtypes.get()]);
     [m_legibleOutput.get() setSuppressesPlayerRendering:YES];
 
     [m_legibleOutput.get() setDelegate:m_objcObserver.get() queue:dispatch_get_main_queue()];
@@ -2031,7 +2031,7 @@
     NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA], kCVPixelBufferPixelFormatTypeKey,
                                 nil];
 #endif
-    m_videoOutput = adoptNS([[getAVPlayerItemVideoOutputClass() alloc] initWithPixelBufferAttributes:attributes]);
+    m_videoOutput = adoptNS([allocAVPlayerItemVideoOutputInstance() initWithPixelBufferAttributes:attributes]);
     ASSERT(m_videoOutput);
 
     [m_videoOutput setDelegate:m_videoOutputDelegate.get() queue:globalPullDelegateQueue()];

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -143,7 +143,7 @@
 MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC(MediaPlayer* player)
     : m_player(player)
     , m_weakPtrFactory(this)
-    , m_synchronizer(adoptNS([[getAVSampleBufferRenderSynchronizerClass() alloc] init]))
+    , m_synchronizer(adoptNS([allocAVSampleBufferRenderSynchronizerInstance() init]))
     , m_seekTimer(*this, &MediaPlayerPrivateMediaSourceAVFObjC::seekTimerFired)
     , m_session(nullptr)
     , m_networkState(MediaPlayer::Empty)
@@ -607,7 +607,7 @@
     if (m_sampleBufferDisplayLayer)
         return;
 
-    m_sampleBufferDisplayLayer = adoptNS([[getAVSampleBufferDisplayLayerClass() alloc] init]);
+    m_sampleBufferDisplayLayer = adoptNS([allocAVSampleBufferDisplayLayerInstance() init]);
 #ifndef NDEBUG
     [m_sampleBufferDisplayLayer setName:@"MediaPlayerPrivateMediaSource AVSampleBufferDisplayLayer"];
 #endif
@@ -695,7 +695,7 @@
         }
 
         String storagePath = pathByAppendingComponent(storageDirectory, "SecureStop.plist");
-        m_streamSession = adoptNS([[getAVStreamSessionClass() alloc] initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]]);
+        m_streamSession = adoptNS([allocAVStreamSessionInstance() initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]]);
     }
     return m_streamSession.get();
 }

Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -580,7 +580,7 @@
 
 SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC(MediaSourcePrivateAVFObjC* parent)
     : m_weakFactory(this)
-    , m_parser(adoptNS([[getAVStreamDataParserClass() alloc] init]))
+    , m_parser(adoptNS([allocAVStreamDataParserInstance() init]))
     , m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:createWeakPtr()]))
     , m_errorListener(adoptNS([[WebAVSampleBufferErrorListener alloc] initWithParent:this]))
     , m_mediaSource(parent)
@@ -777,7 +777,7 @@
     // FIXME(135164): Support resetting parser to the last appended initialization segment.
     destroyParser();
 
-    m_parser = adoptNS([[getAVStreamDataParserClass() alloc] init]);
+    m_parser = adoptNS([allocAVStreamDataParserInstance() init]);
     m_delegate = adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:createWeakPtr()]);
 }
 
@@ -862,7 +862,7 @@
         m_enabledVideoTrackID = trackID;
         [m_parser setShouldProvideMediaData:YES forTrackID:trackID];
         if (!m_displayLayer) {
-            m_displayLayer = adoptNS([[getAVSampleBufferDisplayLayerClass() alloc] init]);
+            m_displayLayer = adoptNS([allocAVSampleBufferDisplayLayerInstance() init]);
             [m_displayLayer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^{
                 didBecomeReadyForMoreSamples(trackID);
             }];
@@ -886,7 +886,7 @@
         [m_parser setShouldProvideMediaData:YES forTrackID:trackID];
         RetainPtr<AVSampleBufferAudioRenderer> renderer;
         if (!m_audioRenderers.count(trackID)) {
-            renderer = adoptNS([[getAVSampleBufferAudioRendererClass() alloc] init]);
+            renderer = adoptNS([allocAVSampleBufferAudioRendererInstance() init]);
             [renderer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^{
                 didBecomeReadyForMoreSamples(trackID);
             }];

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -254,7 +254,7 @@
     }
 
     if (layerClass)
-        m_layer = adoptNS([[layerClass alloc] init]);
+        m_layer = adoptNS([(CALayer *)[layerClass alloc] init]);
 
     commonInit();
 }

Modified: trunk/Source/WebCore/platform/graphics/mac/FontMac.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -114,7 +114,7 @@
 
     static CUIStyleEffectConfiguration *styleConfiguration;
     if (!styleConfiguration) {
-        styleConfiguration = [(CUIStyleEffectConfiguration *)[getCUIStyleEffectConfigurationClass() alloc] init];
+        styleConfiguration = [allocCUIStyleEffectConfigurationInstance() init];
         styleConfiguration.useSimplifiedEffect = YES;
     }
 

Modified: trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -329,7 +329,7 @@
         return;
     
     NSError *error = nil;
-    m_qtMovie = adoptNS([[QTMovie alloc] initWithAttributes:movieAttributes error:&error]);
+    m_qtMovie = adoptNS([allocQTMovieInstance() initWithAttributes:movieAttributes error:&error]);
     
     if (!m_qtMovie)
         return;
@@ -425,7 +425,7 @@
     ASSERT(supportsAcceleratedRendering());
     
     if (!m_qtVideoLayer) {
-        m_qtVideoLayer = adoptNS([[QTMovieLayer alloc] init]);
+        m_qtVideoLayer = adoptNS([allocQTMovieLayerInstance() init]);
         if (!m_qtVideoLayer)
             return;
 

Modified: trunk/Source/WebCore/platform/graphics/mac/PDFDocumentImageMac.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/graphics/mac/PDFDocumentImageMac.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/graphics/mac/PDFDocumentImageMac.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -53,7 +53,7 @@
 
 void PDFDocumentImage::createPDFDocument()
 {
-    m_document = adoptNS([[getPDFDocumentClass() alloc] initWithData:data()->createNSData().get()]);
+    m_document = adoptNS([allocPDFDocumentInstance() initWithData:data()->createNSData().get()]);
 }
 
 void PDFDocumentImage::computeBoundsForCurrentPage()

Modified: trunk/Source/WebCore/platform/ios/PlatformSpeechSynthesizerIOS.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/ios/PlatformSpeechSynthesizerIOS.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/ios/PlatformSpeechSynthesizerIOS.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -46,7 +46,6 @@
 #define AVSpeechUtteranceDefaultSpeechRate getAVSpeechUtteranceDefaultSpeechRate()
 #define AVSpeechUtteranceMaximumSpeechRate getAVSpeechUtteranceMaximumSpeechRate()
 
-#define AVSpeechSynthesizerClass getAVSpeechSynthesizerClass()
 #define AVSpeechUtteranceClass getAVSpeechUtteranceClass()
 #define AVSpeechSynthesisVoiceClass getAVSpeechSynthesisVoiceClass()
 
@@ -97,7 +96,7 @@
         return;
     
     if (!m_synthesizer) {
-        m_synthesizer = adoptNS([(AVSpeechSynthesizer *)[AVSpeechSynthesizerClass alloc] init]);
+        m_synthesizer = adoptNS([allocAVSpeechSynthesizerInstance() init]);
         [m_synthesizer setDelegate:self];
     }
 

Modified: trunk/Source/WebCore/platform/ios/WebCoreMotionManager.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/ios/WebCoreMotionManager.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/ios/WebCoreMotionManager.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -138,7 +138,7 @@
 {
     ASSERT(!WebThreadIsCurrent());
 
-    m_motionManager = [(CMMotionManager *)[getCMMotionManagerClass() alloc] init];
+    m_motionManager = [allocCMMotionManagerInstance() init];
 
     m_gyroAvailable = m_motionManager.deviceMotionAvailable;
 
@@ -147,7 +147,7 @@
     else
         m_motionManager.accelerometerUpdateInterval = kMotionUpdateInterval;
 
-    m_locationManager = [(CLLocationManager *)[getCLLocationManagerClass() alloc] init];
+    m_locationManager = [allocCLLocationManagerInstance() init];
     m_headingAvailable = [getCLLocationManagerClass() headingAvailable];
 
     [self checkClientStatus];

Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -135,7 +135,7 @@
         return self;
     
     initAVPlayerController();
-    self.playerControllerProxy = [[[getAVPlayerControllerClass() alloc] init] autorelease];
+    self.playerControllerProxy = [[allocAVPlayerControllerInstance() init] autorelease];
     return self;
 }
 
@@ -801,9 +801,9 @@
         m_parentWindow = parentView.window;
 
         if (!applicationIsAdSheet()) {
-            m_window = adoptNS([[getUIWindowClass() alloc] initWithFrame:[[getUIScreenClass() mainScreen] bounds]]);
+            m_window = adoptNS([allocUIWindowInstance() initWithFrame:[[getUIScreenClass() mainScreen] bounds]]);
             [m_window setBackgroundColor:[getUIColorClass() clearColor]];
-            m_viewController = adoptNS([[getUIViewControllerClass() alloc] init]);
+            m_viewController = adoptNS([allocUIViewControllerInstance() init]);
             [[m_viewController view] setFrame:[m_window bounds]];
             [m_window setRootViewController:m_viewController.get()];
             [m_window makeKeyAndVisible];
@@ -819,7 +819,7 @@
         CGRect videoRect = CGRectMake(0, 0, videoSize.width, videoSize.height);
         [m_videoLayerContainer setVideoRect:videoRect];
 
-        m_playerViewController = adoptNS([[getAVPlayerViewControllerClass() alloc] initWithVideoLayer:m_videoLayerContainer.get()]);
+        m_playerViewController = adoptNS([allocAVPlayerViewControllerInstance() initWithVideoLayer:m_videoLayerContainer.get()]);
         [m_playerViewController setShowsPlaybackControls:NO];
         [m_playerViewController setPlayerController:(AVPlayerController *)playerController()];
         [m_playerViewController setDelegate:playerController()];

Modified: trunk/Source/WebCore/platform/mac/ContentFilterMac.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/mac/ContentFilterMac.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/mac/ContentFilterMac.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -100,11 +100,11 @@
 #endif
 {
     if ([getWebFilterEvaluatorClass() isManagedSession])
-        m_platformContentFilter = adoptNS([[getWebFilterEvaluatorClass() alloc] initWithResponse:response.nsURLResponse()]);
+        m_platformContentFilter = adoptNS([allocWebFilterEvaluatorInstance() initWithResponse:response.nsURLResponse()]);
 
 #if HAVE(NE_FILTER_SOURCE)
     if ([getNEFilterSourceClass() filterRequired]) {
-        m_neFilterSource = adoptNS([[getNEFilterSourceClass() alloc] initWithURL:[response.nsURLResponse() URL] direction:NEFilterSourceDirectionInbound socketIdentifier:0]);
+        m_neFilterSource = adoptNS([allocNEFilterSourceInstance() initWithURL:[response.nsURLResponse() URL] direction:NEFilterSourceDirectionInbound socketIdentifier:0]);
         m_neFilterSourceQueue = dispatch_queue_create("com.apple.WebCore.NEFilterSourceQueue", DISPATCH_QUEUE_SERIAL);
         
         long long expectedContentSize = [response.nsURLResponse() expectedContentLength];

Modified: trunk/Source/WebCore/platform/mac/SoftLinking.h (176923 => 176924)


--- trunk/Source/WebCore/platform/mac/SoftLinking.h	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/mac/SoftLinking.h	2014-12-07 17:28:01 UTC (rev 176924)
@@ -143,6 +143,7 @@
     }
 
 #define SOFT_LINK_CLASS(framework, className) \
+    @class className; \
     static Class init##className(); \
     static Class (*get##className##Class)() = init##className; \
     static Class class##className; \
@@ -159,9 +160,17 @@
         ASSERT(class##className); \
         get##className##Class = className##Function; \
         return class##className; \
-    }
+    } \
+    _Pragma("clang diagnostic push") \
+    _Pragma("clang diagnostic ignored \"-Wunused-function\"") \
+    static className *alloc##className##Instance() \
+    { \
+        return [get##className##Class() alloc]; \
+    } \
+    _Pragma("clang diagnostic pop")
 
 #define SOFT_LINK_CLASS_OPTIONAL(framework, className) \
+    @class className; \
     static Class init##className(); \
     static Class (*get##className##Class)() = init##className; \
     static Class class##className; \
@@ -177,7 +186,14 @@
         class##className = objc_getClass(#className); \
         get##className##Class = className##Function; \
         return class##className; \
-    }
+    } \
+    _Pragma("clang diagnostic push") \
+    _Pragma("clang diagnostic ignored \"-Wunused-function\"") \
+    static className *alloc##className##Instance() \
+    { \
+        return [get##className##Class() alloc]; \
+    } \
+    _Pragma("clang diagnostic pop")
 
 #define SOFT_LINK_POINTER(framework, name, type) \
     static type init##name(); \

Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -129,7 +129,7 @@
     if ([self isWindowLoaded]) {
         if (_videoElement->platformMedia().type == PlatformMedia::QTMovieType) {
             QTMovie *movie = _videoElement->platformMedia().media.qtMovie;
-            QTMovieLayer *layer = [[getQTMovieLayerClass() alloc] init];
+            QTMovieLayer *layer = [allocQTMovieLayerInstance() init];
             [layer setMovie:movie];
             [self setupVideoOverlay:layer];
 
@@ -140,7 +140,7 @@
 
         } else if (_videoElement->platformMedia().type == PlatformMedia::AVFoundationMediaPlayerType) {
             AVPlayer *player = _videoElement->platformMedia().media.avfMediaPlayer;
-            AVPlayerLayer *layer = [[getAVPlayerLayerClass() alloc] init];
+            AVPlayerLayer *layer = [allocAVPlayerLayerInstance() init];
             [self setupVideoOverlay:layer];
             [layer setPlayer:player];
 

Modified: trunk/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -51,12 +51,6 @@
 SOFT_LINK_CLASS(AVFoundation, AVCaptureDeviceInput)
 SOFT_LINK_CLASS(AVFoundation, AVCaptureOutput)
 
-#define AVCaptureAudioDataOutput getAVCaptureAudioDataOutputClass()
-#define AVCaptureConnection getAVCaptureConnectionClass()
-#define AVCaptureDevice getAVCaptureDeviceClass()
-#define AVCaptureDeviceInput getAVCaptureDeviceInputClass()
-#define AVCaptureOutput getAVCaptureOutputClass()
-
 SOFT_LINK_POINTER(AVFoundation, AVMediaTypeAudio, NSString *)
 
 #define AVMediaTypeAudio getAVMediaTypeAudio()
@@ -92,12 +86,12 @@
 
 void AVAudioCaptureSource::setupCaptureSession()
 {
-    RetainPtr<AVCaptureDeviceInputType> audioIn = adoptNS([[AVCaptureDeviceInput alloc] initWithDevice:device() error:nil]);
+    RetainPtr<AVCaptureDeviceInputType> audioIn = adoptNS([allocAVCaptureDeviceInputInstance() initWithDevice:device() error:nil]);
     ASSERT([session() canAddInput:audioIn.get()]);
     if ([session() canAddInput:audioIn.get()])
         [session() addInput:audioIn.get()];
     
-    RetainPtr<AVCaptureAudioDataOutputType> audioOutput = adoptNS([[AVCaptureAudioDataOutput alloc] init]);
+    RetainPtr<AVCaptureAudioDataOutputType> audioOutput = adoptNS([allocAVCaptureAudioDataOutputInstance() init]);
     setAudioSampleBufferDelegate(audioOutput.get());
     ASSERT([session() canAddOutput:audioOutput.get()]);
     if ([session() canAddOutput:audioOutput.get()])

Modified: trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -358,7 +358,7 @@
     Vector<MediaConstraint> mandatoryConstraints;
     constraints->getMandatoryConstraints(mandatoryConstraints);
     if (mandatoryConstraints.size()) {
-        RetainPtr<AVCaptureSessionType> session = adoptNS([[AVCaptureSession alloc] init]);
+        RetainPtr<AVCaptureSessionType> session = adoptNS([allocAVCaptureSessionInstance() init]);
         for (size_t i = 0; i < mandatoryConstraints.size(); ++i) {
             const MediaConstraint& constraint = mandatoryConstraints[i];
             if (!sessionSupportsConstraint(session.get(), type, constraint.m_name, constraint.m_value)) {

Modified: trunk/Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -177,7 +177,7 @@
     if (m_session)
         return;
 
-    m_session = adoptNS([[AVCaptureSession alloc] init]);
+    m_session = adoptNS([allocAVCaptureSessionInstance() init]);
     
     [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(captureSessionStoppedRunning:) name:AVCaptureSessionDidStopRunningNotification object:nil];
     

Modified: trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -208,7 +208,7 @@
 
 void AVVideoCaptureSource::setupCaptureSession()
 {
-    RetainPtr<AVCaptureDeviceInputType> videoIn = adoptNS([[AVCaptureDeviceInput alloc] initWithDevice:device() error:nil]);
+    RetainPtr<AVCaptureDeviceInputType> videoIn = adoptNS([allocAVCaptureDeviceInputInstance() initWithDevice:device() error:nil]);
     ASSERT([session() canAddInput:videoIn.get()]);
     if ([session() canAddInput:videoIn.get()])
         [session() addInput:videoIn.get()];
@@ -216,7 +216,7 @@
     if (constraints())
         applyConstraints(constraints());
 
-    RetainPtr<AVCaptureVideoDataOutputType> videoOutput = adoptNS([[AVCaptureVideoDataOutput alloc] init]);
+    RetainPtr<AVCaptureVideoDataOutputType> videoOutput = adoptNS([allocAVCaptureVideoDataOutputInstance() init]);
     setVideoSampleBufferDelegate(videoOutput.get());
     ASSERT([session() canAddOutput:videoOutput.get()]);
     if ([session() canAddOutput:videoOutput.get()])

Modified: trunk/Source/WebCore/platform/network/ios/QuickLook.mm (176923 => 176924)


--- trunk/Source/WebCore/platform/network/ios/QuickLook.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebCore/platform/network/ios/QuickLook.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -195,7 +195,7 @@
     if ([WebCore::QLPreviewGetSupportedMIMETypesSet() containsObject:updatedMIMEType.get()]) {
         RetainPtr<NSString> uti = adoptNS(WebCore::QLTypeCopyUTIForURLAndMimeType(url, updatedMIMEType.get()));
 
-        RetainPtr<id> converter = adoptNS([[QLPreviewConverterClass() alloc] initWithData:data name:nil uti:uti.get() options:nil]);
+        RetainPtr<id> converter = adoptNS([allocQLPreviewConverterInstance() initWithData:data name:nil uti:uti.get() options:nil]);
         NSURLRequest *request = [converter previewRequest];
 
         // We use [request URL] here instead of url since it will be
@@ -447,7 +447,7 @@
 
 QuickLookHandle::QuickLookHandle(NSURL *firstRequestURL, NSURLConnection *connection, NSURLResponse *nsResponse, id delegate)
     : m_firstRequestURL(firstRequestURL)
-    , m_converter(adoptNS([[QLPreviewConverterClass() alloc] initWithConnection:connection delegate:delegate response:nsResponse options:nil]))
+    , m_converter(adoptNS([allocQLPreviewConverterInstance() initWithConnection:connection delegate:delegate response:nsResponse options:nil]))
     , m_delegate(delegate)
     , m_finishedLoadingDataIntoConverter(false)
     , m_nsResponse([m_converter previewResponse])

Modified: trunk/Source/WebKit/ios/ChangeLog (176923 => 176924)


--- trunk/Source/WebKit/ios/ChangeLog	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebKit/ios/ChangeLog	2014-12-07 17:28:01 UTC (rev 176924)
@@ -1,3 +1,19 @@
+2014-12-07  Dan Bernstein  <m...@apple.com>
+
+        Introduce and deploy a function that allocates and returns an instance of a soft-linked class
+        https://bugs.webkit.org/show_bug.cgi?id=139348
+
+        Reviewed by Anders Carlsson.
+
+        In [[getFooClass() alloc] init*], the type of the result of +alloc is id, so the compiler
+        picks an arbitrary declaration of init*, not necessarily the Foo one. This can then lead
+        to warnings or errors if the types or attributes don’t match, or to runtime errors if Foo
+        doesn’t even have the expected initializer. The new allocFooInstance() returns a Foo *, thus
+        avoiding the ambiguity.
+
+        * Misc/WebGeolocationCoreLocationProvider.mm:
+        (-[WebGeolocationCoreLocationProvider createLocationManager]):
+
 2014-12-06  Anders Carlsson  <ander...@apple.com>
 
         Fix build with newer versions of clang.

Modified: trunk/Source/WebKit/ios/Misc/WebGeolocationCoreLocationProvider.mm (176923 => 176924)


--- trunk/Source/WebKit/ios/Misc/WebGeolocationCoreLocationProvider.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebKit/ios/Misc/WebGeolocationCoreLocationProvider.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -65,7 +65,7 @@
 {
     ASSERT(!_locationManager);
 
-    _locationManager = adoptNS([(CLLocationManager *)[getCLLocationManagerClass() alloc] init]);
+    _locationManager = adoptNS([allocCLLocationManagerInstance() init]);
     _lastAuthorizationStatus = [getCLLocationManagerClass() authorizationStatus];
 
     [ _locationManager setDelegate:self];

Modified: trunk/Source/WebKit/mac/ChangeLog (176923 => 176924)


--- trunk/Source/WebKit/mac/ChangeLog	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-12-07 17:28:01 UTC (rev 176924)
@@ -1,3 +1,19 @@
+2014-12-07  Dan Bernstein  <m...@apple.com>
+
+        Introduce and deploy a function that allocates and returns an instance of a soft-linked class
+        https://bugs.webkit.org/show_bug.cgi?id=139348
+
+        Reviewed by Anders Carlsson.
+
+        In [[getFooClass() alloc] init*], the type of the result of +alloc is id, so the compiler
+        picks an arbitrary declaration of init*, not necessarily the Foo one. This can then lead
+        to warnings or errors if the types or attributes don’t match, or to runtime errors if Foo
+        doesn’t even have the expected initializer. The new allocFooInstance() returns a Foo *, thus
+        avoiding the ambiguity.
+
+        * WebView/WebActionMenuController.mm:
+        (-[WebActionMenuController _defaultMenuItemsForDataDetectableLink]):
+
 2014-12-06  Anders Carlsson  <ander...@apple.com>
 
         Add a stubbed out version of WebStorageNamespaceProvider

Modified: trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm (176923 => 176924)


--- trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -292,7 +292,7 @@
     if (!node)
         return @[ ];
 
-    RetainPtr<DDActionContext> actionContext = [[getDDActionContextClass() alloc] init];
+    RetainPtr<DDActionContext> actionContext = [allocDDActionContextInstance() init];
 
     // FIXME: Should this show a yellow highlight?
     _currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {

Modified: trunk/Source/WebKit2/ChangeLog (176923 => 176924)


--- trunk/Source/WebKit2/ChangeLog	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebKit2/ChangeLog	2014-12-07 17:28:01 UTC (rev 176924)
@@ -1,3 +1,27 @@
+2014-12-07  Dan Bernstein  <m...@apple.com>
+
+        Introduce and deploy a function that allocates and returns an instance of a soft-linked class
+        https://bugs.webkit.org/show_bug.cgi?id=139348
+
+        Reviewed by Anders Carlsson.
+
+        In [[getFooClass() alloc] init*], the type of the result of +alloc is id, so the compiler
+        picks an arbitrary declaration of init*, not necessarily the Foo one. This can then lead
+        to warnings or errors if the types or attributes don’t match, or to runtime errors if Foo
+        doesn’t even have the expected initializer. The new allocFooInstance() returns a Foo *, thus
+        avoiding the ambiguity.
+
+        * UIProcess/ios/forms/WKAirPlayRoutePicker.mm:
+        (-[WKAirPlayRoutePicker showAirPlayPickerIPad:fromRect:]):
+        (-[WKAirPlayRoutePicker showAirPlayPickerIPhone:]):
+        (-[WKAirPlayRoutePicker show:fromRect:]):
+        * UIProcess/ios/forms/WKFileUploadPanel.mm:
+        (-[_WKVideoFileUploadItem displayImage]):
+        * UIProcess/mac/WKActionMenuController.mm:
+        (-[WKActionMenuController _defaultMenuItemsForDataDetectableLink]):
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:
+        (WebKit::PlatformCALayerRemoteCustom::clone):
+
 2014-12-06  Anders Carlsson  <ander...@apple.com>
 
         Fix build with newer versions of clang.

Modified: trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.mm (176923 => 176924)


--- trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -113,7 +113,7 @@
     if (_popoverController)
         return;
 
-    _popoverController = adoptNS([(MPAudioVideoRoutingPopoverController *)[getMPAudioVideoRoutingPopoverControllerClass() alloc] initWithType:itemType]);
+    _popoverController = adoptNS([allocMPAudioVideoRoutingPopoverControllerInstance() initWithType:itemType]);
     [_popoverController setDelegate:self];
 
     NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
@@ -128,7 +128,7 @@
     if (_actionSheet)
         return;
 
-    _actionSheet = adoptNS([(MPAudioVideoRoutingActionSheet *)[getMPAudioVideoRoutingActionSheetClass() alloc] initWithType:itemType]);
+    _actionSheet = adoptNS([allocMPAudioVideoRoutingActionSheetInstance() initWithType:itemType]);
 
     [_actionSheet
         showWithValidInterfaceOrientationMaskBlock:^UIInterfaceOrientationMask {
@@ -143,7 +143,7 @@
 
 - (void)show:(BOOL)hasVideo fromRect:(CGRect)elementRect
 {
-    _routingController = adoptNS([(MPAVRoutingController *)[getMPAVRoutingControllerClass() alloc] initWithName:@"WebKit2 - HTML media element showing AirPlay route picker"]);
+    _routingController = adoptNS([allocMPAVRoutingControllerInstance() initWithName:@"WebKit2 - HTML media element showing AirPlay route picker"]);
     [_routingController setDiscoveryMode:MPRouteDiscoveryModeDetailed];
 
     MPAVItemType itemType = hasVideo ? MPAVItemTypeVideo : MPAVItemTypeAudio;

Modified: trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm (176923 => 176924)


--- trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -56,8 +56,6 @@
 SOFT_LINK_FRAMEWORK(AVFoundation);
 SOFT_LINK_CLASS(AVFoundation, AVAssetImageGenerator);
 SOFT_LINK_CLASS(AVFoundation, AVURLAsset);
-#define AVAssetImageGenerator_class getAVAssetImageGeneratorClass()
-#define AVURLAsset_class getAVURLAssetClass()
 
 SOFT_LINK_FRAMEWORK(CoreMedia);
 SOFT_LINK_CONSTANT(CoreMedia, kCMTimeZero, CMTime);
@@ -207,8 +205,8 @@
 
 - (UIImage *)displayImage
 {
-    RetainPtr<AVURLAsset> asset = adoptNS([[AVURLAsset_class alloc] initWithURL:_mediaURL.get() options:nil]);
-    RetainPtr<AVAssetImageGenerator> generator = adoptNS([[AVAssetImageGenerator_class alloc] initWithAsset:asset.get()]);
+    RetainPtr<AVURLAsset> asset = adoptNS([allocAVURLAssetInstance() initWithURL:_mediaURL.get() options:nil]);
+    RetainPtr<AVAssetImageGenerator> generator = adoptNS([allocAVAssetImageGeneratorInstance() initWithAsset:asset.get()]);
     [generator setAppliesPreferredTrackTransform:YES];
 
     NSError *error = nil;

Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (176923 => 176924)


--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -864,7 +864,7 @@
 - (NSArray *)_defaultMenuItemsForDataDetectableLink
 {
     RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
-    RetainPtr<DDActionContext> actionContext = [[getDDActionContextClass() alloc] init];
+    RetainPtr<DDActionContext> actionContext = [allocDDActionContextInstance() init];
 
     // FIXME: Should this show a yellow highlight?
     _currentActionContext = [actionContext contextForView:_wkView altMode:YES interactionStartedHandler:^() {

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm (176923 => 176924)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm	2014-12-07 16:23:31 UTC (rev 176923)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm	2014-12-07 17:28:01 UTC (rev 176924)
@@ -104,7 +104,7 @@
     bool copyContents = true;
 
     if (layerType() == LayerTypeAVPlayerLayer) {
-        clonedLayer = adoptNS([[getAVPlayerLayerClass() alloc] init]);
+        clonedLayer = adoptNS([allocAVPlayerLayerInstance() init]);
 
         AVPlayerLayer* destinationPlayerLayer = static_cast<AVPlayerLayer *>(clonedLayer.get());
         AVPlayerLayer* sourcePlayerLayer = static_cast<AVPlayerLayer *>(platformLayer());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to