Changeset 176924 in webkit
- Timestamp:
- Dec 7, 2014 9:28:01 AM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r176920 r176924 1 2014-12-07 Dan Bernstein <mitz@apple.com> 2 3 Introduce and deploy a function that allocates and returns an instance of a soft-linked class 4 https://bugs.webkit.org/show_bug.cgi?id=139348 5 6 Reviewed by Anders Carlsson. 7 8 In [[getFooClass() alloc] init*], the type of the result of +alloc is id, so the compiler 9 picks an arbitrary declaration of init*, not necessarily the Foo one. This can then lead 10 to warnings or errors if the types or attributes don’t match, or to runtime errors if Foo 11 doesn’t even have the expected initializer. The new allocFooInstance() returns a Foo *, thus 12 avoiding the ambiguity. 13 14 * editing/mac/DataDetection.mm: 15 (WebCore::DataDetection::detectItemAroundHitTestResult): 16 * platform/audio/ios/MediaSessionManagerIOS.mm: 17 (-[WebMediaSessionHelper allocateVolumeView]): 18 (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]): 19 * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm: 20 (WebCore::AudioSourceProviderAVFObjC::createMix): 21 * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm: 22 * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm: 23 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 24 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): 25 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): 26 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): 27 (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem): 28 (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput): 29 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: 30 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC): 31 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): 32 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::streamSession): 33 * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: 34 (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): 35 (WebCore::SourceBufferPrivateAVFObjC::abort): 36 (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled): 37 38 * platform/graphics/ca/mac/PlatformCALayerMac.mm: 39 (PlatformCALayerMac::PlatformCALayerMac): Cast the result of +alloc to an instance of the 40 expected class. 41 42 * platform/graphics/mac/FontMac.mm: 43 (WebCore::showLetterpressedGlyphsWithAdvances): 44 * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: 45 (WebCore::MediaPlayerPrivateQTKit::createQTMovie): 46 (WebCore::MediaPlayerPrivateQTKit::createQTMovieLayer): 47 * platform/graphics/mac/PDFDocumentImageMac.mm: 48 (WebCore::PDFDocumentImage::createPDFDocument): 49 * platform/ios/PlatformSpeechSynthesizerIOS.mm: 50 (SOFT_LINK_CONSTANT): 51 (-[WebSpeechSynthesisWrapper speakUtterance:]): 52 * platform/ios/WebCoreMotionManager.mm: 53 (-[WebCoreMotionManager initializeOnMainThread]): 54 * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: 55 (-[WebAVPlayerController init]): 56 (WebVideoFullscreenInterfaceAVKit::setupFullscreen): 57 * platform/mac/ContentFilterMac.mm: 58 (WebCore::ContentFilter::ContentFilter): 59 60 * platform/mac/SoftLinking.h: Added alloc##className##instance(). 61 62 * platform/mac/WebVideoFullscreenController.mm: 63 (-[WebVideoFullscreenController setVideoElement:]): 64 * platform/mediastream/mac/AVAudioCaptureSource.mm: 65 (WebCore::AVAudioCaptureSource::setupCaptureSession): 66 * platform/mediastream/mac/AVCaptureDeviceManager.mm: 67 (WebCore::AVCaptureDeviceManager::verifyConstraintsForMediaType): 68 * platform/mediastream/mac/AVMediaCaptureSource.mm: 69 (WebCore::AVMediaCaptureSource::setupSession): 70 * platform/mediastream/mac/AVVideoCaptureSource.mm: 71 (WebCore::AVVideoCaptureSource::setupCaptureSession): 72 * platform/network/ios/QuickLook.mm: 73 (WebCore::registerQLPreviewConverterIfNeeded): 74 (WebCore::QuickLookHandle::QuickLookHandle): 75 1 76 2014-12-07 Carlos Garcia Campos <cgarcia@igalia.com> 2 77 -
trunk/Source/WebCore/editing/mac/DataDetection.mm
r176156 r176924 86 86 return nullptr; 87 87 88 RetainPtr<DDActionContext> actionContext = adoptNS([ [getDDActionContextClass() alloc]init]);88 RetainPtr<DDActionContext> actionContext = adoptNS([allocDDActionContextInstance() init]); 89 89 [actionContext setAllResults:@[ (id)mainResult ]]; 90 90 [actionContext setMainResult:mainResult]; -
trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
r176471 r176924 242 242 } 243 243 244 _volumeView = adoptNS([ [getMPVolumeViewClass() alloc]init]);244 _volumeView = adoptNS([allocMPVolumeViewInstance() init]); 245 245 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(wirelessRoutesAvailableDidChange:) name:MPVolumeViewWirelessRoutesAvailableDidChangeNotification object:_volumeView.get()]; 246 246 … … 325 325 return; 326 326 327 strongSelf->_airPlayPresenceRoutingController = adoptNS([ [getMPAVRoutingControllerClass() alloc]initWithName:@"WebCore - HTML media element checking for AirPlay route presence"]);327 strongSelf->_airPlayPresenceRoutingController = adoptNS([allocMPAVRoutingControllerInstance() initWithName:@"WebCore - HTML media element checking for AirPlay route presence"]); 328 328 [strongSelf->_airPlayPresenceRoutingController setDiscoveryMode:MPRouteDiscoveryModePresence]; 329 329 }); -
trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm
r176910 r176924 185 185 ASSERT(m_client); 186 186 187 m_avAudioMix = adoptNS([ (AVMutableAudioMix *)[getAVMutableAudioMixClass() alloc]init]);187 m_avAudioMix = adoptNS([allocAVMutableAudioMixInstance() init]); 188 188 189 189 MTAudioProcessingTapCallbacks callbacks = { … … 202 202 ASSERT(m_tap == tap); 203 203 204 RetainPtr<AVMutableAudioMixInputParameters> parameters = adoptNS([ (AVMutableAudioMixInputParameters *)[getAVMutableAudioMixInputParametersClass() alloc]init]);204 RetainPtr<AVMutableAudioMixInputParameters> parameters = adoptNS([allocAVMutableAudioMixInputParametersInstance() init]); 205 205 [parameters setAudioTapProcessor:m_tap.get()]; 206 206 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm
r164514 r176924 39 39 #import <objc/objc-runtime.h> 40 40 41 namespace WebCore {42 43 41 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation) 44 42 SOFT_LINK_CLASS(AVFoundation, AVURLAsset) … … 46 44 #define AVURLAsset getAVURLAssetClass() 47 45 #define AVAssetResourceLoadingRequest getAVAssetResourceLoadingRequest() 46 47 namespace WebCore { 48 48 49 49 CDMSessionAVFoundationObjC::CDMSessionAVFoundationObjC(MediaPlayerPrivateAVFoundationObjC* parent) -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm
r170379 r176924 41 41 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation) 42 42 43 #define AVPlayer getAVPlayerClass()44 #define AVPlayerItem getAVPlayerItemClass()45 46 43 SOFT_LINK_CLASS(AVFoundation, AVPlayer) 47 44 SOFT_LINK_CLASS(AVFoundation, AVPlayerItem) … … 66 63 SOFT_LINK_POINTER(AVFoundation, AVMediaCharacteristicEasyToRead, NSString *) 67 64 65 #define AVPlayer getAVPlayerClass() 66 #define AVPlayerItem getAVPlayerItemClass() 68 67 #define AVMetadataItem getAVMetadataItemClass() 69 68 #define AVPlayerItemLegibleOutput getAVPlayerItemLegibleOutputClass() -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm
r170379 r176924 38 38 39 39 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation) 40 #define AVPlayerItem getAVPlayerItemClass()41 40 42 41 SOFT_LINK_CLASS(AVFoundation, AVPlayerItem) … … 49 48 SOFT_LINK_POINTER(AVFoundation, AVMetadataKeySpaceCommon, NSString *) 50 49 50 #define AVPlayerItem getAVPlayerItemClass() 51 51 #define AVMetadataItem getAVMetadataItemClass() 52 52 #define AVMediaCharacteristicLegible getAVMediaCharacteristicLegible() -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r176725 r176924 614 614 return; 615 615 616 m_videoLayer = adoptNS([ [AVPlayerLayer alloc]init]);616 m_videoLayer = adoptNS([allocAVPlayerLayerInstance() init]); 617 617 [m_videoLayer setPlayer:m_avPlayer.get()]; 618 618 [m_videoLayer setBackgroundColor:cachedCGColor(Color::black, ColorSpaceDeviceRGB)]; … … 839 839 840 840 NSURL *cocoaURL = canonicalURL(url); 841 m_avAsset = adoptNS([ [AVURLAsset alloc]initWithURL:cocoaURL options:options.get()]);841 m_avAsset = adoptNS([allocAVURLAssetInstance() initWithURL:cocoaURL options:options.get()]); 842 842 843 843 #if HAVE(AVFOUNDATION_LOADER_DELEGATE) … … 876 876 setDelayCallbacks(true); 877 877 878 m_avPlayer = adoptNS([ [AVPlayer alloc]init]);878 m_avPlayer = adoptNS([allocAVPlayerInstance() init]); 879 879 [m_avPlayer.get() addObserver:m_objcObserver.get() forKeyPath:@"rate" options:NSKeyValueObservingOptionNew context:(void *)MediaPlayerAVFoundationObservationContextPlayer]; 880 880 #if ENABLE(IOS_AIRPLAY) … … 910 910 911 911 // Create the player item so we can load media data. 912 m_avPlayerItem = adoptNS([ [AVPlayerItem alloc]initWithAsset:m_avAsset.get()]);912 m_avPlayerItem = adoptNS([allocAVPlayerItemInstance() initWithAsset:m_avAsset.get()]); 913 913 914 914 [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(didEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:m_avPlayerItem.get()]; … … 931 931 932 932 RetainPtr<NSArray> subtypes = adoptNS([[NSArray alloc] initWithObjects:[NSNumber numberWithUnsignedInt:kCMSubtitleFormatType_WebVTT], nil]); 933 m_legibleOutput = adoptNS([ [AVPlayerItemLegibleOutput alloc]initWithMediaSubtypesForNativeRepresentation:subtypes.get()]);933 m_legibleOutput = adoptNS([allocAVPlayerItemLegibleOutputInstance() initWithMediaSubtypesForNativeRepresentation:subtypes.get()]); 934 934 [m_legibleOutput.get() setSuppressesPlayerRendering:YES]; 935 935 … … 2032 2032 nil]; 2033 2033 #endif 2034 m_videoOutput = adoptNS([ [getAVPlayerItemVideoOutputClass() alloc]initWithPixelBufferAttributes:attributes]);2034 m_videoOutput = adoptNS([allocAVPlayerItemVideoOutputInstance() initWithPixelBufferAttributes:attributes]); 2035 2035 ASSERT(m_videoOutput); 2036 2036 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
r176459 r176924 144 144 : m_player(player) 145 145 , m_weakPtrFactory(this) 146 , m_synchronizer(adoptNS([ [getAVSampleBufferRenderSynchronizerClass() alloc]init]))146 , m_synchronizer(adoptNS([allocAVSampleBufferRenderSynchronizerInstance() init])) 147 147 , m_seekTimer(*this, &MediaPlayerPrivateMediaSourceAVFObjC::seekTimerFired) 148 148 , m_session(nullptr) … … 608 608 return; 609 609 610 m_sampleBufferDisplayLayer = adoptNS([ [getAVSampleBufferDisplayLayerClass() alloc]init]);610 m_sampleBufferDisplayLayer = adoptNS([allocAVSampleBufferDisplayLayerInstance() init]); 611 611 #ifndef NDEBUG 612 612 [m_sampleBufferDisplayLayer setName:@"MediaPlayerPrivateMediaSource AVSampleBufferDisplayLayer"]; … … 696 696 697 697 String storagePath = pathByAppendingComponent(storageDirectory, "SecureStop.plist"); 698 m_streamSession = adoptNS([ [getAVStreamSessionClass() alloc]initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]]);698 m_streamSession = adoptNS([allocAVStreamSessionInstance() initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]]); 699 699 } 700 700 return m_streamSession.get(); -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
r175284 r176924 581 581 SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC(MediaSourcePrivateAVFObjC* parent) 582 582 : m_weakFactory(this) 583 , m_parser(adoptNS([ [getAVStreamDataParserClass() alloc]init]))583 , m_parser(adoptNS([allocAVStreamDataParserInstance() init])) 584 584 , m_delegate(adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:createWeakPtr()])) 585 585 , m_errorListener(adoptNS([[WebAVSampleBufferErrorListener alloc] initWithParent:this])) … … 778 778 destroyParser(); 779 779 780 m_parser = adoptNS([ [getAVStreamDataParserClass() alloc]init]);780 m_parser = adoptNS([allocAVStreamDataParserInstance() init]); 781 781 m_delegate = adoptNS([[WebAVStreamDataParserListener alloc] initWithParser:m_parser.get() parent:createWeakPtr()]); 782 782 } … … 863 863 [m_parser setShouldProvideMediaData:YES forTrackID:trackID]; 864 864 if (!m_displayLayer) { 865 m_displayLayer = adoptNS([ [getAVSampleBufferDisplayLayerClass() alloc]init]);865 m_displayLayer = adoptNS([allocAVSampleBufferDisplayLayerInstance() init]); 866 866 [m_displayLayer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^{ 867 867 didBecomeReadyForMoreSamples(trackID); … … 887 887 RetainPtr<AVSampleBufferAudioRenderer> renderer; 888 888 if (!m_audioRenderers.count(trackID)) { 889 renderer = adoptNS([ [getAVSampleBufferAudioRendererClass() alloc]init]);889 renderer = adoptNS([allocAVSampleBufferAudioRendererInstance() init]); 890 890 [renderer requestMediaDataWhenReadyOnQueue:dispatch_get_main_queue() usingBlock:^{ 891 891 didBecomeReadyForMoreSamples(trackID); -
trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
r176204 r176924 255 255 256 256 if (layerClass) 257 m_layer = adoptNS([ [layerClass alloc] init]);257 m_layer = adoptNS([(CALayer *)[layerClass alloc] init]); 258 258 259 259 commonInit(); -
trunk/Source/WebCore/platform/graphics/mac/FontMac.mm
r176910 r176924 115 115 static CUIStyleEffectConfiguration *styleConfiguration; 116 116 if (!styleConfiguration) { 117 styleConfiguration = [ (CUIStyleEffectConfiguration *)[getCUIStyleEffectConfigurationClass() alloc]init];117 styleConfiguration = [allocCUIStyleEffectConfigurationInstance() init]; 118 118 styleConfiguration.useSimplifiedEffect = YES; 119 119 } -
trunk/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
r176459 r176924 330 330 331 331 NSError *error = nil; 332 m_qtMovie = adoptNS([ [QTMovie alloc]initWithAttributes:movieAttributes error:&error]);332 m_qtMovie = adoptNS([allocQTMovieInstance() initWithAttributes:movieAttributes error:&error]); 333 333 334 334 if (!m_qtMovie) … … 426 426 427 427 if (!m_qtVideoLayer) { 428 m_qtVideoLayer = adoptNS([ [QTMovieLayer alloc]init]);428 m_qtVideoLayer = adoptNS([allocQTMovieLayerInstance() init]); 429 429 if (!m_qtVideoLayer) 430 430 return; -
trunk/Source/WebCore/platform/graphics/mac/PDFDocumentImageMac.mm
r161568 r176924 54 54 void PDFDocumentImage::createPDFDocument() 55 55 { 56 m_document = adoptNS([ [getPDFDocumentClass() alloc]initWithData:data()->createNSData().get()]);56 m_document = adoptNS([allocPDFDocumentInstance() initWithData:data()->createNSData().get()]); 57 57 } 58 58 -
trunk/Source/WebCore/platform/ios/PlatformSpeechSynthesizerIOS.mm
r176910 r176924 47 47 #define AVSpeechUtteranceMaximumSpeechRate getAVSpeechUtteranceMaximumSpeechRate() 48 48 49 #define AVSpeechSynthesizerClass getAVSpeechSynthesizerClass()50 49 #define AVSpeechUtteranceClass getAVSpeechUtteranceClass() 51 50 #define AVSpeechSynthesisVoiceClass getAVSpeechSynthesisVoiceClass() … … 98 97 99 98 if (!m_synthesizer) { 100 m_synthesizer = adoptNS([ (AVSpeechSynthesizer *)[AVSpeechSynthesizerClass alloc]init]);99 m_synthesizer = adoptNS([allocAVSpeechSynthesizerInstance() init]); 101 100 [m_synthesizer setDelegate:self]; 102 101 } -
trunk/Source/WebCore/platform/ios/WebCoreMotionManager.mm
r176910 r176924 139 139 ASSERT(!WebThreadIsCurrent()); 140 140 141 m_motionManager = [ (CMMotionManager *)[getCMMotionManagerClass() alloc]init];141 m_motionManager = [allocCMMotionManagerInstance() init]; 142 142 143 143 m_gyroAvailable = m_motionManager.deviceMotionAvailable; … … 148 148 m_motionManager.accelerometerUpdateInterval = kMotionUpdateInterval; 149 149 150 m_locationManager = [ (CLLocationManager *)[getCLLocationManagerClass() alloc]init];150 m_locationManager = [allocCLLocationManagerInstance() init]; 151 151 m_headingAvailable = [getCLLocationManagerClass() headingAvailable]; 152 152 -
trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm
r176841 r176924 136 136 137 137 initAVPlayerController(); 138 self.playerControllerProxy = [[ [getAVPlayerControllerClass() alloc]init] autorelease];138 self.playerControllerProxy = [[allocAVPlayerControllerInstance() init] autorelease]; 139 139 return self; 140 140 } … … 802 802 803 803 if (!applicationIsAdSheet()) { 804 m_window = adoptNS([ [getUIWindowClass() alloc]initWithFrame:[[getUIScreenClass() mainScreen] bounds]]);804 m_window = adoptNS([allocUIWindowInstance() initWithFrame:[[getUIScreenClass() mainScreen] bounds]]); 805 805 [m_window setBackgroundColor:[getUIColorClass() clearColor]]; 806 m_viewController = adoptNS([ [getUIViewControllerClass() alloc]init]);806 m_viewController = adoptNS([allocUIViewControllerInstance() init]); 807 807 [[m_viewController view] setFrame:[m_window bounds]]; 808 808 [m_window setRootViewController:m_viewController.get()]; … … 820 820 [m_videoLayerContainer setVideoRect:videoRect]; 821 821 822 m_playerViewController = adoptNS([ [getAVPlayerViewControllerClass() alloc]initWithVideoLayer:m_videoLayerContainer.get()]);822 m_playerViewController = adoptNS([allocAVPlayerViewControllerInstance() initWithVideoLayer:m_videoLayerContainer.get()]); 823 823 [m_playerViewController setShowsPlaybackControls:NO]; 824 824 [m_playerViewController setPlayerController:(AVPlayerController *)playerController()]; -
trunk/Source/WebCore/platform/mac/ContentFilterMac.mm
r172293 r176924 101 101 { 102 102 if ([getWebFilterEvaluatorClass() isManagedSession]) 103 m_platformContentFilter = adoptNS([ [getWebFilterEvaluatorClass() alloc]initWithResponse:response.nsURLResponse()]);103 m_platformContentFilter = adoptNS([allocWebFilterEvaluatorInstance() initWithResponse:response.nsURLResponse()]); 104 104 105 105 #if HAVE(NE_FILTER_SOURCE) 106 106 if ([getNEFilterSourceClass() filterRequired]) { 107 m_neFilterSource = adoptNS([ [getNEFilterSourceClass() alloc]initWithURL:[response.nsURLResponse() URL] direction:NEFilterSourceDirectionInbound socketIdentifier:0]);107 m_neFilterSource = adoptNS([allocNEFilterSourceInstance() initWithURL:[response.nsURLResponse() URL] direction:NEFilterSourceDirectionInbound socketIdentifier:0]); 108 108 m_neFilterSourceQueue = dispatch_queue_create("com.apple.WebCore.NEFilterSourceQueue", DISPATCH_QUEUE_SERIAL); 109 109 -
trunk/Source/WebCore/platform/mac/SoftLinking.h
r175000 r176924 144 144 145 145 #define SOFT_LINK_CLASS(framework, className) \ 146 @class className; \ 146 147 static Class init##className(); \ 147 148 static Class (*get##className##Class)() = init##className; \ … … 160 161 get##className##Class = className##Function; \ 161 162 return class##className; \ 162 } 163 } \ 164 _Pragma("clang diagnostic push") \ 165 _Pragma("clang diagnostic ignored \"-Wunused-function\"") \ 166 static className *alloc##className##Instance() \ 167 { \ 168 return [get##className##Class() alloc]; \ 169 } \ 170 _Pragma("clang diagnostic pop") 163 171 164 172 #define SOFT_LINK_CLASS_OPTIONAL(framework, className) \ 173 @class className; \ 165 174 static Class init##className(); \ 166 175 static Class (*get##className##Class)() = init##className; \ … … 178 187 get##className##Class = className##Function; \ 179 188 return class##className; \ 180 } 189 } \ 190 _Pragma("clang diagnostic push") \ 191 _Pragma("clang diagnostic ignored \"-Wunused-function\"") \ 192 static className *alloc##className##Instance() \ 193 { \ 194 return [get##className##Class() alloc]; \ 195 } \ 196 _Pragma("clang diagnostic pop") 181 197 182 198 #define SOFT_LINK_POINTER(framework, name, type) \ -
trunk/Source/WebCore/platform/mac/WebVideoFullscreenController.mm
r173230 r176924 130 130 if (_videoElement->platformMedia().type == PlatformMedia::QTMovieType) { 131 131 QTMovie *movie = _videoElement->platformMedia().media.qtMovie; 132 QTMovieLayer *layer = [ [getQTMovieLayerClass() alloc]init];132 QTMovieLayer *layer = [allocQTMovieLayerInstance() init]; 133 133 [layer setMovie:movie]; 134 134 [self setupVideoOverlay:layer]; … … 141 141 } else if (_videoElement->platformMedia().type == PlatformMedia::AVFoundationMediaPlayerType) { 142 142 AVPlayer *player = _videoElement->platformMedia().media.avfMediaPlayer; 143 AVPlayerLayer *layer = [ [getAVPlayerLayerClass() alloc]init];143 AVPlayerLayer *layer = [allocAVPlayerLayerInstance() init]; 144 144 [self setupVideoOverlay:layer]; 145 145 [layer setPlayer:player]; -
trunk/Source/WebCore/platform/mediastream/mac/AVAudioCaptureSource.mm
r165676 r176924 52 52 SOFT_LINK_CLASS(AVFoundation, AVCaptureOutput) 53 53 54 #define AVCaptureAudioDataOutput getAVCaptureAudioDataOutputClass()55 #define AVCaptureConnection getAVCaptureConnectionClass()56 #define AVCaptureDevice getAVCaptureDeviceClass()57 #define AVCaptureDeviceInput getAVCaptureDeviceInputClass()58 #define AVCaptureOutput getAVCaptureOutputClass()59 60 54 SOFT_LINK_POINTER(AVFoundation, AVMediaTypeAudio, NSString *) 61 55 … … 93 87 void AVAudioCaptureSource::setupCaptureSession() 94 88 { 95 RetainPtr<AVCaptureDeviceInputType> audioIn = adoptNS([ [AVCaptureDeviceInput alloc]initWithDevice:device() error:nil]);89 RetainPtr<AVCaptureDeviceInputType> audioIn = adoptNS([allocAVCaptureDeviceInputInstance() initWithDevice:device() error:nil]); 96 90 ASSERT([session() canAddInput:audioIn.get()]); 97 91 if ([session() canAddInput:audioIn.get()]) 98 92 [session() addInput:audioIn.get()]; 99 93 100 RetainPtr<AVCaptureAudioDataOutputType> audioOutput = adoptNS([ [AVCaptureAudioDataOutput alloc]init]);94 RetainPtr<AVCaptureAudioDataOutputType> audioOutput = adoptNS([allocAVCaptureAudioDataOutputInstance() init]); 101 95 setAudioSampleBufferDelegate(audioOutput.get()); 102 96 ASSERT([session() canAddOutput:audioOutput.get()]); -
trunk/Source/WebCore/platform/mediastream/mac/AVCaptureDeviceManager.mm
r168367 r176924 359 359 constraints->getMandatoryConstraints(mandatoryConstraints); 360 360 if (mandatoryConstraints.size()) { 361 RetainPtr<AVCaptureSessionType> session = adoptNS([ [AVCaptureSession alloc]init]);361 RetainPtr<AVCaptureSessionType> session = adoptNS([allocAVCaptureSessionInstance() init]); 362 362 for (size_t i = 0; i < mandatoryConstraints.size(); ++i) { 363 363 const MediaConstraint& constraint = mandatoryConstraints[i]; -
trunk/Source/WebCore/platform/mediastream/mac/AVMediaCaptureSource.mm
r168367 r176924 178 178 return; 179 179 180 m_session = adoptNS([ [AVCaptureSession alloc]init]);180 m_session = adoptNS([allocAVCaptureSessionInstance() init]); 181 181 182 182 [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(captureSessionStoppedRunning:) name:AVCaptureSessionDidStopRunningNotification object:nil]; -
trunk/Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
r165676 r176924 209 209 void AVVideoCaptureSource::setupCaptureSession() 210 210 { 211 RetainPtr<AVCaptureDeviceInputType> videoIn = adoptNS([ [AVCaptureDeviceInput alloc]initWithDevice:device() error:nil]);211 RetainPtr<AVCaptureDeviceInputType> videoIn = adoptNS([allocAVCaptureDeviceInputInstance() initWithDevice:device() error:nil]); 212 212 ASSERT([session() canAddInput:videoIn.get()]); 213 213 if ([session() canAddInput:videoIn.get()]) … … 217 217 applyConstraints(constraints()); 218 218 219 RetainPtr<AVCaptureVideoDataOutputType> videoOutput = adoptNS([ [AVCaptureVideoDataOutput alloc]init]);219 RetainPtr<AVCaptureVideoDataOutputType> videoOutput = adoptNS([allocAVCaptureVideoDataOutputInstance() init]); 220 220 setVideoSampleBufferDelegate(videoOutput.get()); 221 221 ASSERT([session() canAddOutput:videoOutput.get()]); -
trunk/Source/WebCore/platform/network/ios/QuickLook.mm
r176142 r176924 196 196 RetainPtr<NSString> uti = adoptNS(WebCore::QLTypeCopyUTIForURLAndMimeType(url, updatedMIMEType.get())); 197 197 198 RetainPtr<id> converter = adoptNS([ [QLPreviewConverterClass() alloc]initWithData:data name:nil uti:uti.get() options:nil]);198 RetainPtr<id> converter = adoptNS([allocQLPreviewConverterInstance() initWithData:data name:nil uti:uti.get() options:nil]); 199 199 NSURLRequest *request = [converter previewRequest]; 200 200 … … 448 448 QuickLookHandle::QuickLookHandle(NSURL *firstRequestURL, NSURLConnection *connection, NSURLResponse *nsResponse, id delegate) 449 449 : m_firstRequestURL(firstRequestURL) 450 , m_converter(adoptNS([ [QLPreviewConverterClass() alloc]initWithConnection:connection delegate:delegate response:nsResponse options:nil]))450 , m_converter(adoptNS([allocQLPreviewConverterInstance() initWithConnection:connection delegate:delegate response:nsResponse options:nil])) 451 451 , m_delegate(delegate) 452 452 , m_finishedLoadingDataIntoConverter(false) -
trunk/Source/WebKit/ios/ChangeLog
r176912 r176924 1 2014-12-07 Dan Bernstein <mitz@apple.com> 2 3 Introduce and deploy a function that allocates and returns an instance of a soft-linked class 4 https://bugs.webkit.org/show_bug.cgi?id=139348 5 6 Reviewed by Anders Carlsson. 7 8 In [[getFooClass() alloc] init*], the type of the result of +alloc is id, so the compiler 9 picks an arbitrary declaration of init*, not necessarily the Foo one. This can then lead 10 to warnings or errors if the types or attributes don’t match, or to runtime errors if Foo 11 doesn’t even have the expected initializer. The new allocFooInstance() returns a Foo *, thus 12 avoiding the ambiguity. 13 14 * Misc/WebGeolocationCoreLocationProvider.mm: 15 (-[WebGeolocationCoreLocationProvider createLocationManager]): 16 1 17 2014-12-06 Anders Carlsson <andersca@apple.com> 2 18 -
trunk/Source/WebKit/ios/Misc/WebGeolocationCoreLocationProvider.mm
r176912 r176924 66 66 ASSERT(!_locationManager); 67 67 68 _locationManager = adoptNS([ (CLLocationManager *)[getCLLocationManagerClass() alloc]init]);68 _locationManager = adoptNS([allocCLLocationManagerInstance() init]); 69 69 _lastAuthorizationStatus = [getCLLocationManagerClass() authorizationStatus]; 70 70 -
trunk/Source/WebKit/mac/ChangeLog
r176913 r176924 1 2014-12-07 Dan Bernstein <mitz@apple.com> 2 3 Introduce and deploy a function that allocates and returns an instance of a soft-linked class 4 https://bugs.webkit.org/show_bug.cgi?id=139348 5 6 Reviewed by Anders Carlsson. 7 8 In [[getFooClass() alloc] init*], the type of the result of +alloc is id, so the compiler 9 picks an arbitrary declaration of init*, not necessarily the Foo one. This can then lead 10 to warnings or errors if the types or attributes don’t match, or to runtime errors if Foo 11 doesn’t even have the expected initializer. The new allocFooInstance() returns a Foo *, thus 12 avoiding the ambiguity. 13 14 * WebView/WebActionMenuController.mm: 15 (-[WebActionMenuController _defaultMenuItemsForDataDetectableLink]): 16 1 17 2014-12-06 Anders Carlsson <andersca@apple.com> 2 18 -
trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm
r176777 r176924 293 293 return @[ ]; 294 294 295 RetainPtr<DDActionContext> actionContext = [ [getDDActionContextClass() alloc]init];295 RetainPtr<DDActionContext> actionContext = [allocDDActionContextInstance() init]; 296 296 297 297 // FIXME: Should this show a yellow highlight? -
trunk/Source/WebKit2/ChangeLog
r176915 r176924 1 2014-12-07 Dan Bernstein <mitz@apple.com> 2 3 Introduce and deploy a function that allocates and returns an instance of a soft-linked class 4 https://bugs.webkit.org/show_bug.cgi?id=139348 5 6 Reviewed by Anders Carlsson. 7 8 In [[getFooClass() alloc] init*], the type of the result of +alloc is id, so the compiler 9 picks an arbitrary declaration of init*, not necessarily the Foo one. This can then lead 10 to warnings or errors if the types or attributes don’t match, or to runtime errors if Foo 11 doesn’t even have the expected initializer. The new allocFooInstance() returns a Foo *, thus 12 avoiding the ambiguity. 13 14 * UIProcess/ios/forms/WKAirPlayRoutePicker.mm: 15 (-[WKAirPlayRoutePicker showAirPlayPickerIPad:fromRect:]): 16 (-[WKAirPlayRoutePicker showAirPlayPickerIPhone:]): 17 (-[WKAirPlayRoutePicker show:fromRect:]): 18 * UIProcess/ios/forms/WKFileUploadPanel.mm: 19 (-[_WKVideoFileUploadItem displayImage]): 20 * UIProcess/mac/WKActionMenuController.mm: 21 (-[WKActionMenuController _defaultMenuItemsForDataDetectableLink]): 22 * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm: 23 (WebKit::PlatformCALayerRemoteCustom::clone): 24 1 25 2014-12-06 Anders Carlsson <andersca@apple.com> 2 26 -
trunk/Source/WebKit2/UIProcess/ios/forms/WKAirPlayRoutePicker.mm
r176448 r176924 114 114 return; 115 115 116 _popoverController = adoptNS([ (MPAudioVideoRoutingPopoverController *)[getMPAudioVideoRoutingPopoverControllerClass() alloc]initWithType:itemType]);116 _popoverController = adoptNS([allocMPAudioVideoRoutingPopoverControllerInstance() initWithType:itemType]); 117 117 [_popoverController setDelegate:self]; 118 118 … … 129 129 return; 130 130 131 _actionSheet = adoptNS([ (MPAudioVideoRoutingActionSheet *)[getMPAudioVideoRoutingActionSheetClass() alloc]initWithType:itemType]);131 _actionSheet = adoptNS([allocMPAudioVideoRoutingActionSheetInstance() initWithType:itemType]); 132 132 133 133 [_actionSheet … … 144 144 - (void)show:(BOOL)hasVideo fromRect:(CGRect)elementRect 145 145 { 146 _routingController = adoptNS([ (MPAVRoutingController *)[getMPAVRoutingControllerClass() alloc]initWithName:@"WebKit2 - HTML media element showing AirPlay route picker"]);146 _routingController = adoptNS([allocMPAVRoutingControllerInstance() initWithName:@"WebKit2 - HTML media element showing AirPlay route picker"]); 147 147 [_routingController setDiscoveryMode:MPRouteDiscoveryModeDetailed]; 148 148 -
trunk/Source/WebKit2/UIProcess/ios/forms/WKFileUploadPanel.mm
r170952 r176924 57 57 SOFT_LINK_CLASS(AVFoundation, AVAssetImageGenerator); 58 58 SOFT_LINK_CLASS(AVFoundation, AVURLAsset); 59 #define AVAssetImageGenerator_class getAVAssetImageGeneratorClass()60 #define AVURLAsset_class getAVURLAssetClass()61 59 62 60 SOFT_LINK_FRAMEWORK(CoreMedia); … … 208 206 - (UIImage *)displayImage 209 207 { 210 RetainPtr<AVURLAsset> asset = adoptNS([ [AVURLAsset_class alloc]initWithURL:_mediaURL.get() options:nil]);211 RetainPtr<AVAssetImageGenerator> generator = adoptNS([ [AVAssetImageGenerator_class alloc]initWithAsset:asset.get()]);208 RetainPtr<AVURLAsset> asset = adoptNS([allocAVURLAssetInstance() initWithURL:_mediaURL.get() options:nil]); 209 RetainPtr<AVAssetImageGenerator> generator = adoptNS([allocAVAssetImageGeneratorInstance() initWithAsset:asset.get()]); 212 210 [generator setAppliesPreferredTrackTransform:YES]; 213 211 -
trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm
r176883 r176924 865 865 { 866 866 RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult]; 867 RetainPtr<DDActionContext> actionContext = [ [getDDActionContextClass() alloc]init];867 RetainPtr<DDActionContext> actionContext = [allocDDActionContextInstance() init]; 868 868 869 869 // FIXME: Should this show a yellow highlight? -
trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm
r173702 r176924 105 105 106 106 if (layerType() == LayerTypeAVPlayerLayer) { 107 clonedLayer = adoptNS([ [getAVPlayerLayerClass() alloc]init]);107 clonedLayer = adoptNS([allocAVPlayerLayerInstance() init]); 108 108 109 109 AVPlayerLayer* destinationPlayerLayer = static_cast<AVPlayerLayer *>(clonedLayer.get());
Note: See TracChangeset
for help on using the changeset viewer.