https://bugs.webkit.org/show_bug.cgi?id=115307
Reviewed by Geoffrey Garen.
Source/JavaScriptCore:
* heap/HeapTimer.cpp:
(JSC::HeapTimer::HeapTimer):
* runtime/VM.cpp:
(JSC::enableAssembler):
Use adoptCF free function.
Source/WebCore:
This change was done by a global replace followed by compiling and inspecting for
cases that needed to be tweaked by hand.
* accessibility/ios/AXObjectCacheIOS.mm:
(WebCore::AXObjectCache::attachWrapper):
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::attachWrapper):
* bridge/objc/objc_class.mm:
(JSC::Bindings::ObjcClass::methodNamed):
(JSC::Bindings::ObjcClass::fieldNamed):
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::ObjcField::ObjcField):
* editing/mac/EditorMac.mm:
(WebCore::Editor::fontAttributesForSelectionStart):
* history/cf/HistoryPropertyList.cpp:
(WebCore::HistoryPropertyListWriter::releaseData):
* html/HTMLMediaElement.cpp:
(WebCore::createFileURLForApplicationCacheResource):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::createPropertyListRepresentation):
(WebCore::LegacyWebArchive::create):
(WebCore::LegacyWebArchive::rawDataRepresentation):
* loader/archive/cf/LegacyWebArchiveMac.mm:
(WebCore::LegacyWebArchive::createPropertyListRepresentation):
* loader/mac/ResourceLoaderMac.mm:
(WebCore::ResourceLoader::willCacheResponse):
* page/CaptionUserPreferencesMac.mm:
(WebCore::CaptionUserPreferencesMac::userPrefersCaptions):
(WebCore::CaptionUserPreferencesMac::userPrefersSubtitles):
(WebCore::CaptionUserPreferencesMac::captionsWindowCSS):
(WebCore::CaptionUserPreferencesMac::captionsBackgroundCSS):
(WebCore::CaptionUserPreferencesMac::captionsTextColor):
(WebCore::CaptionUserPreferencesMac::captionsDefaultFontCSS):
(WebCore::CaptionUserPreferencesMac::preferredLanguages):
(WebCore::trackDisplayName):
* platform/Language.cpp:
(WebCore::displayNameForLanguageLocale):
* platform/LocalizedStrings.cpp:
(WebCore::contextMenuItemTagSearchWeb):
(WebCore::imageTitle):
* platform/MIMETypeRegistry.cpp:
(WebCore::initializeSupportedImageMIMETypes):
(WebCore::initializeSupportedImageMIMETypesForEncoding):
* platform/audio/mac/AudioFileReaderMac.cpp:
(WebCore::AudioFileReader::AudioFileReader):
* platform/cf/KURLCFNet.cpp:
(WebCore::KURL::fileSystemPath):
* platform/cf/SharedBufferCF.cpp:
(WebCore::SharedBuffer::maybeTransferPlatformData):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
(WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setContentsToImage):
* platform/graphics/ca/mac/LayerFlushSchedulerMac.cpp:
(WebCore::LayerFlushScheduler::schedule):
* platform/graphics/ca/mac/PlatformCAAnimationMac.mm:
(PlatformCAAnimation::PlatformCAAnimation):
* platform/graphics/ca/mac/PlatformCAFiltersMac.mm:
(PlatformCAFilters::filterValueForOperation):
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayer::PlatformCALayer):
(PlatformCALayer::addAnimationForKey):
(PlatformCALayer::setBackgroundColor):
(PlatformCALayer::setBorderColor):
* platform/graphics/cg/BitmapImageCG.cpp:
(WebCore::BitmapImage::checkForSolidColor):
(WebCore::BitmapImage::getCGImageArray):
* platform/graphics/cg/ColorCG.cpp:
(WebCore::cachedCGColor):
* platform/graphics/cg/GraphicsContext3DCG.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::applyStrokePattern):
(WebCore::GraphicsContext::applyFillPattern):
(WebCore::GraphicsContext::setURLForRect):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::createIOSurface):
(WebCore::ImageBuffer::ImageBuffer):
(WebCore::ImageBuffer::copyImage):
(WebCore::ImageBuffer::draw):
(WebCore::ImageBuffer::clip):
(WebCore::ImageBuffer::putByteArray):
(WebCore::CGImageEncodeToData):
(WebCore::CGImageToDataURL):
(WebCore::ImageBuffer::toDataURL):
(WebCore::ImageDataToDataURL):
* platform/graphics/cg/ImageBufferDataCG.cpp:
(WebCore::ImageBufferData::getData):
(WebCore::ImageBufferData::putData):
* platform/graphics/cg/ImageCG.cpp:
(WebCore::Image::imageWithColorSpace):
(WebCore::Image::drawPattern):
* platform/graphics/cg/ImageSourceCG.cpp:
(WebCore::ImageSource::setData):
(WebCore::ImageSource::isSizeAvailable):
(WebCore::ImageSource::frameSizeAtIndex):
(WebCore::ImageSource::orientationAtIndex):
(WebCore::ImageSource::getHotSpot):
(WebCore::ImageSource::repetitionCount):
(WebCore::ImageSource::createFrameAtIndex):
(WebCore::ImageSource::frameDurationAtIndex):
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::dataChanged):
* platform/graphics/cg/PathCG.cpp:
(WebCore::createScratchContext):
(WebCore::Path::contains):
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::setFont):
(WebCore::createFeatureSettingDictionary):
(WebCore::cascadeToLastResortFontDescriptor):
(WebCore::cascadeToLastResortAndDisableSwashesFontDescriptor):
(WebCore::FontPlatformData::ctFont):
(WebCore::FontPlatformData::description):
* platform/graphics/gpu/mac/DrawingBufferMac.mm:
(WebCore::DrawingBuffer::DrawingBuffer):
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(-[WebCascadeList objectAtIndex:]):
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* platform/graphics/mac/FontCustomPlatformData.cpp:
(WebCore::createFontCustomPlatformData):
* platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
(WebCore::GlyphPage::fill):
* platform/graphics/mac/GraphicsContext3DMac.mm:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/mac/GraphicsContextMac.mm:
(WebCore::GraphicsContext::drawFocusRing):
(WebCore::linearRGBColorSpaceRef):
* platform/graphics/mac/ImageMac.mm:
(WebCore::BitmapImage::getTIFFRepresentation):
(WebCore::BitmapImage::getNSImage):
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit):
(WebCore::MediaPlayerPrivateQTKit::createQTMovie):
(WebCore::MediaPlayerPrivateQTKit::createQTMovieView):
(WebCore::MediaPlayerPrivateQTKit::createQTVideoRenderer):
(WebCore::MediaPlayerPrivateQTKit::createQTMovieLayer):
(WebCore::MediaPlayerPrivateQTKit::setPreservesPitch):
(WebCore::addFileTypesToCache):
* platform/graphics/mac/SimpleFontDataCoreText.cpp:
(WebCore::SimpleFontData::getCFStringAttributes):
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::fontHasVerticalGlyphs):
(WebCore::SimpleFontData::getCompositeFontReferenceFontData):
(WebCore::SimpleFontData::platformCharWidthInit):
(WebCore::SimpleFontData::canRenderCombiningCharacterSequence):
* platform/graphics/mac/WebGLLayer.mm:
(-[WebGLLayer copyImageSnapshotWithColorSpace:]):
* platform/mac/ContentFilterMac.mm:
(WebCore::ContentFilter::ContentFilter):
* platform/mac/ContextMenuItemMac.mm:
(WebCore::ContextMenuItem::ContextMenuItem):
* platform/mac/CursorMac.mm:
(WebCore::createCustomCursor):
(WebCore::createNamedCursor):
* platform/mac/DisplaySleepDisabler.cpp:
(WebCore::DisplaySleepDisabler::DisplaySleepDisabler):
* platform/mac/DragImageMac.mm:
(WebCore::dissolveDragImageToFraction):
(WebCore::createDragImageFromImage):
* platform/mac/HTMLConverter.mm:
(+[WebHTMLConverter editingAttributedStringFromRange:]):
* platform/mac/Language.mm:
(WebCore::httpStyleLanguageCode):
(WebCore::platformUserPreferredLanguages):
* platform/mac/LocalizedStringsMac.cpp:
(WebCore::localizedString):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::getDataSelection):
(WebCore::Pasteboard::writeSelectionForTypes):
(WebCore::fragmentFromWebArchive):
* platform/mac/PlatformClockCM.mm:
(PlatformClockCM::PlatformClockCM):
(PlatformClockCM::initializeWithTimingSource):
* platform/mac/PlatformPasteboardMac.mm:
(WebCore::PlatformPasteboard::addTypes):
(WebCore::PlatformPasteboard::setTypes):
(WebCore::PlatformPasteboard::setPathnamesForType):
* platform/mac/PlatformSpeechSynthesizerMac.mm:
(WebCore::PlatformSpeechSynthesizer::speak):
* platform/mac/PopupMenuMac.mm:
(WebCore::PopupMenuMac::populate):
(WebCore::PopupMenuMac::show):
* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollbarPainterDelegate setUpAlphaAnimation:scrollerPainter:part:WebCore::animateAlphaTo:duration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
(-[WebScrollbarPainterDelegate scrollerImp:animateExpansionTransitionWithDuration:]):
(WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
(WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
(WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
* platform/mac/SharedBufferMac.mm:
(WebCore::SharedBuffer::createCFData):
* platform/mac/WebCoreNSStringExtras.mm:
(stringEncodingForResource):
* platform/network/ProtectionSpace.cpp:
(WebCore::ProtectionSpace::receivesCredentialSecurely):
* platform/network/SynchronousLoaderClient.cpp:
(WebCore::SynchronousLoaderClient::platformBadResponseError):
* platform/network/cf/CredentialStorageCFNet.cpp:
(WebCore::CredentialStorage::getFromPersistentStorage):
* platform/network/cf/DNSCFNet.cpp:
(WebCore::DNSResolveQueue::platformProxyIsEnabledInSystemPreferences):
* platform/network/cf/FormDataStreamCFNet.cpp:
(WebCore::advanceCurrentStream):
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::overrideCookieStorage):
* platform/network/cf/ProxyServerCFNet.cpp:
(WebCore::proxyAutoConfigurationResultCallback):
(WebCore::processProxyServers):
(WebCore::addProxyServersForURL):
* platform/network/cf/ResourceErrorCF.cpp:
(WebCore::ResourceError::platformLazyInit):
(WebCore::ResourceError::cfError):
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::willSendRequest):
(WebCore::ResourceHandle::createCFURLConnection):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::handleDataArray):
* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::setHeaderFields):
(WebCore::ResourceRequest::doUpdatePlatformRequest):
(WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
(WebCore::ResourceRequest::doUpdateResourceRequest):
(WebCore::ResourceRequest::setStorageSession):
* platform/network/cf/ResourceResponseCFNet.cpp:
(WebCore::ResourceResponse::cfURLResponse):
(WebCore::ResourceResponse::platformLazyInit):
* platform/network/cf/SocketStreamHandleCFNet.cpp:
(WebCore::SocketStreamHandle::SocketStreamHandle):
(WebCore::SocketStreamHandle::executePACFileURL):
(WebCore::SocketStreamHandle::chooseProxy):
(WebCore::SocketStreamHandle::createStreams):
(WebCore::SocketStreamHandle::addCONNECTCredentials):
(WebCore::SocketStreamHandle::readStreamCallback):
(WebCore::SocketStreamHandle::writeStreamCallback):
(WebCore::SocketStreamHandle::reportErrorToClient):
* platform/network/mac/AuthenticationMac.mm:
(WebCore::mac):
(WebCore::AuthenticationChallenge::setAuthenticationClient):
* platform/network/mac/CookieJarMac.mm:
(WebCore::filterCookies):
* platform/network/mac/NetworkStateNotifierMac.cpp:
(WebCore::NetworkStateNotifier::updateState):
(WebCore::NetworkStateNotifier::NetworkStateNotifier):
* platform/network/mac/ResourceErrorMac.mm:
(WebCore::createNSErrorFromResourceErrorBase):
(WebCore::ResourceError::nsError):
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::createNSURLConnection):
* platform/network/mac/ResourceRequestMac.mm:
(WebCore::ResourceRequest::updateNSURLRequest):
(WebCore::ResourceRequest::doUpdatePlatformRequest):
(WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
(WebCore::ResourceRequest::setStorageSession):
* platform/network/mac/ResourceResponseMac.mm:
(WebCore::ResourceResponse::initNSURLResponse):
(WebCore::ResourceResponse::nsURLResponse):
(WebCore::ResourceResponse::platformLazyInit):
* platform/network/mac/UTIUtilities.mm:
(WebCore::mimeTypeFromUTITree):
* platform/network/mac/WebCoreURLResponse.mm:
(WebCore::adjustMIMETypeIfNecessary):
* platform/text/cf/HyphenationCF.cpp:
(WebCore::::createValueForNullKey):
(WebCore::lastHyphenLocation):
* platform/text/mac/HyphenationMac.mm:
(WebCore::::createValueForKey):
(WebCore::lastHyphenLocation):
* platform/text/mac/LocaleMac.mm:
(WebCore::determineLocale):
(WebCore::LocaleMac::LocaleMac):
(WebCore::LocaleMac::initializeLocaleData):
* platform/text/mac/TextBreakIteratorInternalICUMac.mm:
(WebCore::textBreakLocalePreference):
(WebCore::canonicalLanguageIdentifier):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::RenderThemeMac):
(WebCore::RenderThemeMac::levelIndicatorFor):
(WebCore::RenderThemeMac::paintMenuListButtonGradients):
(WebCore::RenderThemeMac::paintSliderTrack):
(WebCore::RenderThemeMac::popupButton):
(WebCore::RenderThemeMac::search):
(WebCore::RenderThemeMac::searchMenuTemplate):
(WebCore::RenderThemeMac::sliderThumbHorizontal):
(WebCore::RenderThemeMac::sliderThumbVertical):
(WebCore::RenderThemeMac::textField):
Use adoptNS and adoptCF free functions.
Source/WebKit/cf:
* WebCoreSupport/WebInspectorClientCF.cpp:
(populateSetting): Use adoptCF.
Source/WebKit/mac:
This change was done by a global replace followed by compiling and inspecting for
cases that needed to be tweaked by hand.
* DefaultDelegates/WebDefaultContextMenuDelegate.mm:
(-[WebDefaultUIDelegate menuItemWithTag:target:representedObject:]):
* Misc/WebNSFileManagerExtras.mm:
(-[NSFileManager _webkit_startupVolumeName]):
* Plugins/Hosted/HostedNetscapePluginStream.mm:
(WebKit::HostedNetscapePluginStream::HostedNetscapePluginStream):
* Plugins/Hosted/NetscapePluginHostManager.mm:
(WebKit::NetscapePluginHostManager::spawnPluginHost):
(WebKit::NetscapePluginHostManager::instantiatePlugin):
* Plugins/Hosted/NetscapePluginHostProxy.mm:
(WebKit::NetscapePluginHostProxy::NetscapePluginHostProxy):
(WebKit::NetscapePluginHostProxy::beginModal):
(WKPCBooleanAndDataReply):
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::print):
(WebKit::NetscapePluginInstanceProxy::snapshot):
(WebKit::NetscapePluginInstanceProxy::status):
(WebKit::NetscapePluginInstanceProxy::loadURL):
(WebKit::NetscapePluginInstanceProxy::evaluateJavaScript):
(WebKit::NetscapePluginInstanceProxy::enumerate):
(WebKit::NetscapePluginInstanceProxy::marshalValue):
(WebKit::NetscapePluginInstanceProxy::marshalValues):
(WebKit::NetscapePluginInstanceProxy::demarshalValue):
(WebKit::NetscapePluginInstanceProxy::demarshalValues):
* Plugins/Hosted/WebHostedNetscapePluginView.mm:
(-[WebHostedNetscapePluginView setAttributeKeys:andValues:]):
(-[WebHostedNetscapePluginView createPlugin]):
* Plugins/WebBaseNetscapePluginView.mm:
(-[WebBaseNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:WebCore::]):
(-[WebBaseNetscapePluginView cacheSnapshot]):
(WebKit::getAuthenticationInfo):
* Plugins/WebBasePluginPackage.mm:
(-[WebBasePluginPackage initWithPath:]):
* Plugins/WebNetscapePluginEventHandlerCarbon.mm:
(WebNetscapePluginEventHandlerCarbon::startTimers):
* Plugins/WebNetscapePluginEventHandlerCocoa.mm:
(WebNetscapePluginEventHandlerCocoa::syntheticKeyDownWithCommandModifier):
(WebNetscapePluginEventHandlerCocoa::handleTSMEvent):
* Plugins/WebNetscapePluginPackage.mm:
(-[WebNetscapePluginPackage _initWithPath:]):
* Plugins/WebNetscapePluginStream.mm:
(WebNetscapePluginStream::WebNetscapePluginStream):
(WebNetscapePluginStream::deliverData):
(WebNetscapePluginStream::deliverDataToFile):
(WebNetscapePluginStream::didReceiveData):
* Plugins/WebNetscapePluginView.mm:
(-[WebNetscapePluginView createPlugin]):
(-[WebNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:WebCore::]):
(-[WebNetscapePluginView evaluateJavaScriptPluginRequest:]):
* Storage/WebDatabaseManagerClient.mm:
(WebDatabaseManagerClient::dispatchDidModifyOrigin):
(WebDatabaseManagerClient::dispatchDidModifyDatabase):
* Storage/WebStorageTrackerClient.mm:
(WebStorageTrackerClient::dispatchDidModifyOrigin):
* WebCoreSupport/CorrectionPanel.mm:
(CorrectionPanel::handleAcceptedReplacement):
* WebCoreSupport/WebApplicationCache.mm:
(+[WebApplicationCache originsWithCache]):
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::didRunInsecureContent):
* WebCoreSupport/WebInspectorClient.mm:
(WebInspectorClient::WebInspectorClient):
(WebInspectorClient::openInspectorFrontend):
* WebView/WebFullScreenController.mm:
(-[WebFullScreenController enterFullScreen:]):
* WebView/WebPDFDocumentExtras.mm:
(allScriptsInPDFDocument):
* WebView/WebPreferences.mm:
(-[WebPreferences initWithIdentifier:]):
(-[WebPreferences initWithCoder:]):
* WebView/WebScriptDebugger.mm:
(WebScriptDebugger::initGlobalCallFrame):
(WebScriptDebugger::callEvent):
* WebView/WebView.mm:
(-[WebView previousValidKeyView]):
Use adoptNS and adoptCF free functions.
Source/WebKit2:
This change was done by a global replace followed by compiling and inspecting for
cases that needed to be tweaked by hand.
* Platform/cg/CGUtilities.cpp:
(WebKit::paintBitmapContext):
* Platform/mac/ModuleMac.mm:
(WebKit::Module::load):
(WebKit::Module::platformFunctionPointer):
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::PluginProcess::initializeSandbox):
* Shared/API/c/mac/WKURLRequestNS.mm:
(WKURLRequestCreateWithNSURLRequest):
* Shared/API/c/mac/WKURLResponseNS.mm:
(WKURLResponseCreateWithNSURLResponse):
* Shared/Downloads/mac/DownloadMac.mm:
(WebKit::Download::start):
(WebKit::Download::startWithHandle):
* Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h:
(WebKit::ChildProcessMain):
* Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
(WebKit::getPluginArchitecture):
(WebKit::contentsOfPropertyListAtURL):
(WebKit::getMIMETypesFromPluginBundle):
(WebKit::getStringListResource):
(WebKit::NetscapePluginModule::getPluginInfo):
* Shared/ShareableResource.cpp:
(WebKit::ShareableResource::Handle::tryWrapInSharedBuffer):
* Shared/cf/ArgumentCodersCF.cpp:
(CoreIPC::decode):
(CoreIPC::encode):
* Shared/cg/ShareableBitmapCG.cpp:
(WebKit::ShareableBitmap::createGraphicsContext):
(WebKit::ShareableBitmap::makeCGImageCopy):
(WebKit::ShareableBitmap::makeCGImage):
(WebKit::ShareableBitmap::createCGImage):
* Shared/mac/ArgumentCodersMac.mm:
(CoreIPC::decode):
* Shared/mac/PlatformCertificateInfo.mm:
(WebKit::PlatformCertificateInfo::dump):
* Shared/mac/WebCoreArgumentCodersMac.mm:
(CoreIPC::::encodePlatformData):
(CoreIPC::::decodePlatformData):
* UIProcess/API/mac/FindIndicatorWindow.mm:
(WebKit::FindIndicatorWindow::setFindIndicator):
(WebKit::FindIndicatorWindow::startFadeOutTimerFired):
* UIProcess/API/mac/PDFViewController.mm:
(-[WKPDFView initWithFrame:PDFViewController:]):
(WebKit::PDFViewController::PDFViewController):
(WebKit::convertPostScriptDataSourceToPDF):
(WebKit::PDFViewController::setPDFDocumentData):
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::PageClientImpl):
(WebKit::PageClientImpl::registerEditCommand):
(WebKit::PageClientImpl::setDragImage):
* UIProcess/API/mac/WKBrowsingContextController.mm:
(didFailProvisionalLoadWithErrorForFrame):
(didFailLoadWithErrorForFrame):
* UIProcess/API/mac/WKConnection.mm:
(didReceiveMessage):
* UIProcess/API/mac/WKPrintingView.mm:
(-[WKPrintingView drawRect:]):
* UIProcess/API/mac/WKView.mm:
(-[WKView browsingContextController]):
(-[WKView _setAcceleratedCompositingModeRootLayer:]):
(-[WKView _setPromisedData:WebCore::withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:WebCore::forPasteboard:]):
(-[WKView namesOfPromisedFilesDroppedAtDestination:]):
(-[WKView fullScreenWindowController]):
(-[WKView _executeSavedCommandBySelector:]):
(-[WKView printOperationWithPrintInfo:forFrame:]):
* UIProcess/Launcher/mac/ProcessLauncherMac.mm:
(WebKit::createProcess):
* UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
(WebKit::PluginInfoStore::pluginPathsInDirectory):
(WebKit::PluginInfoStore::getMIMETypeForExtension):
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::PluginProcessProxy::beginModal):
* UIProcess/cf/WebBackForwardListCF.cpp:
(WebKit::WebBackForwardList::createCFDictionaryRepresentation):
* UIProcess/cf/WebPageProxyCF.cpp:
(WebKit::WebPageProxy::sessionStateData):
(WebKit::WebPageProxy::restoreFromSessionStateData):
(WebKit::WebPageProxy::saveRecentSearches):
(WebKit::WebPageProxy::loadRecentSearches):
* UIProcess/cf/WebPreferencesCF.cpp:
(WebKit::cfStringFromWebCoreString):
(WebKit::setStringValueIfInUserDefaults):
(WebKit::setBoolValueIfInUserDefaults):
(WebKit::setUInt32ValueIfInUserDefaults):
(WebKit::setDoubleValueIfInUserDefaults):
(WebKit::WebPreferences::platformUpdateUInt32ValueForKey):
(WebKit::WebPreferences::platformUpdateDoubleValueForKey):
(WebKit::WebPreferences::platformUpdateFloatValueForKey):
* UIProcess/mac/BackingStoreMac.mm:
(WebKit::BackingStore::resetScrolledRect):
(WebKit::BackingStore::backingStoreContext):
* UIProcess/mac/CorrectionPanel.mm:
(WebKit::CorrectionPanel::handleAcceptedReplacement):
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::TextChecker::checkTextOfParagraph):
(WebKit::TextChecker::updateSpellingUIWithGrammarString):
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController enterFullScreen:]):
(-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
(-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::platformDefaultDiskCacheDirectory):
* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::nsMenuItemVector):
(WebKit::WebContextMenuProxyMac::populate):
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::createInspectorWindow):
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
* UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::populate):
(WebKit::WebPopupMenuProxyMac::showPopupMenu):
* WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
(WebKit::InjectedBundle::load):
* WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
(WebKit::NetscapePlugin::updatePluginLayer):
* WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
(WebKit::PluginProxy::pluginLayer):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::PDFPlugin):
(WebKit::PDFPlugin::createScrollbar):
(WebKit::PDFPlugin::pdfDocumentDidLoad):
(WebKit::PDFPlugin::writeItemsToPasteboard):
* WebProcess/Plugins/PDF/SimplePDFPlugin.mm:
(getAllScriptsInPDFDocument):
(WebKit::SimplePDFPlugin::pdfDocumentDidLoad):
(WebKit::SimplePDFPlugin::streamDidReceiveData):
(WebKit::SimplePDFPlugin::manualStreamDidReceiveData):
* WebProcess/ResourceCache/WebResourceCacheManager.cpp:
(WebKit::WebResourceCacheManager::clearCacheForOrigin):
* WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp:
(WebKit::WebResourceCacheManager::cfURLCacheHostNames):
(WebKit::WebResourceCacheManager::clearCFURLCacheForHostNames):
* WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
(WebKit::createNSError):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::drawPagesToPDF):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performDictionaryLookupForRange):
(WebKit::cachedResponseForURL):
(WebKit::WebPage::drawPagesToPDFFromPDFDocument):
* WebProcess/mac/WebProcessMac.mm:
(WebKit::WebProcess::platformSetCacheModel):
Use adoptCF and adoptNS free functions.
Source/WTF:
* wtf/RunLoopTimerCF.cpp:
(WTF::RunLoopTimerBase::start):
* wtf/SchedulePair.h:
(WTF::SchedulePair::SchedulePair):
* wtf/SchedulePairMac.mm:
(WTF::SchedulePair::SchedulePair):
* wtf/unicode/icu/CollatorICU.cpp:
(WTF::Collator::userDefault):
Use adoptCF free function.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@149255
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-04-27 Darin Adler <darin@apple.com>
+
+ Move from constructor and member function adoptCF/NS to free function adoptCF/NS.
+ https://bugs.webkit.org/show_bug.cgi?id=115307
+
+ Reviewed by Geoffrey Garen.
+
+ * heap/HeapTimer.cpp:
+ (JSC::HeapTimer::HeapTimer):
+ * runtime/VM.cpp:
+ (JSC::enableAssembler):
+ Use adoptCF free function.
+
2013-04-27 Anders Carlsson <andersca@apple.com>
Try to fix the Windows build.
m_context.info = &vm->apiLock();
m_context.retain = retainAPILock;
m_context.release = releaseAPILock;
- m_timer.adoptCF(CFRunLoopTimerCreate(0, s_decade, s_decade, 0, 0, HeapTimer::timerDidFire, &m_context));
+ m_timer = adoptCF(CFRunLoopTimerCreate(0, s_decade, s_decade, 0, 0, HeapTimer::timerDidFire, &m_context));
CFRunLoopAddTimer(m_runLoop.get(), m_timer.get(), kCFRunLoopCommonModes);
}
#if COMPILER(GCC) && !COMPILER(CLANG)
// FIXME: remove this once the EWS have been upgraded to LLVM.
// Work around a bug of GCC with strict-aliasing.
- RetainPtr<CFStringRef> canUseJITKeyRetain(AdoptCF, CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman));
+ RetainPtr<CFStringRef> canUseJITKeyRetain = adoptCF(CFStringCreateWithCString(0 , "JavaScriptCoreUseJIT", kCFStringEncodingMacRoman));
CFStringRef canUseJITKey = canUseJITKeyRetain.get();
#else
CFStringRef canUseJITKey = CFSTR("JavaScriptCoreUseJIT");
#endif // COMPILER(GCC) && !COMPILER(CLANG)
- RetainPtr<CFBooleanRef> canUseJIT(AdoptCF, (CFBooleanRef)CFPreferencesCopyAppValue(canUseJITKey, kCFPreferencesCurrentApplication));
+ RetainPtr<CFTypeRef> canUseJIT = adoptCF(CFPreferencesCopyAppValue(canUseJITKey, kCFPreferencesCurrentApplication));
if (canUseJIT)
return kCFBooleanTrue == canUseJIT.get();
#endif
+2013-04-27 Darin Adler <darin@apple.com>
+
+ Move from constructor and member function adoptCF/NS to free function adoptCF/NS.
+ https://bugs.webkit.org/show_bug.cgi?id=115307
+
+ Reviewed by Geoffrey Garen.
+
+ * wtf/RunLoopTimerCF.cpp:
+ (WTF::RunLoopTimerBase::start):
+ * wtf/SchedulePair.h:
+ (WTF::SchedulePair::SchedulePair):
+ * wtf/SchedulePairMac.mm:
+ (WTF::SchedulePair::SchedulePair):
+ * wtf/unicode/icu/CollatorICU.cpp:
+ (WTF::Collator::userDefault):
+ Use adoptCF free function.
+
2013-04-26 Geoffrey Garen <ggaren@apple.com>
Filled out more cases of branch folding in bytecode when emitting expressions into a branching context
if (m_timer)
CFRunLoopTimerInvalidate(m_timer.get());
CFRunLoopTimerContext context = { 0, this, 0, 0, 0 };
- m_timer.adoptCF(CFRunLoopTimerCreate(0, CFAbsoluteTimeGetCurrent() + nextFireInterval, repeatInterval, 0, 0, timerFired, &context));
+ m_timer = adoptCF(CFRunLoopTimerCreate(0, CFAbsoluteTimeGetCurrent() + nextFireInterval, repeatInterval, 0, 0, timerFired, &context));
}
void RunLoopTimerBase::schedule(const SchedulePair* schedulePair)
: m_runLoop(runLoop)
{
if (mode)
- m_mode.adoptCF(CFStringCreateCopy(0, mode));
+ m_mode = adoptCF(CFStringCreateCopy(0, mode));
}
#if PLATFORM(MAC) && !USE(CFNETWORK)
, m_runLoop([runLoop getCFRunLoop])
{
if (mode)
- m_mode.adoptCF(CFStringCreateCopy(0, mode));
+ m_mode = adoptCF(CFStringCreateCopy(0, mode));
}
} // namespace
#if OS(DARWIN) && USE(CF)
// Mac OS X doesn't set UNIX locale to match user-selected one, so ICU default doesn't work.
#if !OS(IOS)
- RetainPtr<CFLocaleRef> currentLocale(AdoptCF, CFLocaleCopyCurrent());
+ RetainPtr<CFLocaleRef> currentLocale = adoptCF(CFLocaleCopyCurrent());
CFStringRef collationOrder = (CFStringRef)CFLocaleGetValue(currentLocale.get(), kCFLocaleCollatorIdentifier);
#else
- RetainPtr<CFStringRef> collationOrderRetainer(AdoptCF, (CFStringRef)CFPreferencesCopyValue(CFSTR("AppleCollationOrder"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost));
+ RetainPtr<CFStringRef> collationOrderRetainer = adoptCF((CFStringRef)CFPreferencesCopyValue(CFSTR("AppleCollationOrder"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost));
CFStringRef collationOrder = collationOrderRetainer.get();
#endif
char buf[256];
+2013-04-27 Darin Adler <darin@apple.com>
+
+ Move from constructor and member function adoptCF/NS to free function adoptCF/NS.
+ https://bugs.webkit.org/show_bug.cgi?id=115307
+
+ Reviewed by Geoffrey Garen.
+
+ This change was done by a global replace followed by compiling and inspecting for
+ cases that needed to be tweaked by hand.
+
+ * accessibility/ios/AXObjectCacheIOS.mm:
+ (WebCore::AXObjectCache::attachWrapper):
+ * accessibility/mac/AXObjectCacheMac.mm:
+ (WebCore::AXObjectCache::attachWrapper):
+ * bridge/objc/objc_class.mm:
+ (JSC::Bindings::ObjcClass::methodNamed):
+ (JSC::Bindings::ObjcClass::fieldNamed):
+ * bridge/objc/objc_runtime.mm:
+ (JSC::Bindings::ObjcField::ObjcField):
+ * editing/mac/EditorMac.mm:
+ (WebCore::Editor::fontAttributesForSelectionStart):
+ * history/cf/HistoryPropertyList.cpp:
+ (WebCore::HistoryPropertyListWriter::releaseData):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::createFileURLForApplicationCacheResource):
+ * loader/archive/cf/LegacyWebArchive.cpp:
+ (WebCore::LegacyWebArchive::createPropertyListRepresentation):
+ (WebCore::LegacyWebArchive::create):
+ (WebCore::LegacyWebArchive::rawDataRepresentation):
+ * loader/archive/cf/LegacyWebArchiveMac.mm:
+ (WebCore::LegacyWebArchive::createPropertyListRepresentation):
+ * loader/mac/ResourceLoaderMac.mm:
+ (WebCore::ResourceLoader::willCacheResponse):
+ * page/CaptionUserPreferencesMac.mm:
+ (WebCore::CaptionUserPreferencesMac::userPrefersCaptions):
+ (WebCore::CaptionUserPreferencesMac::userPrefersSubtitles):
+ (WebCore::CaptionUserPreferencesMac::captionsWindowCSS):
+ (WebCore::CaptionUserPreferencesMac::captionsBackgroundCSS):
+ (WebCore::CaptionUserPreferencesMac::captionsTextColor):
+ (WebCore::CaptionUserPreferencesMac::captionsDefaultFontCSS):
+ (WebCore::CaptionUserPreferencesMac::preferredLanguages):
+ (WebCore::trackDisplayName):
+ * platform/Language.cpp:
+ (WebCore::displayNameForLanguageLocale):
+ * platform/LocalizedStrings.cpp:
+ (WebCore::contextMenuItemTagSearchWeb):
+ (WebCore::imageTitle):
+ * platform/MIMETypeRegistry.cpp:
+ (WebCore::initializeSupportedImageMIMETypes):
+ (WebCore::initializeSupportedImageMIMETypesForEncoding):
+ * platform/audio/mac/AudioFileReaderMac.cpp:
+ (WebCore::AudioFileReader::AudioFileReader):
+ * platform/cf/KURLCFNet.cpp:
+ (WebCore::KURL::fileSystemPath):
+ * platform/cf/SharedBufferCF.cpp:
+ (WebCore::SharedBuffer::maybeTransferPlatformData):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::setContentsToImage):
+ * platform/graphics/ca/mac/LayerFlushSchedulerMac.cpp:
+ (WebCore::LayerFlushScheduler::schedule):
+ * platform/graphics/ca/mac/PlatformCAAnimationMac.mm:
+ (PlatformCAAnimation::PlatformCAAnimation):
+ * platform/graphics/ca/mac/PlatformCAFiltersMac.mm:
+ (PlatformCAFilters::filterValueForOperation):
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+ (PlatformCALayer::PlatformCALayer):
+ (PlatformCALayer::addAnimationForKey):
+ (PlatformCALayer::setBackgroundColor):
+ (PlatformCALayer::setBorderColor):
+ * platform/graphics/cg/BitmapImageCG.cpp:
+ (WebCore::BitmapImage::checkForSolidColor):
+ (WebCore::BitmapImage::getCGImageArray):
+ * platform/graphics/cg/ColorCG.cpp:
+ (WebCore::cachedCGColor):
+ * platform/graphics/cg/GraphicsContext3DCG.cpp:
+ (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::applyStrokePattern):
+ (WebCore::GraphicsContext::applyFillPattern):
+ (WebCore::GraphicsContext::setURLForRect):
+ * platform/graphics/cg/ImageBufferCG.cpp:
+ (WebCore::createIOSurface):
+ (WebCore::ImageBuffer::ImageBuffer):
+ (WebCore::ImageBuffer::copyImage):
+ (WebCore::ImageBuffer::draw):
+ (WebCore::ImageBuffer::clip):
+ (WebCore::ImageBuffer::putByteArray):
+ (WebCore::CGImageEncodeToData):
+ (WebCore::CGImageToDataURL):
+ (WebCore::ImageBuffer::toDataURL):
+ (WebCore::ImageDataToDataURL):
+ * platform/graphics/cg/ImageBufferDataCG.cpp:
+ (WebCore::ImageBufferData::getData):
+ (WebCore::ImageBufferData::putData):
+ * platform/graphics/cg/ImageCG.cpp:
+ (WebCore::Image::imageWithColorSpace):
+ (WebCore::Image::drawPattern):
+ * platform/graphics/cg/ImageSourceCG.cpp:
+ (WebCore::ImageSource::setData):
+ (WebCore::ImageSource::isSizeAvailable):
+ (WebCore::ImageSource::frameSizeAtIndex):
+ (WebCore::ImageSource::orientationAtIndex):
+ (WebCore::ImageSource::getHotSpot):
+ (WebCore::ImageSource::repetitionCount):
+ (WebCore::ImageSource::createFrameAtIndex):
+ (WebCore::ImageSource::frameDurationAtIndex):
+ * platform/graphics/cg/PDFDocumentImage.cpp:
+ (WebCore::PDFDocumentImage::dataChanged):
+ * platform/graphics/cg/PathCG.cpp:
+ (WebCore::createScratchContext):
+ (WebCore::Path::contains):
+ * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+ (WebCore::FontPlatformData::FontPlatformData):
+ (WebCore::FontPlatformData::setFont):
+ (WebCore::createFeatureSettingDictionary):
+ (WebCore::cascadeToLastResortFontDescriptor):
+ (WebCore::cascadeToLastResortAndDisableSwashesFontDescriptor):
+ (WebCore::FontPlatformData::ctFont):
+ (WebCore::FontPlatformData::description):
+ * platform/graphics/gpu/mac/DrawingBufferMac.mm:
+ (WebCore::DrawingBuffer::DrawingBuffer):
+ * platform/graphics/mac/ComplexTextControllerCoreText.mm:
+ (-[WebCascadeList objectAtIndex:]):
+ (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
+ * platform/graphics/mac/FontCustomPlatformData.cpp:
+ (WebCore::createFontCustomPlatformData):
+ * platform/graphics/mac/GlyphPageTreeNodeMac.cpp:
+ (WebCore::GlyphPage::fill):
+ * platform/graphics/mac/GraphicsContext3DMac.mm:
+ (WebCore::GraphicsContext3D::GraphicsContext3D):
+ * platform/graphics/mac/GraphicsContextMac.mm:
+ (WebCore::GraphicsContext::drawFocusRing):
+ (WebCore::linearRGBColorSpaceRef):
+ * platform/graphics/mac/ImageMac.mm:
+ (WebCore::BitmapImage::getTIFFRepresentation):
+ (WebCore::BitmapImage::getNSImage):
+ * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+ (WebCore::MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit):
+ (WebCore::MediaPlayerPrivateQTKit::createQTMovie):
+ (WebCore::MediaPlayerPrivateQTKit::createQTMovieView):
+ (WebCore::MediaPlayerPrivateQTKit::createQTVideoRenderer):
+ (WebCore::MediaPlayerPrivateQTKit::createQTMovieLayer):
+ (WebCore::MediaPlayerPrivateQTKit::setPreservesPitch):
+ (WebCore::addFileTypesToCache):
+ * platform/graphics/mac/SimpleFontDataCoreText.cpp:
+ (WebCore::SimpleFontData::getCFStringAttributes):
+ * platform/graphics/mac/SimpleFontDataMac.mm:
+ (WebCore::fontHasVerticalGlyphs):
+ (WebCore::SimpleFontData::getCompositeFontReferenceFontData):
+ (WebCore::SimpleFontData::platformCharWidthInit):
+ (WebCore::SimpleFontData::canRenderCombiningCharacterSequence):
+ * platform/graphics/mac/WebGLLayer.mm:
+ (-[WebGLLayer copyImageSnapshotWithColorSpace:]):
+ * platform/mac/ContentFilterMac.mm:
+ (WebCore::ContentFilter::ContentFilter):
+ * platform/mac/ContextMenuItemMac.mm:
+ (WebCore::ContextMenuItem::ContextMenuItem):
+ * platform/mac/CursorMac.mm:
+ (WebCore::createCustomCursor):
+ (WebCore::createNamedCursor):
+ * platform/mac/DisplaySleepDisabler.cpp:
+ (WebCore::DisplaySleepDisabler::DisplaySleepDisabler):
+ * platform/mac/DragImageMac.mm:
+ (WebCore::dissolveDragImageToFraction):
+ (WebCore::createDragImageFromImage):
+ * platform/mac/HTMLConverter.mm:
+ (+[WebHTMLConverter editingAttributedStringFromRange:]):
+ * platform/mac/Language.mm:
+ (WebCore::httpStyleLanguageCode):
+ (WebCore::platformUserPreferredLanguages):
+ * platform/mac/LocalizedStringsMac.cpp:
+ (WebCore::localizedString):
+ * platform/mac/PasteboardMac.mm:
+ (WebCore::Pasteboard::getDataSelection):
+ (WebCore::Pasteboard::writeSelectionForTypes):
+ (WebCore::fragmentFromWebArchive):
+ * platform/mac/PlatformClockCM.mm:
+ (PlatformClockCM::PlatformClockCM):
+ (PlatformClockCM::initializeWithTimingSource):
+ * platform/mac/PlatformPasteboardMac.mm:
+ (WebCore::PlatformPasteboard::addTypes):
+ (WebCore::PlatformPasteboard::setTypes):
+ (WebCore::PlatformPasteboard::setPathnamesForType):
+ * platform/mac/PlatformSpeechSynthesizerMac.mm:
+ (WebCore::PlatformSpeechSynthesizer::speak):
+ * platform/mac/PopupMenuMac.mm:
+ (WebCore::PopupMenuMac::populate):
+ (WebCore::PopupMenuMac::show):
+ * platform/mac/ScrollAnimatorMac.mm:
+ (-[WebScrollbarPainterDelegate setUpAlphaAnimation:scrollerPainter:part:WebCore::animateAlphaTo:duration:]):
+ (-[WebScrollbarPainterDelegate scrollerImp:animateUIStateTransitionWithDuration:]):
+ (-[WebScrollbarPainterDelegate scrollerImp:animateExpansionTransitionWithDuration:]):
+ (WebCore::ScrollAnimatorMac::ScrollAnimatorMac):
+ (WebCore::ScrollAnimatorMac::didAddVerticalScrollbar):
+ (WebCore::ScrollAnimatorMac::didAddHorizontalScrollbar):
+ * platform/mac/SharedBufferMac.mm:
+ (WebCore::SharedBuffer::createCFData):
+ * platform/mac/WebCoreNSStringExtras.mm:
+ (stringEncodingForResource):
+ * platform/network/ProtectionSpace.cpp:
+ (WebCore::ProtectionSpace::receivesCredentialSecurely):
+ * platform/network/SynchronousLoaderClient.cpp:
+ (WebCore::SynchronousLoaderClient::platformBadResponseError):
+ * platform/network/cf/CredentialStorageCFNet.cpp:
+ (WebCore::CredentialStorage::getFromPersistentStorage):
+ * platform/network/cf/DNSCFNet.cpp:
+ (WebCore::DNSResolveQueue::platformProxyIsEnabledInSystemPreferences):
+ * platform/network/cf/FormDataStreamCFNet.cpp:
+ (WebCore::advanceCurrentStream):
+ * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+ (WebCore::overrideCookieStorage):
+ * platform/network/cf/ProxyServerCFNet.cpp:
+ (WebCore::proxyAutoConfigurationResultCallback):
+ (WebCore::processProxyServers):
+ (WebCore::addProxyServersForURL):
+ * platform/network/cf/ResourceErrorCF.cpp:
+ (WebCore::ResourceError::platformLazyInit):
+ (WebCore::ResourceError::cfError):
+ * platform/network/cf/ResourceHandleCFNet.cpp:
+ (WebCore::willSendRequest):
+ (WebCore::ResourceHandle::createCFURLConnection):
+ (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
+ (WebCore::ResourceHandle::receivedCredential):
+ (WebCore::ResourceHandle::handleDataArray):
+ * platform/network/cf/ResourceRequestCFNet.cpp:
+ (WebCore::setHeaderFields):
+ (WebCore::ResourceRequest::doUpdatePlatformRequest):
+ (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
+ (WebCore::ResourceRequest::doUpdateResourceRequest):
+ (WebCore::ResourceRequest::setStorageSession):
+ * platform/network/cf/ResourceResponseCFNet.cpp:
+ (WebCore::ResourceResponse::cfURLResponse):
+ (WebCore::ResourceResponse::platformLazyInit):
+ * platform/network/cf/SocketStreamHandleCFNet.cpp:
+ (WebCore::SocketStreamHandle::SocketStreamHandle):
+ (WebCore::SocketStreamHandle::executePACFileURL):
+ (WebCore::SocketStreamHandle::chooseProxy):
+ (WebCore::SocketStreamHandle::createStreams):
+ (WebCore::SocketStreamHandle::addCONNECTCredentials):
+ (WebCore::SocketStreamHandle::readStreamCallback):
+ (WebCore::SocketStreamHandle::writeStreamCallback):
+ (WebCore::SocketStreamHandle::reportErrorToClient):
+ * platform/network/mac/AuthenticationMac.mm:
+ (WebCore::mac):
+ (WebCore::AuthenticationChallenge::setAuthenticationClient):
+ * platform/network/mac/CookieJarMac.mm:
+ (WebCore::filterCookies):
+ * platform/network/mac/NetworkStateNotifierMac.cpp:
+ (WebCore::NetworkStateNotifier::updateState):
+ (WebCore::NetworkStateNotifier::NetworkStateNotifier):
+ * platform/network/mac/ResourceErrorMac.mm:
+ (WebCore::createNSErrorFromResourceErrorBase):
+ (WebCore::ResourceError::nsError):
+ * platform/network/mac/ResourceHandleMac.mm:
+ (WebCore::ResourceHandle::createNSURLConnection):
+ * platform/network/mac/ResourceRequestMac.mm:
+ (WebCore::ResourceRequest::updateNSURLRequest):
+ (WebCore::ResourceRequest::doUpdatePlatformRequest):
+ (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
+ (WebCore::ResourceRequest::setStorageSession):
+ * platform/network/mac/ResourceResponseMac.mm:
+ (WebCore::ResourceResponse::initNSURLResponse):
+ (WebCore::ResourceResponse::nsURLResponse):
+ (WebCore::ResourceResponse::platformLazyInit):
+ * platform/network/mac/UTIUtilities.mm:
+ (WebCore::mimeTypeFromUTITree):
+ * platform/network/mac/WebCoreURLResponse.mm:
+ (WebCore::adjustMIMETypeIfNecessary):
+ * platform/text/cf/HyphenationCF.cpp:
+ (WebCore::::createValueForNullKey):
+ (WebCore::lastHyphenLocation):
+ * platform/text/mac/HyphenationMac.mm:
+ (WebCore::::createValueForKey):
+ (WebCore::lastHyphenLocation):
+ * platform/text/mac/LocaleMac.mm:
+ (WebCore::determineLocale):
+ (WebCore::LocaleMac::LocaleMac):
+ (WebCore::LocaleMac::initializeLocaleData):
+ * platform/text/mac/TextBreakIteratorInternalICUMac.mm:
+ (WebCore::textBreakLocalePreference):
+ (WebCore::canonicalLanguageIdentifier):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::RenderThemeMac):
+ (WebCore::RenderThemeMac::levelIndicatorFor):
+ (WebCore::RenderThemeMac::paintMenuListButtonGradients):
+ (WebCore::RenderThemeMac::paintSliderTrack):
+ (WebCore::RenderThemeMac::popupButton):
+ (WebCore::RenderThemeMac::search):
+ (WebCore::RenderThemeMac::searchMenuTemplate):
+ (WebCore::RenderThemeMac::sliderThumbHorizontal):
+ (WebCore::RenderThemeMac::sliderThumbVertical):
+ (WebCore::RenderThemeMac::textField):
+ Use adoptNS and adoptCF free functions.
+
2013-04-27 Ryosuke Niwa <rniwa@webkit.org>
Pressing mouse button inside a dragstart event causes a crash
void AXObjectCache::attachWrapper(AccessibilityObject* obj)
{
- RetainPtr<AccessibilityObjectWrapper> wrapper(AdoptNS, [[WebAccessibilityObjectWrapper alloc] initWithAccessibilityObject:obj]);
+ RetainPtr<AccessibilityObjectWrapper> wrapper = adoptNS([[WebAccessibilityObjectWrapper alloc] initWithAccessibilityObject:obj]);
obj->setWrapper(wrapper.get());
}
void AXObjectCache::attachWrapper(AccessibilityObject* obj)
{
- RetainPtr<WebAccessibilityObjectWrapper> wrapper(AdoptNS, [[WebAccessibilityObjectWrapper alloc] initWithAccessibilityObject:obj]);
+ RetainPtr<WebAccessibilityObjectWrapper> wrapper = adoptNS([[WebAccessibilityObjectWrapper alloc] initWithAccessibilityObject:obj]);
obj->setWrapper(wrapper.get());
}
CString jsName = name.ascii();
JSNameConversionBuffer buffer;
convertJSMethodNameToObjc(jsName, buffer);
- RetainPtr<CFStringRef> methodName(AdoptCF, CFStringCreateWithCString(NULL, buffer.data(), kCFStringEncodingASCII));
+ RetainPtr<CFStringRef> methodName = adoptCF(CFStringCreateWithCString(NULL, buffer.data(), kCFStringEncodingASCII));
Method* methodPtr = 0;
ClassStructPtr thisClass = _isa;
ClassStructPtr thisClass = _isa;
CString jsName = name.ascii();
- RetainPtr<CFStringRef> fieldName(AdoptCF, CFStringCreateWithCString(NULL, jsName.data(), kCFStringEncodingASCII));
+ RetainPtr<CFStringRef> fieldName = adoptCF(CFStringCreateWithCString(NULL, jsName.data(), kCFStringEncodingASCII));
id targetObject = (static_cast<ObjcInstance*>(instance))->getObject();
id attributes = [targetObject attributeKeys];
if (attributes) {
ObjcField::ObjcField(Ivar ivar)
: _ivar(ivar)
- , _name(AdoptCF, CFStringCreateWithCString(0, ivar_getName(_ivar), kCFStringEncodingASCII))
+ , _name(adoptCF(CFStringCreateWithCString(0, ivar_getName(_ivar), kCFStringEncodingASCII)))
{
}
const ShadowData* shadow = style->textShadow();
if (shadow) {
- RetainPtr<NSShadow> s(AdoptNS, [[NSShadow alloc] init]);
+ RetainPtr<NSShadow> s = adoptNS([[NSShadow alloc] init]);
[s.get() setShadowOffset:NSMakeSize(shadow->x(), shadow->y())];
[s.get() setShadowBlurRadius:shadow->radius()];
[s.get() setShadowColor:nsColor(shadow->color())];
if (!buffer)
return 0;
m_buffer = 0;
- RetainPtr<CFDataRef> data(AdoptCF, CFDataCreateWithBytesNoCopy(0, buffer, m_bufferSize, 0));
+ RetainPtr<CFDataRef> data = adoptCF(CFDataCreateWithBytesNoCopy(0, buffer, m_bufferSize, 0));
if (!data) {
CFAllocatorDeallocate(0, buffer);
return 0;
// app cache media files are always created with encodeForFileName(createCanonicalUUIDString()).
#if USE(CF) && PLATFORM(WIN)
- RetainPtr<CFURLRef> cfURL(AdoptCF, CFURLCreateWithFileSystemPath(0, path.createCFString().get(), kCFURLWindowsPathStyle, false));
+ RetainPtr<CFURLRef> cfURL = adoptCF(CFURLCreateWithFileSystemPath(0, path.createCFString().get(), kCFURLWindowsPathStyle, false));
KURL url(cfURL.get());
#else
KURL url;
// The property list representation of a null/empty WebResource has the following 3 objects stored as nil.
// FIXME: 0 is not serializable. Presumably we need to use kCFNull here instead for compatibility.
// FIXME: But why do we need to support a resource of 0? Who relies on that?
- RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, CFDictionaryCreateMutable(0, 3, 0, 0));
+ RetainPtr<CFMutableDictionaryRef> propertyList = adoptCF(CFDictionaryCreateMutable(0, 3, 0, 0));
CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceDataKey, 0);
CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceURLKey, 0);
CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceMIMETypeKey, 0);
return propertyList;
}
- RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, CFDictionaryCreateMutable(0, 6, 0, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CFMutableDictionaryRef> propertyList = adoptCF(CFDictionaryCreateMutable(0, 6, 0, &kCFTypeDictionaryValueCallBacks));
// Resource data can be empty, but must be represented by an empty CFDataRef
SharedBuffer* data = resource->data();
RetainPtr<CFDataRef> cfData;
if (data)
- cfData.adoptCF(data->createCFData());
+ cfData = adoptCF(data->createCFData());
else
- cfData.adoptCF(CFDataCreate(0, 0, 0));
+ cfData = adoptCF(CFDataCreate(0, 0, 0));
CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceDataKey, cfData.get());
// Resource URL cannot be null
RetainPtr<CFDictionaryRef> LegacyWebArchive::createPropertyListRepresentation(Archive* archive)
{
- RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, CFDictionaryCreateMutable(0, 3, 0, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CFMutableDictionaryRef> propertyList = adoptCF(CFDictionaryCreateMutable(0, 3, 0, &kCFTypeDictionaryValueCallBacks));
RetainPtr<CFDictionaryRef> mainResourceDict = createPropertyListRepresentation(archive->mainResource(), MainResource);
ASSERT(mainResourceDict);
return 0;
CFDictionarySetValue(propertyList.get(), LegacyWebArchiveMainResourceKey, mainResourceDict.get());
- RetainPtr<CFMutableArrayRef> subresourcesArray(AdoptCF, CFArrayCreateMutable(0, archive->subresources().size(), &kCFTypeArrayCallBacks));
+ RetainPtr<CFMutableArrayRef> subresourcesArray = adoptCF(CFArrayCreateMutable(0, archive->subresources().size(), &kCFTypeArrayCallBacks));
const Vector<RefPtr<ArchiveResource> >& subresources(archive->subresources());
for (unsigned i = 0; i < subresources.size(); ++i) {
RetainPtr<CFDictionaryRef> subresource = createPropertyListRepresentation(subresources[i].get(), Subresource);
if (CFArrayGetCount(subresourcesArray.get()))
CFDictionarySetValue(propertyList.get(), LegacyWebArchiveSubresourcesKey, subresourcesArray.get());
- RetainPtr<CFMutableArrayRef> subframesArray(AdoptCF, CFArrayCreateMutable(0, archive->subframeArchives().size(), &kCFTypeArrayCallBacks));
+ RetainPtr<CFMutableArrayRef> subframesArray = adoptCF(CFArrayCreateMutable(0, archive->subframeArchives().size(), &kCFTypeArrayCallBacks));
const Vector<RefPtr<Archive> >& subframeArchives(archive->subframeArchives());
for (unsigned i = 0; i < subframeArchives.size(); ++i) {
RetainPtr<CFDictionaryRef> subframeArchive = createPropertyListRepresentation(subframeArchives[i].get());
if (!data)
return 0;
- RetainPtr<CFDataRef> cfData(AdoptCF, data->createCFData());
+ RetainPtr<CFDataRef> cfData = adoptCF(data->createCFData());
if (!cfData)
return 0;
CFStringRef errorString = 0;
- RetainPtr<CFDictionaryRef> plist(AdoptCF, static_cast<CFDictionaryRef>(CFPropertyListCreateFromXMLData(0, cfData.get(), kCFPropertyListImmutable, &errorString)));
+ RetainPtr<CFDictionaryRef> plist = adoptCF(static_cast<CFDictionaryRef>(CFPropertyListCreateFromXMLData(0, cfData.get(), kCFPropertyListImmutable, &errorString)));
if (!plist) {
#ifndef NDEBUG
const char* cError = errorString ? CFStringGetCStringPtr(errorString, kCFStringEncodingUTF8) : "unknown error";
return 0;
}
- RetainPtr<CFWriteStreamRef> stream(AdoptCF, CFWriteStreamCreateWithAllocatedBuffers(0, 0));
+ RetainPtr<CFWriteStreamRef> stream = adoptCF(CFWriteStreamCreateWithAllocatedBuffers(0, 0));
CFWriteStreamOpen(stream.get());
CFPropertyListWriteToStream(propertyList.get(), stream.get(), kCFPropertyListBinaryFormat_v1_0, 0);
- RetainPtr<CFDataRef> plistData(AdoptCF, static_cast<CFDataRef>(CFWriteStreamCopyProperty(stream.get(), kCFStreamPropertyDataWritten)));
+ RetainPtr<CFDataRef> plistData = adoptCF(static_cast<CFDataRef>(CFWriteStreamCopyProperty(stream.get(), kCFStreamPropertyDataWritten)));
ASSERT(plistData);
CFWriteStreamClose(stream.get());
[archiver finishEncoding];
[archiver release];
- return RetainPtr<CFDataRef>(AdoptCF, responseData);
+ return adoptCF(responseData);
}
}
if (m_options.sendLoadCallbacks == DoNotSendCallbacks)
return 0;
- RetainPtr<NSCachedURLResponse> nsCachedResponse(AdoptNS, [[NSCachedURLResponse alloc] _initWithCFCachedURLResponse:cachedResponse]);
+ RetainPtr<NSCachedURLResponse> nsCachedResponse = adoptNS([[NSCachedURLResponse alloc] _initWithCFCachedURLResponse:cachedResponse]);
return [frameLoader()->client()->willCacheResponse(documentLoader(), identifier(), nsCachedResponse.get()) _CFCachedURLResponse];
}
if (captionSetting || testingMode() || !MediaAccessibilityLibrary())
return captionSetting;
- RetainPtr<CFArrayRef> captioningMediaCharacteristics(AdoptCF, MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(kMACaptionAppearanceDomainUser));
+ RetainPtr<CFArrayRef> captioningMediaCharacteristics = adoptCF(MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(kMACaptionAppearanceDomainUser));
return captioningMediaCharacteristics && CFArrayGetCount(captioningMediaCharacteristics.get());
}
if (subtitlesSetting || testingMode() || !MediaAccessibilityLibrary())
return subtitlesSetting;
- RetainPtr<CFArrayRef> captioningMediaCharacteristics(AdoptCF, MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(kMACaptionAppearanceDomainUser));
+ RetainPtr<CFArrayRef> captioningMediaCharacteristics = adoptCF(MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(kMACaptionAppearanceDomainUser));
return !(captioningMediaCharacteristics && CFArrayGetCount(captioningMediaCharacteristics.get()));
}
String CaptionUserPreferencesMac::captionsWindowCSS() const
{
MACaptionAppearanceBehavior behavior;
- RetainPtr<CGColorRef> color(AdoptCF, MACaptionAppearanceCopyWindowColor(kMACaptionAppearanceDomainUser, &behavior));
+ RetainPtr<CGColorRef> color = adoptCF(MACaptionAppearanceCopyWindowColor(kMACaptionAppearanceDomainUser, &behavior));
Color windowColor(color.get());
if (!windowColor.isValid())
MACaptionAppearanceBehavior behavior;
- RetainPtr<CGColorRef> color(AdoptCF, MACaptionAppearanceCopyBackgroundColor(kMACaptionAppearanceDomainUser, &behavior));
+ RetainPtr<CGColorRef> color = adoptCF(MACaptionAppearanceCopyBackgroundColor(kMACaptionAppearanceDomainUser, &behavior));
Color backgroundColor(color.get());
if (!backgroundColor.isValid())
backgroundColor = defaultBackgroundColor;
Color CaptionUserPreferencesMac::captionsTextColor(bool& important) const
{
MACaptionAppearanceBehavior behavior;
- RetainPtr<CGColorRef> color(AdoptCF, MACaptionAppearanceCopyForegroundColor(kMACaptionAppearanceDomainUser, &behavior));
+ RetainPtr<CGColorRef> color = adoptCF(MACaptionAppearanceCopyForegroundColor(kMACaptionAppearanceDomainUser, &behavior));
Color textColor(color.get());
if (!textColor.isValid())
// This default value must be the same as the one specified in mediaControls.css for -webkit-media-text-track-container.
{
MACaptionAppearanceBehavior behavior;
- RetainPtr<CTFontDescriptorRef> font(AdoptCF, MACaptionAppearanceCopyFontDescriptorForStyle(kMACaptionAppearanceDomainUser, &behavior, kMACaptionAppearanceFontStyleDefault));
+ RetainPtr<CTFontDescriptorRef> font = adoptCF(MACaptionAppearanceCopyFontDescriptorForStyle(kMACaptionAppearanceDomainUser, &behavior, kMACaptionAppearanceFontStyleDefault));
if (!font)
return emptyString();
- RetainPtr<CFTypeRef> name(AdoptCF, CTFontDescriptorCopyAttribute(font.get(), kCTFontNameAttribute));
+ RetainPtr<CFTypeRef> name = adoptCF(CTFontDescriptorCopyAttribute(font.get(), kCTFontNameAttribute));
if (!name)
return emptyString();
}
CFIndex languageCount = 0;
- RetainPtr<CFArrayRef> languages(AdoptCF, MACaptionAppearanceCopySelectedLanguages(kMACaptionAppearanceDomainUser));
+ RetainPtr<CFArrayRef> languages = adoptCF(MACaptionAppearanceCopySelectedLanguages(kMACaptionAppearanceDomainUser));
if (languages)
languageCount = CFArrayGetCount(languages.get());
String label = track->label();
String trackLanguageIdentifier = track->language();
- RetainPtr<CFLocaleRef> currentLocale(AdoptCF, CFLocaleCopyCurrent());
- RetainPtr<CFStringRef> localeIdentifier(AdoptCF, CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorDefault, trackLanguageIdentifier.createCFString().get()));
- RetainPtr<CFStringRef> languageCF(AdoptCF, CFLocaleCopyDisplayNameForPropertyValue(currentLocale.get(), kCFLocaleLanguageCode, localeIdentifier.get()));
+ RetainPtr<CFLocaleRef> currentLocale = adoptCF(CFLocaleCopyCurrent());
+ RetainPtr<CFStringRef> localeIdentifier = adoptCF(CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorDefault, trackLanguageIdentifier.createCFString().get()));
+ RetainPtr<CFStringRef> languageCF = adoptCF(CFLocaleCopyDisplayNameForPropertyValue(currentLocale.get(), kCFLocaleLanguageCode, localeIdentifier.get()));
String language = languageCF.get();
if (!label.isEmpty()) {
if (language.isEmpty() || label.contains(language))
displayName.append(label);
else {
- RetainPtr<CFDictionaryRef> localeDict(AdoptCF, CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorDefault, localeIdentifier.get()));
+ RetainPtr<CFDictionaryRef> localeDict = adoptCF(CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorDefault, localeIdentifier.get()));
if (localeDict) {
CFStringRef countryCode = 0;
String countryName;
CFDictionaryGetValueIfPresent(localeDict.get(), kCFLocaleCountryCode, (const void **)&countryCode);
if (countryCode) {
- RetainPtr<CFStringRef> countryNameCF(AdoptCF, CFLocaleCopyDisplayNameForPropertyValue(currentLocale.get(), kCFLocaleCountryCode, countryCode));
+ RetainPtr<CFStringRef> countryNameCF = adoptCF(CFLocaleCopyDisplayNameForPropertyValue(currentLocale.get(), kCFLocaleCountryCode, countryCode));
countryName = countryNameCF.get();
}
{
#if PLATFORM(MAC)
if (!localeName.isNull() && !localeName.isEmpty()) {
- RetainPtr<CFLocaleRef> currentLocale(AdoptCF, CFLocaleCopyCurrent());
+ RetainPtr<CFLocaleRef> currentLocale = adoptCF(CFLocaleCopyCurrent());
return CFLocaleCopyDisplayNameForPropertyValue(currentLocale.get(), kCFLocaleIdentifier, localeName.createCFString().get());
}
#endif
String contextMenuItemTagSearchWeb()
{
#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
- RetainPtr<CFStringRef> searchProviderName(AdoptCF, wkCopyDefaultSearchProviderDisplayName());
+ RetainPtr<CFStringRef> searchProviderName = adoptCF(wkCopyDefaultSearchProviderDisplayName());
return formatLocalizedString(WEB_UI_STRING("Search with %@", "Search with search provider context menu item with provider name inserted"), searchProviderName.get());
#else
return WEB_UI_STRING("Search with Google", "Search with Google context menu item");
{
#if USE(CF)
RetainPtr<CFLocaleRef> locale = adoptCF(CFLocaleCopyCurrent());
- RetainPtr<CFNumberFormatterRef> formatter(AdoptCF, CFNumberFormatterCreate(0, locale.get(), kCFNumberFormatterDecimalStyle));
+ RetainPtr<CFNumberFormatterRef> formatter = adoptCF(CFNumberFormatterCreate(0, locale.get(), kCFNumberFormatterDecimalStyle));
int widthInt = size.width();
- RetainPtr<CFNumberRef> width(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &widthInt));
- RetainPtr<CFStringRef> widthString(AdoptCF, CFNumberFormatterCreateStringWithNumber(0, formatter.get(), width.get()));
+ RetainPtr<CFNumberRef> width = adoptCF(CFNumberCreate(0, kCFNumberIntType, &widthInt));
+ RetainPtr<CFStringRef> widthString = adoptCF(CFNumberFormatterCreateStringWithNumber(0, formatter.get(), width.get()));
int heightInt = size.height();
- RetainPtr<CFNumberRef> height(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &heightInt));
- RetainPtr<CFStringRef> heightString(AdoptCF, CFNumberFormatterCreateStringWithNumber(0, formatter.get(), height.get()));
+ RetainPtr<CFNumberRef> height = adoptCF(CFNumberCreate(0, kCFNumberIntType, &heightInt));
+ RetainPtr<CFStringRef> heightString = adoptCF(CFNumberFormatterCreateStringWithNumber(0, formatter.get(), height.get()));
return formatLocalizedString(WEB_UI_STRING("%@ %@×%@ pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename.createCFString().get(), widthString.get(), heightString.get());
#else
static void initializeSupportedImageMIMETypes()
{
#if USE(CG)
- RetainPtr<CFArrayRef> supportedTypes(AdoptCF, CGImageSourceCopyTypeIdentifiers());
+ RetainPtr<CFArrayRef> supportedTypes = adoptCF(CGImageSourceCopyTypeIdentifiers());
CFIndex count = CFArrayGetCount(supportedTypes.get());
for (CFIndex i = 0; i < count; i++) {
- RetainPtr<CFStringRef> supportedType(AdoptCF, reinterpret_cast<CFStringRef>(CFArrayGetValueAtIndex(supportedTypes.get(), i)));
+ RetainPtr<CFStringRef> supportedType = adoptCF(reinterpret_cast<CFStringRef>(CFArrayGetValueAtIndex(supportedTypes.get(), i)));
String mimeType = MIMETypeForImageSourceType(supportedType.get());
if (!mimeType.isEmpty()) {
supportedImageMIMETypes->add(mimeType);
#if USE(CG)
#if PLATFORM(MAC)
- RetainPtr<CFArrayRef> supportedTypes(AdoptCF, CGImageDestinationCopyTypeIdentifiers());
+ RetainPtr<CFArrayRef> supportedTypes = adoptCF(CGImageDestinationCopyTypeIdentifiers());
CFIndex count = CFArrayGetCount(supportedTypes.get());
for (CFIndex i = 0; i < count; i++) {
- RetainPtr<CFStringRef> supportedType(AdoptCF, reinterpret_cast<CFStringRef>(CFArrayGetValueAtIndex(supportedTypes.get(), i)));
+ RetainPtr<CFStringRef> supportedType = adoptCF(reinterpret_cast<CFStringRef>(CFArrayGetValueAtIndex(supportedTypes.get(), i)));
String mimeType = MIMETypeForImageSourceType(supportedType.get());
if (!mimeType.isEmpty())
supportedImageMIMETypesForEncoding->add(mimeType);
, m_audioFileID(0)
, m_extAudioFileRef(0)
{
- RetainPtr<CFStringRef> filePathString(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, filePath, kCFStringEncodingUTF8));
- RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, filePathString.get(), kCFURLPOSIXPathStyle, false));
+ RetainPtr<CFStringRef> filePathString = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, filePath, kCFStringEncodingUTF8));
+ RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, filePathString.get(), kCFURLPOSIXPathStyle, false));
if (!url)
return;
#if !(PLATFORM(QT) && USE(QTKIT))
String KURL::fileSystemPath() const
{
- RetainPtr<CFURLRef> cfURL(AdoptCF, createCFURL());
+ RetainPtr<CFURLRef> cfURL = adoptCF(createCFURL());
if (!cfURL)
return String();
#else
CFURLPathStyle pathStyle = kCFURLPOSIXPathStyle;
#endif
- return RetainPtr<CFStringRef>(AdoptCF, CFURLCopyFileSystemPath(cfURL.get(), pathStyle)).get();
+ return adoptCF(CFURLCopyFileSystemPath(cfURL.get(), pathStyle)).get();
}
#endif
// Hang on to the m_cfData pointer in a local pointer as append() will re-enter maybeTransferPlatformData()
// and we need to make sure to early return when it does.
- RetainPtr<CFDataRef> cfData(AdoptCF, m_cfData.leakRef());
+ RetainPtr<CFDataRef> cfData = adoptCF(m_cfData.leakRef());
append(reinterpret_cast<const char*>(CFDataGetBytePtr(cfData.get())), CFDataGetLength(cfData.get()));
}
MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC(MediaPlayer* player)
: MediaPlayerPrivateAVFoundation(player)
- , m_objcObserver(AdoptNS, [[WebCoreAVFMovieObserver alloc] initWithCallback:this])
+ , m_objcObserver(adoptNS([[WebCoreAVFMovieObserver alloc] initWithCallback:this]))
, m_videoFrameHasDrawn(false)
, m_haveCheckedPlayability(false)
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
- , m_loaderDelegate(AdoptNS, [[WebCoreAVFLoaderDelegate alloc] initWithCallback:this])
+ , m_loaderDelegate(adoptNS([[WebCoreAVFLoaderDelegate alloc] initWithCallback:this]))
#endif
#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
, m_currentTrack(0)
return;
if (!m_videoLayer) {
- m_videoLayer.adoptNS([[AVPlayerLayer alloc] init]);
+ m_videoLayer = adoptNS([[AVPlayerLayer alloc] init]);
[m_videoLayer.get() setPlayer:m_avPlayer.get()];
#ifndef NDEBUG
[m_videoLayer.get() setName:@"Video layer"];
setDelayCallbacks(true);
- RetainPtr<NSMutableDictionary> options(AdoptNS, [[NSMutableDictionary alloc] init]);
+ RetainPtr<NSMutableDictionary> options = adoptNS([[NSMutableDictionary alloc] init]);
[options.get() setObject:[NSNumber numberWithInt:AVAssetReferenceRestrictionForbidRemoteReferenceToLocal | AVAssetReferenceRestrictionForbidLocalReferenceToRemote] forKey:AVURLAssetReferenceRestrictionsKey];
#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
- RetainPtr<NSMutableDictionary> headerFields(AdoptNS, [[NSMutableDictionary alloc] init]);
+ RetainPtr<NSMutableDictionary> headerFields = adoptNS([[NSMutableDictionary alloc] init]);
String referrer = player()->referrer();
if (!referrer.isEmpty())
#endif
NSURL *cocoaURL = KURL(ParsedURLString, url);
- m_avAsset.adoptNS([[AVURLAsset alloc] initWithURL:cocoaURL options:options.get()]);
+ m_avAsset = adoptNS([[AVURLAsset alloc] initWithURL:cocoaURL options:options.get()]);
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
[[m_avAsset.get() resourceLoader] setDelegate:m_loaderDelegate.get() queue:globalLoaderDelegateQueue()];
setDelayCallbacks(true);
- m_avPlayer.adoptNS([[AVPlayer alloc] init]);
+ m_avPlayer = adoptNS([[AVPlayer alloc] init]);
[m_avPlayer.get() addObserver:m_objcObserver.get() forKeyPath:@"rate" options:nil context:(void *)MediaPlayerAVFoundationObservationContextPlayer];
#if HAVE(AVFOUNDATION_TEXT_TRACK_SUPPORT)
setDelayCallbacks(true);
// Create the player item so we can load media data.
- m_avPlayerItem.adoptNS([[AVPlayerItem alloc] initWithAsset:m_avAsset.get()]);
+ m_avPlayerItem = adoptNS([[AVPlayerItem alloc] initWithAsset:m_avAsset.get()]);
[[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(didEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:m_avPlayerItem.get()];
NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:k32BGRAPixelFormat], kCVPixelBufferPixelFormatTypeKey,
nil];
#endif
- m_videoOutput.adoptNS([[AVPlayerItemVideoOutput alloc] initWithPixelBufferAttributes:attributes]);
+ m_videoOutput = adoptNS([[AVPlayerItemVideoOutput alloc] initWithPixelBufferAttributes:attributes]);
ASSERT(m_videoOutput);
[m_avPlayerItem.get() addOutput:m_videoOutput.get()];
GraphicsContextStateSaver stateSaver(*context);
context->translate(rect.x(), rect.y() + rect.height());
context->scale(FloatSize(1.0f, -1.0f));
- RetainPtr<CIImage> image(AdoptNS, [[CIImage alloc] initWithCVImageBuffer:m_lastImage.get()]);
+ RetainPtr<CIImage> image = adoptNS([[CIImage alloc] initWithCVImageBuffer:m_lastImage.get()]);
// ciContext does not use a RetainPtr for results of contextWithCGContext:, as the returned value
// is autoreleased, and there is no non-autoreleased version of that function.
// CoreGraphics renders images tagged with DeviceRGB using the color space of the main display. When we hand such
// images to CA we need to tag them similarly so CA rendering matches CG rendering.
static CGColorSpaceRef genericRGB = CGDisplayCopyColorSpace(kCGDirectMainDisplay);
- m_pendingContentsImage.adoptCF(CGImageCreateCopyWithColorSpace(m_pendingContentsImage.get(), genericRGB));
+ m_pendingContentsImage = adoptCF(CGImageCreateCopyWithColorSpace(m_pendingContentsImage.get(), genericRGB));
}
#endif
m_contentsLayerPurpose = ContentsLayerForImage;
return;
CFRunLoopObserverContext context = { 0, this, 0, 0, 0 };
- m_runLoopObserver.adoptCF(CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting | kCFRunLoopExit, true, LayerFlushRunLoopOrder, runLoopObserverCallback, &context));
+ m_runLoopObserver = adoptCF(CFRunLoopObserverCreate(0, kCFRunLoopBeforeWaiting | kCFRunLoopExit, true, LayerFlushRunLoopOrder, runLoopObserverCallback, &context));
CFRunLoopAddObserver(currentRunLoop, m_runLoopObserver.get(), kCFRunLoopCommonModes);
}
: m_type(type)
{
if (type == Basic)
- m_animation.adoptNS([[CABasicAnimation animationWithKeyPath:keyPath] retain]);
+ m_animation = adoptNS([[CABasicAnimation animationWithKeyPath:keyPath] retain]);
else
- m_animation.adoptNS([[CAKeyframeAnimation animationWithKeyPath:keyPath] retain]);
+ m_animation = adoptNS([[CAKeyframeAnimation animationWithKeyPath:keyPath] retain]);
}
PlatformCAAnimation::PlatformCAAnimation(PlatformAnimationRef animation)
BEGIN_BLOCK_OBJC_EXCEPTIONS
- RetainPtr<NSMutableArray> array(AdoptNS, [[NSMutableArray alloc] init]);
+ RetainPtr<NSMutableArray> array = adoptNS([[NSMutableArray alloc] init]);
for (unsigned i = 0; i < filters.size(); ++i) {
String filterName = String::format("filter_%d", i);
CGFloat components[4];
op->color().getRGBA(components[0], components[1], components[2], components[3]);
- RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
- RetainPtr<CGColorRef> color(AdoptCF, CGColorCreate(colorSpace.get(), components));
+ RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
+ RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
[layer setShadowColor:color.get()];
[layer setShadowRadius:op->stdDeviation()];
[layer setShadowOpacity:1];
const BasicColorMatrixFilterOperation* op = static_cast<const BasicColorMatrixFilterOperation*>(operation);
amount = op->amount();
}
- value.adoptNS([[NSNumber numberWithDouble:amount] retain]);
+ value = adoptNS([[NSNumber numberWithDouble:amount] retain]);
break;
}
case FilterOperation::SEPIA: {
Y:WebCore::blend(sepiaNoneConstants[2][1], sepiaFullConstants[2][1], amount)
Z:WebCore::blend(sepiaNoneConstants[2][2], sepiaFullConstants[2][2], amount) W:0]; break; // inputBVector
}
- value.adoptNS(rowVector);
+ value = adoptNS(rowVector);
#endif
break;
}
amount = op->amount();
}
- value.adoptNS([[NSNumber numberWithDouble:amount] retain]);
+ value = adoptNS([[NSNumber numberWithDouble:amount] retain]);
break;
}
case FilterOperation::HUE_ROTATE: {
amount = op->amount();
}
amount = deg2rad(amount);
- value.adoptNS([[NSNumber numberWithDouble:amount] retain]);
+ value = adoptNS([[NSNumber numberWithDouble:amount] retain]);
break;
}
case FilterOperation::INVERT: {
case 2: rowVector = [[CIVector alloc] initWithX:0 Y:0 Z:multiplier W:0]; break; // inputBVector
case 3: rowVector = [[CIVector alloc] initWithX:amount Y:amount Z:amount W:0]; break; // inputBiasVector
}
- value.adoptNS(rowVector);
+ value = adoptNS(rowVector);
#endif
break;
}
amount = op->amount();
}
- value.adoptNS([[CIVector alloc] initWithX:0 Y:0 Z:0 W:amount]);
+ value = adoptNS([[CIVector alloc] initWithX:0 Y:0 Z:0 W:amount]);
#endif
break;
}
case 1: rowVector = [[CIVector alloc] initWithX:0 Y:amount Z:0 W:0]; break; // inputGVector
case 2: rowVector = [[CIVector alloc] initWithX:0 Y:0 Z:amount W:0]; break; // inputBVector
}
- value.adoptNS(rowVector);
+ value = adoptNS(rowVector);
#endif
break;
}
amount = op->amount();
}
- value.adoptNS([[NSNumber numberWithDouble:amount] retain]);
+ value = adoptNS([[NSNumber numberWithDouble:amount] retain]);
#endif
break;
}
amount = floatValueForLength(op->stdDeviation(), 0);
}
- value.adoptNS([[NSNumber numberWithDouble:amount] retain]);
+ value = adoptNS([[NSNumber numberWithDouble:amount] retain]);
break;
}
default:
}
if (layerClass)
- m_layer.adoptNS([[layerClass alloc] init]);
+ m_layer = adoptNS([[layerClass alloc] init]);
}
// Save a pointer to 'this' in the CALayer
// Add the delegate
if (!m_delegate) {
WebAnimationDelegate* webAnimationDelegate = [[WebAnimationDelegate alloc] init];
- m_delegate.adoptNS(webAnimationDelegate);
+ m_delegate = adoptNS(webAnimationDelegate);
[webAnimationDelegate setOwner:this];
}
CGFloat components[4];
value.getRGBA(components[0], components[1], components[2], components[3]);
- RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
- RetainPtr<CGColorRef> color(AdoptCF, CGColorCreate(colorSpace.get(), components));
+ RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
+ RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
BEGIN_BLOCK_OBJC_EXCEPTIONS
[m_layer.get() setBackgroundColor:color.get()];
CGFloat components[4];
value.getRGBA(components[0], components[1], components[2], components[3]);
- RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
- RetainPtr<CGColorRef> color(AdoptCF, CGColorCreate(colorSpace.get(), components));
+ RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
+ RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
BEGIN_BLOCK_OBJC_EXCEPTIONS
[m_layer.get() setBorderColor:color.get()];
// Currently we only check for solid color in the important special case of a 1x1 image.
if (image && CGImageGetWidth(image) == 1 && CGImageGetHeight(image) == 1) {
unsigned char pixel[4]; // RGBA
- RetainPtr<CGContextRef> bmap(AdoptCF, CGBitmapContextCreate(pixel, 1, 1, 8, sizeof(pixel), deviceRGBColorSpaceRef(),
+ RetainPtr<CGContextRef> bmap = adoptCF(CGBitmapContextCreate(pixel, 1, 1, 8, sizeof(pixel), deviceRGBColorSpaceRef(),
kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big));
if (!bmap)
return;
if (CGImageRef currFrame = frameAtIndex(i))
CFArrayAppendValue(array, currFrame);
}
- return RetainPtr<CFArrayRef>(AdoptCF, array);
+ return adoptCF(array);
}
void BitmapImage::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator op, BlendMode blendMode)
static size_t cursor;
cachedRGBAValues[cursor] = color.rgb();
- cachedCGColors[cursor].adoptCF(newCGColor);
+ cachedCGColors[cursor] = adoptCF(newCGColor);
if (++cursor == cacheSize)
cursor = 0;
decoder.setData(m_image->data(), true);
if (!decoder.frameCount())
return false;
- m_decodedImage.adoptCF(decoder.createFrameAtIndex(0));
+ m_decodedImage = adoptCF(decoder.createFrameAtIndex(0));
m_cgImage = m_decodedImage.get();
} else
m_cgImage = m_image->nativeImageForCurrentFrame();
// the color table, which would allow us to avoid premultiplying the
// alpha channel. Creation of a bitmap context with an alpha channel
// doesn't seem to work unless it's premultiplied.
- bitmapContext.adoptCF(CGBitmapContextCreate(0, m_imageWidth, m_imageHeight, 8, m_imageWidth * 4,
+ bitmapContext = adoptCF(CGBitmapContextCreate(0, m_imageWidth, m_imageHeight, 8, m_imageWidth * 4,
deviceRGBColorSpaceRef(),
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
if (!bitmapContext)
CGContextDrawImage(bitmapContext.get(), CGRectMake(0, 0, m_imageWidth, m_imageHeight), m_cgImage);
// Now discard the original CG image and replace it with a copy from the bitmap context.
- m_decodedImage.adoptCF(CGBitmapContextCreateImage(bitmapContext.get()));
+ m_decodedImage = adoptCF(CGBitmapContextCreateImage(bitmapContext.get()));
m_cgImage = m_decodedImage.get();
}
if (m_imageSourceFormat == DataFormatNumFormats)
return false;
- m_pixelData.adoptCF(CGDataProviderCopyData(CGImageGetDataProvider(m_cgImage)));
+ m_pixelData = adoptCF(CGDataProviderCopyData(CGImageGetDataProvider(m_cgImage)));
if (!m_pixelData)
return false;
CGContextRef cgContext = platformContext();
AffineTransform userToBaseCTM = AffineTransform(wkGetUserToBaseCTM(cgContext));
- RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.strokePattern->createPlatformPattern(userToBaseCTM));
+ RetainPtr<CGPatternRef> platformPattern = adoptCF(m_state.strokePattern->createPlatformPattern(userToBaseCTM));
if (!platformPattern)
return;
- RetainPtr<CGColorSpaceRef> patternSpace(AdoptCF, CGColorSpaceCreatePattern(0));
+ RetainPtr<CGColorSpaceRef> patternSpace = adoptCF(CGColorSpaceCreatePattern(0));
CGContextSetStrokeColorSpace(cgContext, patternSpace.get());
const CGFloat patternAlpha = 1;
CGContextRef cgContext = platformContext();
AffineTransform userToBaseCTM = AffineTransform(wkGetUserToBaseCTM(cgContext));
- RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.fillPattern->createPlatformPattern(userToBaseCTM));
+ RetainPtr<CGPatternRef> platformPattern = adoptCF(m_state.fillPattern->createPlatformPattern(userToBaseCTM));
if (!platformPattern)
return;
- RetainPtr<CGColorSpaceRef> patternSpace(AdoptCF, CGColorSpaceCreatePattern(0));
+ RetainPtr<CGColorSpaceRef> patternSpace = adoptCF(CGColorSpaceCreatePattern(0));
CGContextSetFillColorSpace(cgContext, patternSpace.get());
const CGFloat patternAlpha = 1;
if (paintingDisabled())
return;
- RetainPtr<CFURLRef> urlRef(AdoptCF, link.createCFURL());
+ RetainPtr<CFURLRef> urlRef = adoptCF(link.createCFURL());
if (!urlRef)
return;
keys[5] = kIOSurfaceAllocSize;
values[5] = CFNumberCreate(0, kCFNumberLongType, &allocSize);
- RetainPtr<CFDictionaryRef> dict(AdoptCF, CFDictionaryCreate(0, keys, values, 6, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CFDictionaryRef> dict = adoptCF(CFDictionaryCreate(0, keys, values, 6, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
for (unsigned i = 0; i < 6; i++)
CFRelease(values[i]);
- return RetainPtr<IOSurfaceRef>(AdoptCF, IOSurfaceCreate(dict.get()));
+ return adoptCF(IOSurfaceCreate(dict.get()));
}
#endif
if (accelerateRendering) {
#if USE(IOSURFACE_CANVAS_BACKING_STORE)
m_data.m_surface = createIOSurface(m_size);
- cgContext.adoptCF(wkIOSurfaceContextCreate(m_data.m_surface.get(), width.unsafeGet(), height.unsafeGet(), m_data.m_colorSpace));
+ cgContext = adoptCF(wkIOSurfaceContextCreate(m_data.m_surface.get(), width.unsafeGet(), height.unsafeGet(), m_data.m_colorSpace));
#endif
if (!cgContext)
accelerateRendering = false; // If allocation fails, fall back to non-accelerated path.
ASSERT(!(reinterpret_cast<size_t>(m_data.m_data) & 2));
m_data.m_bitmapInfo = kCGImageAlphaPremultipliedLast;
- cgContext.adoptCF(CGBitmapContextCreate(m_data.m_data, width.unsafeGet(), height.unsafeGet(), 8, m_data.m_bytesPerRow.unsafeGet(), m_data.m_colorSpace, m_data.m_bitmapInfo));
+ cgContext = adoptCF(CGBitmapContextCreate(m_data.m_data, width.unsafeGet(), height.unsafeGet(), 8, m_data.m_bytesPerRow.unsafeGet(), m_data.m_colorSpace, m_data.m_bitmapInfo));
// Create a live image that wraps the data.
- m_data.m_dataProvider.adoptCF(CGDataProviderCreateWithData(0, m_data.m_data, numBytes.unsafeGet(), releaseImageData));
+ m_data.m_dataProvider = adoptCF(CGDataProviderCreateWithData(0, m_data.m_data, numBytes.unsafeGet(), releaseImageData));
}
if (!cgContext)
if (m_resolutionScale == 1 || scaleBehavior == Unscaled)
image = copyNativeImage(copyBehavior);
else {
- image.adoptCF(copyNativeImage(DontCopyBackingStore));
- RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(0, logicalSize().width(), logicalSize().height(), 8, 4 * logicalSize().width(), deviceRGBColorSpaceRef(), kCGImageAlphaPremultipliedLast));
+ image = adoptCF(copyNativeImage(DontCopyBackingStore));
+ RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(0, logicalSize().width(), logicalSize().height(), 8, 4 * logicalSize().width(), deviceRGBColorSpaceRef(), kCGImageAlphaPremultipliedLast));
CGContextSetBlendMode(context.get(), kCGBlendModeCopy);
CGContextDrawImage(context.get(), CGRectMake(0, 0, logicalSize().width(), logicalSize().height()), image.get());
image = CGBitmapContextCreateImage(context.get());
RetainPtr<CGImageRef> image;
if (destContext == m_context || destContext->isAcceleratedContext())
- image.adoptCF(copyNativeImage(CopyBackingStore)); // Drawing into our own buffer, need to deep copy.
+ image = adoptCF(copyNativeImage(CopyBackingStore)); // Drawing into our own buffer, need to deep copy.
else
- image.adoptCF(copyNativeImage(DontCopyBackingStore));
+ image = adoptCF(copyNativeImage(DontCopyBackingStore));
FloatRect adjustedSrcRect = srcRect;
adjustedSrcRect.scale(m_resolutionScale, m_resolutionScale);
{
CGContextRef platformContextToClip = contextToClip->platformContext();
// FIXME: This image needs to be grayscale to be used as an alpha mask here.
- RetainPtr<CGImageRef> image(AdoptCF, copyNativeImage(DontCopyBackingStore));
+ RetainPtr<CGImageRef> image = adoptCF(copyNativeImage(DontCopyBackingStore));
CGContextTranslateCTM(platformContextToClip, rect.x(), rect.y() + rect.height());
CGContextScaleCTM(platformContextToClip, 1, -1);
CGContextClipToMask(platformContextToClip, FloatRect(FloatPoint(), rect.size()), image.get());
// Draw the image in CG coordinate space
IntPoint destPointInCGCoords(destPoint.x() + sourceRect.x(), (coordinateSystem == LogicalCoordinateSystem ? logicalSize() : internalSize()).height() - (destPoint.y() + sourceRect.y()) - sourceRect.height());
IntRect destRectInCGCoords(destPointInCGCoords, sourceCopySize);
- RetainPtr<CGImageRef> sourceCopyImage(AdoptCF, sourceCopy->copyNativeImage());
+ RetainPtr<CGImageRef> sourceCopyImage = adoptCF(sourceCopy->copyNativeImage());
CGContextDrawImage(destContext, destRectInCGCoords, sourceCopyImage.get());
CGContextRestoreGState(destContext);
#endif
if (!image || !uti || !data)
return false;
- RetainPtr<CGImageDestinationRef> destination(AdoptCF, CGImageDestinationCreateWithData(data, uti, 1, 0));
+ RetainPtr<CGImageDestinationRef> destination = adoptCF(CGImageDestinationCreateWithData(data, uti, 1, 0));
if (!destination)
return false;
RetainPtr<CFDictionaryRef> imageProperties = 0;
if (CFEqual(uti, jpegUTI()) && quality && *quality >= 0.0 && *quality <= 1.0) {
// Apply the compression quality to the JPEG image destination.
- RetainPtr<CFNumberRef> compressionQuality(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, quality));
+ RetainPtr<CFNumberRef> compressionQuality = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, quality));
const void* key = kCGImageDestinationLossyCompressionQuality;
const void* value = compressionQuality.get();
- imageProperties.adoptCF(CFDictionaryCreate(0, &key, &value, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ imageProperties = adoptCF(CFDictionaryCreate(0, &key, &value, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
}
// Setting kCGImageDestinationBackgroundColor to black for JPEG images in imageProperties would save some math
RetainPtr<CFStringRef> uti = utiFromMIMEType(mimeType);
ASSERT(uti);
- RetainPtr<CFMutableDataRef> data(AdoptCF, CFDataCreateMutable(kCFAllocatorDefault, 0));
+ RetainPtr<CFMutableDataRef> data = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, 0));
if (!CGImageEncodeToData(image, uti.get(), quality, data.get()))
return "data:,";
return "data:,";
RetainPtr<CGDataProviderRef> dataProvider;
- dataProvider.adoptCF(CGDataProviderCreateWithData(0, premultipliedData->data(), 4 * logicalSize().width() * logicalSize().height(), 0));
+ dataProvider = adoptCF(CGDataProviderCreateWithData(0, premultipliedData->data(), 4 * logicalSize().width() * logicalSize().height(), 0));
if (!dataProvider)
return "data:,";
- image.adoptCF(CGImageCreate(logicalSize().width(), logicalSize().height(), 8, 32, 4 * logicalSize().width(),
+ image = adoptCF(CGImageCreate(logicalSize().width(), logicalSize().height(), 8, 32, 4 * logicalSize().width(),
deviceRGBColorSpaceRef(), kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast,
dataProvider.get(), 0, false, kCGRenderingIntentDefault));
} else if (m_resolutionScale == 1)
- image.adoptCF(copyNativeImage(CopyBackingStore));
+ image = adoptCF(copyNativeImage(CopyBackingStore));
else {
- image.adoptCF(copyNativeImage(DontCopyBackingStore));
- RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(0, logicalSize().width(), logicalSize().height(), 8, 4 * logicalSize().width(), deviceRGBColorSpaceRef(), kCGImageAlphaPremultipliedLast));
+ image = adoptCF(copyNativeImage(DontCopyBackingStore));
+ RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(0, logicalSize().width(), logicalSize().height(), 8, 4 * logicalSize().width(), deviceRGBColorSpaceRef(), kCGImageAlphaPremultipliedLast));
CGContextSetBlendMode(context.get(), kCGBlendModeCopy);
CGContextDrawImage(context.get(), CGRectMake(0, 0, logicalSize().width(), logicalSize().height()), image.get());
- image.adoptCF(CGBitmapContextCreateImage(context.get()));
+ image = adoptCF(CGBitmapContextCreateImage(context.get()));
}
return CGImageToDataURL(image.get(), mimeType, quality);
}
RetainPtr<CGDataProviderRef> dataProvider;
- dataProvider.adoptCF(CGDataProviderCreateWithData(0, data, 4 * source.width() * source.height(), 0));
+ dataProvider = adoptCF(CGDataProviderCreateWithData(0, data, 4 * source.width() * source.height(), 0));
if (!dataProvider)
return "data:,";
RetainPtr<CGImageRef> image;
- image.adoptCF(CGImageCreate(source.width(), source.height(), 8, 32, 4 * source.width(),
+ image = adoptCF(CGImageCreate(source.width(), source.height(), 8, 32, 4 * source.width(),
deviceRGBColorSpaceRef(), kCGBitmapByteOrderDefault | dataAlphaInfo,
dataProvider.get(), 0, false, kCGRenderingIntentDefault));
}
#endif
if (resolutionScale != 1) {
- RetainPtr<CGContextRef> sourceContext(AdoptCF, CGBitmapContextCreate(srcRows, width.unsafeGet(), height.unsafeGet(), 8, srcBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
- RetainPtr<CGImageRef> sourceImage(AdoptCF, CGBitmapContextCreateImage(sourceContext.get()));
- RetainPtr<CGContextRef> destinationContext(AdoptCF, CGBitmapContextCreate(destRows, destw, desth, 8, destBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
+ RetainPtr<CGContextRef> sourceContext = adoptCF(CGBitmapContextCreate(srcRows, width.unsafeGet(), height.unsafeGet(), 8, srcBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
+ RetainPtr<CGImageRef> sourceImage = adoptCF(CGBitmapContextCreateImage(sourceContext.get()));
+ RetainPtr<CGContextRef> destinationContext = adoptCF(CGBitmapContextCreate(destRows, destw, desth, 8, destBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
CGContextSetBlendMode(destinationContext.get(), kCGBlendModeCopy);
CGContextDrawImage(destinationContext.get(), CGRectMake(0, 0, width.unsafeGet() / resolutionScale, height.unsafeGet() / resolutionScale), sourceImage.get()); // FIXME: Add subpixel translation.
if (!unmultiplied)
}
#else
if (resolutionScale != 1) {
- RetainPtr<CGContextRef> sourceContext(AdoptCF, CGBitmapContextCreate(srcRows, width.unsafeGet(), height.unsafeGet(), 8, srcBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
- RetainPtr<CGImageRef> sourceImage(AdoptCF, CGBitmapContextCreateImage(sourceContext.get()));
- RetainPtr<CGContextRef> destinationContext(AdoptCF, CGBitmapContextCreate(destRows, destw, desth, 8, destBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
+ RetainPtr<CGContextRef> sourceContext = adoptCF(CGBitmapContextCreate(srcRows, width.unsafeGet(), height.unsafeGet(), 8, srcBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
+ RetainPtr<CGImageRef> sourceImage = adoptCF(CGBitmapContextCreateImage(sourceContext.get()));
+ RetainPtr<CGContextRef> destinationContext = adoptCF(CGBitmapContextCreate(destRows, destw, desth, 8, destBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
CGContextSetBlendMode(destinationContext.get(), kCGBlendModeCopy);
CGContextDrawImage(destinationContext.get(), CGRectMake(0, 0, width.unsafeGet() / resolutionScale, height.unsafeGet() / resolutionScale), sourceImage.get()); // FIXME: Add subpixel translation.
}
#endif
if (resolutionScale != 1) {
- RetainPtr<CGContextRef> sourceContext(AdoptCF, CGBitmapContextCreate(srcRows, width.unsafeGet(), height.unsafeGet(), 8, srcBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
- RetainPtr<CGImageRef> sourceImage(AdoptCF, CGBitmapContextCreateImage(sourceContext.get()));
- RetainPtr<CGContextRef> destinationContext(AdoptCF, CGBitmapContextCreate(destRows, destw.unsafeGet(), desth.unsafeGet(), 8, destBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
+ RetainPtr<CGContextRef> sourceContext = adoptCF(CGBitmapContextCreate(srcRows, width.unsafeGet(), height.unsafeGet(), 8, srcBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
+ RetainPtr<CGImageRef> sourceImage = adoptCF(CGBitmapContextCreateImage(sourceContext.get()));
+ RetainPtr<CGContextRef> destinationContext = adoptCF(CGBitmapContextCreate(destRows, destw.unsafeGet(), desth.unsafeGet(), 8, destBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
CGContextSetBlendMode(destinationContext.get(), kCGBlendModeCopy);
CGContextDrawImage(destinationContext.get(), CGRectMake(0, 0, width.unsafeGet() / resolutionScale, height.unsafeGet() / resolutionScale), sourceImage.get()); // FIXME: Add subpixel translation.
if (!unmultiplied)
}
#else
if (resolutionScale != 1) {
- RetainPtr<CGContextRef> sourceContext(AdoptCF, CGBitmapContextCreate(srcRows, width.unsafeGet(), height.unsafeGet(), 8, srcBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
- RetainPtr<CGImageRef> sourceImage(AdoptCF, CGBitmapContextCreateImage(sourceContext.get()));
- RetainPtr<CGContextRef> destinationContext(AdoptCF, CGBitmapContextCreate(destRows, destw.unsafeGet(), desth.unsafeGet(), 8, destBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
+ RetainPtr<CGContextRef> sourceContext = adoptCF(CGBitmapContextCreate(srcRows, width.unsafeGet(), height.unsafeGet(), 8, srcBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
+ RetainPtr<CGImageRef> sourceImage = adoptCF(CGBitmapContextCreateImage(sourceContext.get()));
+ RetainPtr<CGContextRef> destinationContext = adoptCF(CGBitmapContextCreate(destRows, destw.unsafeGet(), desth.unsafeGet(), 8, destBytesPerRow, m_colorSpace, kCGImageAlphaPremultipliedLast));
CGContextSetBlendMode(destinationContext.get(), kCGBlendModeCopy);
CGContextDrawImage(destinationContext.get(), CGRectMake(0, 0, width.unsafeGet() / resolutionScale, height.unsafeGet() / resolutionScale), sourceImage.get()); // FIXME: Add subpixel translation.
case ColorSpaceDeviceRGB:
return originalImage;
case ColorSpaceSRGB:
- return RetainPtr<CGImageRef>(AdoptCF, CGImageCreateCopyWithColorSpace(originalImage, sRGBColorSpaceRef()));
+ return adoptCF(CGImageCreateCopyWithColorSpace(originalImage, sRGBColorSpaceRef()));
case ColorSpaceLinearRGB:
- return RetainPtr<CGImageRef>(AdoptCF, CGImageCreateCopyWithColorSpace(originalImage, linearRGBColorSpaceRef()));
+ return adoptCF(CGImageCreateCopyWithColorSpace(originalImage, linearRGBColorSpaceRef()));
}
ASSERT_NOT_REACHED();
// Copying a sub-image out of a partially-decoded image stops the decoding of the original image. It should never happen
// because sub-images are only used for border-image, which only renders when the image is fully decoded.
ASSERT(h == height());
- subImage.adoptCF(CGImageCreateWithImageInRect(tileImage, tileRect));
+ subImage = adoptCF(CGImageCreateWithImageInRect(tileImage, tileRect));
}
// Adjust the color space.
matrix = CGAffineTransformConcat(matrix, CGContextGetCTM(context));
// The top of a partially-decoded image is drawn at the bottom of the tile. Map it to the top.
matrix = CGAffineTransformTranslate(matrix, 0, size().height() - h);
- RetainPtr<CGPatternRef> pattern(AdoptCF, CGPatternCreate(subImage.get(), CGRectMake(0, 0, tileRect.width(), tileRect.height()),
+ RetainPtr<CGPatternRef> pattern = adoptCF(CGPatternCreate(subImage.get(), CGRectMake(0, 0, tileRect.width(), tileRect.height()),
matrix, tileRect.width(), tileRect.height(),
kCGPatternTilingConstantSpacing, true, &patternCallbacks));
if (!pattern)
return;
- RetainPtr<CGColorSpaceRef> patternSpace(AdoptCF, CGColorSpaceCreatePattern(0));
+ RetainPtr<CGColorSpaceRef> patternSpace = adoptCF(CGColorSpaceCreatePattern(0));
CGFloat alpha = 1;
- RetainPtr<CGColorRef> color(AdoptCF, CGColorCreateWithPattern(patternSpace.get(), pattern.get(), &alpha));
+ RetainPtr<CGColorRef> color = adoptCF(CGColorCreateWithPattern(patternSpace.get(), pattern.get(), &alpha));
CGContextSetFillColorSpace(context, patternSpace.get());
// FIXME: Really want a public API for this. It is just CGContextSetBaseCTM(context, CGAffineTransformIdentiy).
m_decoder = CGImageSourceCreateIncremental(0);
// On Mac the NSData inside the SharedBuffer can be secretly appended to without the SharedBuffer's knowledge. We use SharedBuffer's ability
// to wrap itself inside CFData to get around this, ensuring that ImageIO is really looking at the SharedBuffer.
- RetainPtr<CFDataRef> cfData(AdoptCF, data->createCFData());
+ RetainPtr<CFDataRef> cfData = adoptCF(data->createCFData());
CGImageSourceUpdateData(m_decoder, cfData.get(), allDataReceived);
#else
if (!m_decoder) {
// does not provide a way to lock down the byte pointer and guarantee that it won't move, which
// is a requirement for using the GetBytePointer callback.
CGDataProviderDirectCallbacks providerCallbacks = { 0, 0, 0, sharedBufferGetBytesAtPosition, sharedBufferRelease };
- RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateDirect(data, data->size(), &providerCallbacks));
+ RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateDirect(data, data->size(), &providerCallbacks));
CGImageSourceUpdateDataProvider(m_decoder, dataProvider.get(), allDataReceived);
#endif
}
// Ragnaros yells: TOO SOON! You have awakened me TOO SOON, Executus!
if (imageSourceStatus >= kCGImageStatusIncomplete) {
- RetainPtr<CFDictionaryRef> image0Properties(AdoptCF, CGImageSourceCopyPropertiesAtIndex(m_decoder, 0, imageSourceOptions(SkipMetadata)));
+ RetainPtr<CFDictionaryRef> image0Properties = adoptCF(CGImageSourceCopyPropertiesAtIndex(m_decoder, 0, imageSourceOptions(SkipMetadata)));
if (image0Properties) {
CFNumberRef widthNumber = (CFNumberRef)CFDictionaryGetValue(image0Properties.get(), kCGImagePropertyPixelWidth);
CFNumberRef heightNumber = (CFNumberRef)CFDictionaryGetValue(image0Properties.get(), kCGImagePropertyPixelHeight);
IntSize ImageSource::frameSizeAtIndex(size_t index, RespectImageOrientationEnum shouldRespectOrientation) const
{
- RetainPtr<CFDictionaryRef> properties(AdoptCF, CGImageSourceCopyPropertiesAtIndex(m_decoder, index, imageSourceOptions(SkipMetadata)));
+ RetainPtr<CFDictionaryRef> properties = adoptCF(CGImageSourceCopyPropertiesAtIndex(m_decoder, index, imageSourceOptions(SkipMetadata)));
if (!properties)
return IntSize();
ImageOrientation ImageSource::orientationAtIndex(size_t index) const
{
- RetainPtr<CFDictionaryRef> properties(AdoptCF, CGImageSourceCopyPropertiesAtIndex(m_decoder, index, imageSourceOptions(SkipMetadata)));
+ RetainPtr<CFDictionaryRef> properties = adoptCF(CGImageSourceCopyPropertiesAtIndex(m_decoder, index, imageSourceOptions(SkipMetadata)));
if (!properties)
return DefaultImageOrientation;
bool ImageSource::getHotSpot(IntPoint& hotSpot) const
{
- RetainPtr<CFDictionaryRef> properties(AdoptCF, CGImageSourceCopyPropertiesAtIndex(m_decoder, 0, imageSourceOptions(SkipMetadata)));
+ RetainPtr<CFDictionaryRef> properties = adoptCF(CGImageSourceCopyPropertiesAtIndex(m_decoder, 0, imageSourceOptions(SkipMetadata)));
if (!properties)
return false;
if (!initialized())
return result;
- RetainPtr<CFDictionaryRef> properties(AdoptCF, CGImageSourceCopyProperties(m_decoder, imageSourceOptions(SkipMetadata)));
+ RetainPtr<CFDictionaryRef> properties = adoptCF(CGImageSourceCopyProperties(m_decoder, imageSourceOptions(SkipMetadata)));
if (properties) {
CFDictionaryRef gifProperties = (CFDictionaryRef)CFDictionaryGetValue(properties.get(), kCGImagePropertyGIFDictionary);
if (gifProperties) {
if (!initialized())
return 0;
- RetainPtr<CGImageRef> image(AdoptCF, CGImageSourceCreateImageAtIndex(m_decoder, index, imageSourceOptions(SkipMetadata)));
+ RetainPtr<CGImageRef> image = adoptCF(CGImageSourceCreateImageAtIndex(m_decoder, index, imageSourceOptions(SkipMetadata)));
CFStringRef imageUTI = CGImageSourceGetType(m_decoder);
static const CFStringRef xbmUTI = CFSTR("public.xbitmap-image");
if (!imageUTI || !CFEqual(imageUTI, xbmUTI))
// If it is an xbm image, mask out all the white areas to render them transparent.
const CGFloat maskingColors[6] = {255, 255, 255, 255, 255, 255};
- RetainPtr<CGImageRef> maskedImage(AdoptCF, CGImageCreateWithMaskingColors(image.get(), maskingColors));
+ RetainPtr<CGImageRef> maskedImage = adoptCF(CGImageCreateWithMaskingColors(image.get(), maskingColors));
if (!maskedImage)
return image.leakRef();
return 0;
float duration = 0;
- RetainPtr<CFDictionaryRef> properties(AdoptCF, CGImageSourceCopyPropertiesAtIndex(m_decoder, index, imageSourceOptions(SkipMetadata)));
+ RetainPtr<CFDictionaryRef> properties = adoptCF(CGImageSourceCopyPropertiesAtIndex(m_decoder, index, imageSourceOptions(SkipMetadata)));
if (properties) {
CFDictionaryRef typeProperties = (CFDictionaryRef)CFDictionaryGetValue(properties.get(), kCGImagePropertyGIFDictionary);
if (typeProperties) {
#if PLATFORM(MAC)
// On Mac the NSData inside the SharedBuffer can be secretly appended to without the SharedBuffer's knowledge. We use SharedBuffer's ability
// to wrap itself inside CFData to get around this, ensuring that ImageIO is really looking at the SharedBuffer.
- RetainPtr<CFDataRef> data(AdoptCF, this->data()->createCFData());
- RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(data.get()));
+ RetainPtr<CFDataRef> data = adoptCF(this->data()->createCFData());
+ RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData(data.get()));
#else
// Create a CGDataProvider to wrap the SharedBuffer.
// We use the GetBytesAtPosition callback rather than the GetBytePointer one because SharedBuffer
// does not provide a way to lock down the byte pointer and guarantee that it won't move, which
// is a requirement for using the GetBytePointer callback.
CGDataProviderDirectCallbacks providerCallbacks = { 0, 0, 0, sharedBufferGetBytesAtPosition, 0 };
- RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateDirect(this->data(), this->data()->size(), &providerCallbacks));
+ RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateDirect(this->data(), this->data()->size(), &providerCallbacks));
#endif
m_document = CGPDFDocumentCreateWithProvider(dataProvider.get());
setCurrentPage(0);
static CGContextRef createScratchContext()
{
CGDataConsumerCallbacks callbacks = { putBytesNowhere, 0 };
- RetainPtr<CGDataConsumerRef> consumer(AdoptCF, CGDataConsumerCreate(0, &callbacks));
+ RetainPtr<CGDataConsumerRef> consumer = adoptCF(CGDataConsumerCreate(0, &callbacks));
CGContextRef context = CGPDFContextCreate(consumer.get(), 0, 0);
CGFloat black[4] = { 0, 0, 0, 1 };
return false;
// CGPathContainsPoint returns false for non-closed paths, as a work-around, we copy and close the path first. Radar 4758998 asks for a better CG API to use
- RetainPtr<CGMutablePathRef> path(AdoptCF, copyCGPathClosingSubpaths(m_path));
+ RetainPtr<CGMutablePathRef> path = adoptCF(copyCGPathClosingSubpaths(m_path));
bool ret = CGPathContainsPoint(path.get(), 0, point, rule == RULE_EVENODD ? true : false);
return ret;
}
if (m_font)
CFRetain(m_font);
- m_cgFont.adoptCF(cgFont);
+ m_cgFont = adoptCF(cgFont);
}
FontPlatformData:: ~FontPlatformData()
NSFont* loadedFont = 0;
loadFont(m_font, m_size, loadedFont, cgFont);
- m_cgFont.adoptCF(cgFont);
+ m_cgFont = adoptCF(cgFont);
#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
{
CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font));
static CFDictionaryRef createFeatureSettingDictionary(int featureTypeIdentifier, int featureSelectorIdentifier)
{
- RetainPtr<CFNumberRef> featureTypeIdentifierNumber(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureTypeIdentifier));
- RetainPtr<CFNumberRef> featureSelectorIdentifierNumber(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureSelectorIdentifier));
+ RetainPtr<CFNumberRef> featureTypeIdentifierNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureTypeIdentifier));
+ RetainPtr<CFNumberRef> featureSelectorIdentifierNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureSelectorIdentifier));
const void* settingKeys[] = { kCTFontFeatureTypeIdentifierKey, kCTFontFeatureSelectorIdentifierKey };
const void* settingValues[] = { featureTypeIdentifierNumber.get(), featureSelectorIdentifierNumber.get() };
const void* keys[] = { kCTFontCascadeListAttribute };
const void* descriptors[] = { CTFontDescriptorCreateWithNameAndSize(CFSTR("LastResort"), 0) };
const void* values[] = { CFArrayCreate(kCFAllocatorDefault, descriptors, WTF_ARRAY_LENGTH(descriptors), &kCFTypeArrayCallBacks) };
- RetainPtr<CFDictionaryRef> attributes(AdoptCF, CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
descriptor = CTFontDescriptorCreateWithAttributes(attributes.get());
if (descriptor)
return descriptor;
- RetainPtr<CFDictionaryRef> lineInitialSwashesOffSetting(AdoptCF, createFeatureSettingDictionary(kSmartSwashType, kLineInitialSwashesOffSelector));
- RetainPtr<CFDictionaryRef> lineFinalSwashesOffSetting(AdoptCF, createFeatureSettingDictionary(kSmartSwashType, kLineFinalSwashesOffSelector));
+ RetainPtr<CFDictionaryRef> lineInitialSwashesOffSetting = adoptCF(createFeatureSettingDictionary(kSmartSwashType, kLineInitialSwashesOffSelector));
+ RetainPtr<CFDictionaryRef> lineFinalSwashesOffSetting = adoptCF(createFeatureSettingDictionary(kSmartSwashType, kLineFinalSwashesOffSelector));
const void* settingDictionaries[] = { lineInitialSwashesOffSetting.get(), lineFinalSwashesOffSetting.get() };
- RetainPtr<CFArrayRef> featureSettings(AdoptCF, CFArrayCreate(kCFAllocatorDefault, settingDictionaries, WTF_ARRAY_LENGTH(settingDictionaries), &kCFTypeArrayCallBacks));
+ RetainPtr<CFArrayRef> featureSettings = adoptCF(CFArrayCreate(kCFAllocatorDefault, settingDictionaries, WTF_ARRAY_LENGTH(settingDictionaries), &kCFTypeArrayCallBacks));
const void* keys[] = { kCTFontFeatureSettingsAttribute };
const void* values[] = { featureSettings.get() };
- RetainPtr<CFDictionaryRef> attributes(AdoptCF, CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
descriptor = CTFontDescriptorCreateCopyWithAttributes(cascadeToLastResortFontDescriptor(), attributes.get());
m_CTFont = toCTFontRef(m_font);
if (m_CTFont) {
CTFontDescriptorRef fontDescriptor;
- RetainPtr<CFStringRef> postScriptName(AdoptCF, CTFontCopyPostScriptName(m_CTFont.get()));
+ RetainPtr<CFStringRef> postScriptName = adoptCF(CTFontCopyPostScriptName(m_CTFont.get()));
// Hoefler Text Italic has line-initial and -final swashes enabled by default, so disable them.
if (CFEqual(postScriptName.get(), CFSTR("HoeflerText-Italic")) || CFEqual(postScriptName.get(), CFSTR("HoeflerText-BlackItalic")))
fontDescriptor = cascadeToLastResortAndDisableSwashesFontDescriptor();
else
fontDescriptor = cascadeToLastResortFontDescriptor();
- m_CTFont.adoptCF(CTFontCreateCopyWithAttributes(m_CTFont.get(), m_size, 0, fontDescriptor));
+ m_CTFont = adoptCF(CTFontCreateCopyWithAttributes(m_CTFont.get(), m_size, 0, fontDescriptor));
} else
- m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, cascadeToLastResortFontDescriptor()));
+ m_CTFont = adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, cascadeToLastResortFontDescriptor()));
if (m_widthVariant != RegularWidth) {
int featureTypeValue = kTextSpacingType;
int featureSelectorValue = mapFontWidthVariantToCTFeatureSelector(m_widthVariant);
- RetainPtr<CTFontDescriptorRef> sourceDescriptor(AdoptCF, CTFontCopyFontDescriptor(m_CTFont.get()));
- RetainPtr<CFNumberRef> featureType(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureTypeValue));
- RetainPtr<CFNumberRef> featureSelector(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureSelectorValue));
- RetainPtr<CTFontDescriptorRef> newDescriptor(AdoptCF, CTFontDescriptorCreateCopyWithFeature(sourceDescriptor.get(), featureType.get(), featureSelector.get()));
- RetainPtr<CTFontRef> newFont(AdoptCF, CTFontCreateWithFontDescriptor(newDescriptor.get(), m_size, 0));
+ RetainPtr<CTFontDescriptorRef> sourceDescriptor = adoptCF(CTFontCopyFontDescriptor(m_CTFont.get()));
+ RetainPtr<CFNumberRef> featureType = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureTypeValue));
+ RetainPtr<CFNumberRef> featureSelector = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &featureSelectorValue));
+ RetainPtr<CTFontDescriptorRef> newDescriptor = adoptCF(CTFontDescriptorCreateCopyWithFeature(sourceDescriptor.get(), featureType.get(), featureSelector.get()));
+ RetainPtr<CTFontRef> newFont = adoptCF(CTFontCreateWithFontDescriptor(newDescriptor.get(), m_size, 0));
if (newFont)
m_CTFont = newFont;
#ifndef NDEBUG
String FontPlatformData::description() const
{
- RetainPtr<CFStringRef> cgFontDescription(AdoptCF, CFCopyDescription(cgFont()));
+ RetainPtr<CFStringRef> cgFontDescription = adoptCF(CFCopyDescription(cgFont()));
return String(cgFontDescription.get()) + " " + String::number(m_size)
+ (m_syntheticBold ? " synthetic bold" : "") + (m_syntheticOblique ? " synthetic oblique" : "") + (m_orientation ? " vertical orientation" : "");
}
// Create the WebGLLayer
BEGIN_BLOCK_OBJC_EXCEPTIONS
- m_platformLayer.adoptNS([[WebGLLayer alloc] initWithGraphicsContext3D:m_context.get()]);
+ m_platformLayer = adoptNS([[WebGLLayer alloc] initWithGraphicsContext3D:m_context.get()]);
#ifndef NDEBUG
[m_platformLayer.get() setName:@"DrawingBuffer Layer"];
#endif
const WebCore::SimpleFontData* fontData = _font->fontDataAt(index)->fontDataForCharacter(_character);
fontDescriptor = CTFontCopyFontDescriptor(fontData->platformData().ctFont());
- _fontDescriptors[index] = RetainPtr<CTFontDescriptorRef>(AdoptCF, fontDescriptor);
+ _fontDescriptors[index] = adoptCF(fontDescriptor);
return (id)fontDescriptor;
}
U16_GET(cp, 0, 0, length, baseCharacter);
fontData = m_font.fontDataAt(0)->fontDataForCharacter(baseCharacter);
- RetainPtr<WebCascadeList> cascadeList(AdoptNS, [[WebCascadeList alloc] initWithFont:&m_font character:baseCharacter]);
+ RetainPtr<WebCascadeList> cascadeList = adoptNS([[WebCascadeList alloc] initWithFont:&m_font character:baseCharacter]);
- stringAttributes.adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, fontData->getCFStringAttributes(m_font.typesettingFeatures(), fontData->platformData().orientation())));
+ stringAttributes = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, fontData->getCFStringAttributes(m_font.typesettingFeatures(), fontData->platformData().orientation())));
static const void* attributeKeys[] = { kCTFontCascadeListAttribute };
const void* values[] = { cascadeList.get() };
- RetainPtr<CFDictionaryRef> attributes(AdoptCF, CFDictionaryCreate(kCFAllocatorDefault, attributeKeys, values, sizeof(attributeKeys) / sizeof(*attributeKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
- RetainPtr<CTFontDescriptorRef> fontDescriptor(AdoptCF, CTFontDescriptorCreateWithAttributes(attributes.get()));
- RetainPtr<CTFontRef> fontWithCascadeList(AdoptCF, CTFontCreateCopyWithAttributes(fontData->platformData().ctFont(), m_font.pixelSize(), 0, fontDescriptor.get()));
+ RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, attributeKeys, values, sizeof(attributeKeys) / sizeof(*attributeKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
+ RetainPtr<CTFontRef> fontWithCascadeList = adoptCF(CTFontCreateCopyWithAttributes(fontData->platformData().ctFont(), m_font.pixelSize(), 0, fontDescriptor.get()));
CFDictionarySetValue(const_cast<CFMutableDictionaryRef>(stringAttributes.get()), kCTFontAttributeName, fontWithCascadeList.get());
} else
stringAttributes = fontData->getCFStringAttributes(m_font.typesettingFeatures(), fontData->platformData().orientation());
#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
ProviderInfo info = { cp, length, stringAttributes.get() };
- RetainPtr<CTTypesetterRef> typesetter(AdoptCF, wkCreateCTTypesetterWithUniCharProviderAndOptions(&provideStringAndAttributes, 0, &info, m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
+ RetainPtr<CTTypesetterRef> typesetter = adoptCF(wkCreateCTTypesetterWithUniCharProviderAndOptions(&provideStringAndAttributes, 0, &info, m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
#else
- RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, cp, length, kCFAllocatorNull));
- RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(kCFAllocatorDefault, string.get(), stringAttributes.get()));
- RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
+ RetainPtr<CFStringRef> string = adoptCF(CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, cp, length, kCFAllocatorNull));
+ RetainPtr<CFAttributedStringRef> attributedString = adoptCF(CFAttributedStringCreate(kCFAllocatorDefault, string.get(), stringAttributes.get()));
+ RetainPtr<CTTypesetterRef> typesetter = adoptCF(CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions));
#endif
- line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0)));
+ line = adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0)));
} else {
ProviderInfo info = { cp, length, stringAttributes.get() };
- line.adoptCF(wkCreateCTLineWithUniCharProvider(&provideStringAndAttributes, 0, &info));
+ line = adoptCF(wkCreateCTLineWithUniCharProvider(&provideStringAndAttributes, 0, &info));
}
m_coreTextLines.append(line.get());
ASSERT(CFGetTypeID(runFont) == CTFontGetTypeID());
if (!CFEqual(runFont, fontData->platformData().ctFont())) {
// Begin trying to see if runFont matches any of the fonts in the fallback list.
- RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont, 0));
+ RetainPtr<CGFontRef> runCGFont = adoptCF(CTFontCopyGraphicsFont(runFont, 0));
unsigned i = 0;
for (const FontData* candidateFontData = m_font.fontDataAt(i); candidateFontData; candidateFontData = m_font.fontDataAt(++i)) {
runFontData = candidateFontData->fontDataForCharacter(baseCharacter);
- RetainPtr<CGFontRef> cgFont(AdoptCF, CTFontCopyGraphicsFont(runFontData->platformData().ctFont(), 0));
+ RetainPtr<CGFontRef> cgFont = adoptCF(CTFontCopyGraphicsFont(runFontData->platformData().ctFont(), 0));
if (CFEqual(cgFont.get(), runCGFont.get()))
break;
runFontData = 0;
// Rather than using runFont as an NSFont and wrapping it in a FontPlatformData, go through
// the font cache and ultimately through NSFontManager in order to get an NSFont with the right
// NSFontRenderingMode.
- RetainPtr<CFStringRef> fontName(AdoptCF, CTFontCopyPostScriptName(runFont));
+ RetainPtr<CFStringRef> fontName = adoptCF(CTFontCopyPostScriptName(runFont));
if (CFEqual(fontName.get(), CFSTR("LastResort"))) {
m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr()));
continue;
ATSFontContainerRef containerRef = 0;
- RetainPtr<CFDataRef> bufferData(AdoptCF, buffer->createCFData());
- RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get()));
+ RetainPtr<CFDataRef> bufferData = adoptCF(buffer->createCFData());
+ RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData(bufferData.get()));
RetainPtr<CGFontRef> cgFontRef = adoptCF(CGFontCreateWithDataProvider(dataProvider.get()));
if (!cgFontRef)
}
} else {
// We ask CoreText for possible vertical variant glyphs
- RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, buffer, bufferLength, kCFAllocatorNull));
- RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(0, fontData->hasVerticalGlyphs() ? Vertical : Horizontal)));
- RetainPtr<CTLineRef> line(AdoptCF, CTLineCreateWithAttributedString(attributedString.get()));
+ RetainPtr<CFStringRef> string = adoptCF(CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, buffer, bufferLength, kCFAllocatorNull));
+ RetainPtr<CFAttributedStringRef> attributedString = adoptCF(CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(0, fontData->hasVerticalGlyphs() ? Vertical : Horizontal)));
+ RetainPtr<CTLineRef> line = adoptCF(CTLineCreateWithAttributedString(attributedString.get()));
CFArrayRef runArray = CTLineGetGlyphRuns(line.get());
CFIndex runCount = CFArrayGetCount(runArray);
// For the CGFont comparison in the loop, use the CGFont that Core Text assigns to the CTFont. This may
// be non-CFEqual to fontData->platformData().cgFont().
- RetainPtr<CGFontRef> cgFont(AdoptCF, CTFontCopyGraphicsFont(fontData->platformData().ctFont(), 0));
+ RetainPtr<CGFontRef> cgFont = adoptCF(CTFontCopyGraphicsFont(fontData->platformData().ctFont(), 0));
for (CFIndex r = 0; r < runCount && !done ; ++r) {
// CTLine could map characters over multiple fonts using its own font fallback list.
CFDictionaryRef attributes = CTRunGetAttributes(ctRun);
CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(attributes, kCTFontAttributeName));
- RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont, 0));
+ RetainPtr<CGFontRef> runCGFont = adoptCF(CTFontCopyGraphicsFont(runFont, 0));
// Use CGFont here as CFEqual for CTFont counts all attributes for font.
bool gotBaseFont = CFEqual(cgFont.get(), runCGFont.get());
if (gotBaseFont || fontData->platformData().isCompositeFontReference()) {
// Create the WebGLLayer
BEGIN_BLOCK_OBJC_EXCEPTIONS
- m_webGLLayer.adoptNS([[WebGLLayer alloc] initWithGraphicsContext3D:this]);
+ m_webGLLayer = adoptNS([[WebGLLayer alloc] initWithGraphicsContext3D:this]);
#ifndef NDEBUG
[m_webGLLayer.get() setName:@"WebGL Layer"];
#endif
offset += radius;
CGColorRef colorRef = color.isValid() ? cachedCGColor(color, ColorSpaceDeviceRGB) : 0;
- RetainPtr<CGMutablePathRef> focusRingPath(AdoptCF, CGPathCreateMutable());
+ RetainPtr<CGMutablePathRef> focusRingPath = adoptCF(CGPathCreateMutable());
unsigned rectCount = rects.size();
for (unsigned i = 0; i < rectCount; i++)
CGPathAddRect(focusRingPath.get(), 0, CGRectInset(rects[i], -offset, -offset));
return linearSRGBSpace;
RetainPtr<NSString> iccProfilePath = [[NSBundle bundleWithIdentifier:@"com.apple.WebCore"] pathForResource:@"linearSRGB" ofType:@"icc"];
- RetainPtr<NSData> iccProfileData(AdoptNS, [[NSData alloc] initWithContentsOfFile:iccProfilePath.get()]);
+ RetainPtr<NSData> iccProfileData = adoptNS([[NSData alloc] initWithContentsOfFile:iccProfilePath.get()]);
if (iccProfileData)
linearSRGBSpace = CGColorSpaceCreateWithICCProfile((CFDataRef)iccProfileData.get());
unsigned numValidFrames = images.size();
- RetainPtr<CFMutableDataRef> data(AdoptCF, CFDataCreateMutable(0, 0));
- RetainPtr<CGImageDestinationRef> destination(AdoptCF, CGImageDestinationCreateWithData(data.get(), kUTTypeTIFF, numValidFrames, 0));
+ RetainPtr<CFMutableDataRef> data = adoptCF(CFDataCreateMutable(0, 0));
+ RetainPtr<CGImageDestinationRef> destination = adoptCF(CGImageDestinationCreateWithData(data.get(), kUTTypeTIFF, numValidFrames, 0));
if (!destination)
return 0;
if (!data)
return 0;
- m_nsImage.adoptNS([[NSImage alloc] initWithData:(NSData*)data]);
+ m_nsImage = adoptNS([[NSImage alloc] initWithData:(NSData*)data]);
return m_nsImage.get();
}
MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit(MediaPlayer* player)
: m_player(player)
- , m_objcObserver(AdoptNS, [[WebCoreMovieObserver alloc] initWithCallback:this])
+ , m_objcObserver(adoptNS([[WebCoreMovieObserver alloc] initWithCallback:this]))
, m_seekTo(-1)
, m_seekTimer(this, &MediaPlayerPrivateQTKit::seekTimerFired)
, m_networkState(MediaPlayer::Empty)
return;
NSError *error = nil;
- m_qtMovie.adoptNS([[QTMovie alloc] initWithAttributes:movieAttributes error:&error]);
+ m_qtMovie = adoptNS([[QTMovie alloc] initWithAttributes:movieAttributes error:&error]);
if (!m_qtMovie)
return;
// delay callbacks as we *will* get notifications during setup
[m_objcObserver.get() setDelayCallbacks:YES];
- m_qtMovieView.adoptNS([[QTMovieView alloc] init]);
+ m_qtMovieView = adoptNS([[QTMovieView alloc] init]);
setSize(m_player->size());
NSView* parentView = 0;
#if PLATFORM(MAC)
LOG(Media, "MediaPlayerPrivateQTKit::createQTVideoRenderer(%p)", this);
destroyQTVideoRenderer();
- m_qtVideoRenderer.adoptNS([[QTVideoRendererClass() alloc] init]);
+ m_qtVideoRenderer = adoptNS([[QTVideoRendererClass() alloc] init]);
if (!m_qtVideoRenderer)
return;
ASSERT(supportsAcceleratedRendering());
if (!m_qtVideoLayer) {
- m_qtVideoLayer.adoptNS([[QTMovieLayer alloc] init]);
+ m_qtVideoLayer = adoptNS([[QTMovieLayer alloc] init]);
if (!m_qtVideoLayer)
return;
if ([[m_qtMovie.get() attributeForKey:QTMovieRateChangesPreservePitchAttribute] boolValue] == preservesPitch)
return;
- RetainPtr<NSDictionary> movieAttributes(AdoptNS, [[m_qtMovie.get() movieAttributes] mutableCopy]);
+ RetainPtr<NSDictionary> movieAttributes = adoptNS([[m_qtMovie.get() movieAttributes] mutableCopy]);
ASSERT(movieAttributes);
[movieAttributes.get() setValue:[NSNumber numberWithBool:preservesPitch] forKey:QTMovieRateChangesPreservePitchAttribute];
m_timeToRestore = currentTime();
int count = [fileTypes count];
for (int n = 0; n < count; n++) {
CFStringRef ext = reinterpret_cast<CFStringRef>([fileTypes objectAtIndex:n]);
- RetainPtr<CFStringRef> uti(AdoptCF, UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, ext, NULL));
+ RetainPtr<CFStringRef> uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, ext, NULL));
if (!uti)
continue;
- RetainPtr<CFStringRef> mime(AdoptCF, UTTypeCopyPreferredTagWithClass(uti.get(), kUTTagClassMIMEType));
+ RetainPtr<CFStringRef> mime = adoptCF(UTTypeCopyPreferredTagWithClass(uti.get(), kUTTagClassMIMEType));
if (mime)
cache.add(mime.get());
if (!addResult.isNewEntry)
return attributesDictionary.get();
- attributesDictionary.adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 4, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ attributesDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 4, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
CFMutableDictionaryRef mutableAttributes = (CFMutableDictionaryRef)attributesDictionary.get();
CFDictionarySetValue(mutableAttributes, kCTFontAttributeName, platformData().ctFont());
static bool fontHasVerticalGlyphs(CTFontRef ctFont)
{
// The check doesn't look neat but this is what AppKit does for vertical writing...
- RetainPtr<CFArrayRef> tableTags(AdoptCF, CTFontCopyAvailableTables(ctFont, kCTFontTableOptionNoOptions));
+ RetainPtr<CFArrayRef> tableTags = adoptCF(CTFontCopyAvailableTables(ctFont, kCTFontTableOptionNoOptions));
CFIndex numTables = CFArrayGetCount(tableTags.get());
for (CFIndex index = 0; index < numTables; ++index) {
CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tableTags.get(), index);
const SimpleFontData* SimpleFontData::getCompositeFontReferenceFontData(NSFont *key) const
{
- if (key && !CFEqual(RetainPtr<CFStringRef>(AdoptCF, CTFontCopyPostScriptName(CTFontRef(key))).get(), CFSTR("LastResort"))) {
+ if (key && !CFEqual(adoptCF(CTFontCopyPostScriptName(CTFontRef(key))).get(), CFSTR("LastResort"))) {
if (!m_derivedFontData)
m_derivedFontData = DerivedFontData::create(isCustomFont());
if (!m_derivedFontData->compositeFontReferences)
- m_derivedFontData->compositeFontReferences.adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, NULL));
+ m_derivedFontData->compositeFontReferences = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, NULL));
else {
const SimpleFontData* found = static_cast<const SimpleFontData*>(CFDictionaryGetValue(m_derivedFontData->compositeFontReferences.get(), static_cast<const void *>(key)));
if (found)
m_avgCharWidth = 0;
m_maxCharWidth = 0;
- RetainPtr<CFDataRef> os2Table(AdoptCF, copyFontTableForTag(m_platformData, 'OS/2'));
+ RetainPtr<CFDataRef> os2Table = adoptCF(copyFontTableForTag(m_platformData, 'OS/2'));
if (os2Table && CFDataGetLength(os2Table.get()) >= 4) {
const UInt8* os2 = CFDataGetBytePtr(os2Table.get());
SInt16 os2AvgCharWidth = os2[2] * 256 + os2[3];
m_avgCharWidth = scaleEmToUnits(os2AvgCharWidth, m_fontMetrics.unitsPerEm()) * m_platformData.m_size;
}
- RetainPtr<CFDataRef> headTable(AdoptCF, copyFontTableForTag(m_platformData, 'head'));
+ RetainPtr<CFDataRef> headTable = adoptCF(copyFontTableForTag(m_platformData, 'head'));
if (headTable && CFDataGetLength(headTable.get()) >= 42) {
const UInt8* head = CFDataGetBytePtr(headTable.get());
ushort uxMin = head[36] * 256 + head[37];
if (!addResult.isNewEntry)
return addResult.iterator->value;
- RetainPtr<CGFontRef> cgFont(AdoptCF, CTFontCopyGraphicsFont(platformData().ctFont(), 0));
+ RetainPtr<CGFontRef> cgFont = adoptCF(CTFontCopyGraphicsFont(platformData().ctFont(), 0));
ProviderInfo info = { characters, length, getCFStringAttributes(0, platformData().orientation()) };
- RetainPtr<CTLineRef> line(AdoptCF, wkCreateCTLineWithUniCharProvider(&provideStringAndAttributes, 0, &info));
+ RetainPtr<CTLineRef> line = adoptCF(wkCreateCTLineWithUniCharProvider(&provideStringAndAttributes, 0, &info));
CFArrayRef runArray = CTLineGetGlyphRuns(line.get());
CFIndex runCount = CFArrayGetCount(runArray);
ASSERT(CFGetTypeID(ctRun) == CTRunGetTypeID());
CFDictionaryRef runAttributes = CTRunGetAttributes(ctRun);
CTFontRef runFont = static_cast<CTFontRef>(CFDictionaryGetValue(runAttributes, kCTFontAttributeName));
- RetainPtr<CGFontRef> runCGFont(AdoptCF, CTFontCopyGraphicsFont(runFont, 0));
+ RetainPtr<CGFontRef> runCGFont = adoptCF(CTFontCopyGraphicsFont(runFont, 0));
if (!CFEqual(runCGFont.get(), cgFont.get()))
return false;
}
RetainPtr<CGColorSpaceRef> imageColorSpace = colorSpace;
if (!imageColorSpace)
- imageColorSpace.adoptCF(CGColorSpaceCreateDeviceRGB());
+ imageColorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
CGRect layerBounds = CGRectIntegral([self bounds]);
}
ContentFilter::ContentFilter(const ResourceResponse& response)
- : m_platformContentFilter(AdoptNS, wkFilterCreateInstance(response.nsURLResponse()))
+ : m_platformContentFilter(adoptNS(wkFilterCreateInstance(response.nsURLResponse())))
{
ASSERT(m_platformContentFilter);
}
ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, ContextMenu* subMenu)
{
- m_platformDescription.adoptNS(createPlatformMenuItemDescription(type, action, title, true, false));
+ m_platformDescription = adoptNS(createPlatformMenuItemDescription(type, action, title, true, false));
if (subMenu)
setSubMenu(subMenu);
ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, bool enabled, bool checked)
{
- m_platformDescription.adoptNS(createPlatformMenuItemDescription(type, action, title, enabled, checked));
+ m_platformDescription = adoptNS(createPlatformMenuItemDescription(type, action, title, enabled, checked));
}
ContextMenuItem::ContextMenuItem(ContextMenuAction action, const String& title, bool enabled, bool checked, Vector<ContextMenuItem>& subMenuItems)
{
- m_platformDescription.adoptNS(createPlatformMenuItemDescription(SubmenuType, action, title, enabled, checked));
+ m_platformDescription = adoptNS(createPlatformMenuItemDescription(SubmenuType, action, title, enabled, checked));
setSubMenu(subMenuItems);
}
if (!nsImage)
return 0;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return RetainPtr<NSCursor>(AdoptNS, [[NSCursor alloc] initWithImage:nsImage hotSpot:hotSpot]);
+ return adoptNS([[NSCursor alloc] initWithImage:nsImage hotSpot:hotSpot]);
END_BLOCK_OBJC_EXCEPTIONS;
return 0;
}
static RetainPtr<NSCursor> createNamedCursor(const char* name, int x, int y)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- RetainPtr<NSString> resourceName(AdoptNS, [[NSString alloc] initWithUTF8String:name]);
- RetainPtr<NSImage> cursorImage(AdoptNS, [[NSImage alloc] initWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreCursorBundle class]] pathForResource:resourceName.get() ofType:@"png"]]);
+ RetainPtr<NSString> resourceName = adoptNS([[NSString alloc] initWithUTF8String:name]);
+ RetainPtr<NSImage> cursorImage = adoptNS([[NSImage alloc] initWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreCursorBundle class]] pathForResource:resourceName.get() ofType:@"png"]]);
RetainPtr<NSCursor> cursor;
: m_disableDisplaySleepAssertion(0)
{
#if !PLATFORM(IOS)
- RetainPtr<CFStringRef> reasonCF(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, reason, kCFStringEncodingUTF8));
+ RetainPtr<CFStringRef> reasonCF = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, reason, kCFStringEncodingUTF8));
IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonCF.get(), &m_disableDisplaySleepAssertion);
#else
UNUSED_PARAM(reason);
if (!image)
return nil;
- RetainPtr<NSImage> dissolvedImage(AdoptNS, [[NSImage alloc] initWithSize:[image.get() size]]);
+ RetainPtr<NSImage> dissolvedImage = adoptNS([[NSImage alloc] initWithSize:[image.get() size]]);
[dissolvedImage.get() lockFocus];
[image.get() drawAtPoint:NSZeroPoint fromRect:NSMakeRect(0, 0, [image size].width, [image size].height) operation:NSCompositeCopy fraction:delta];
// Construct a correctly-rotated copy of the image to use as the drag image.
FloatRect destRect(FloatPoint(), sizeRespectingOrientation);
- RetainPtr<NSImage> rotatedDragImage(AdoptNS, [[NSImage alloc] initWithSize:(NSSize)(sizeRespectingOrientation)]);
+ RetainPtr<NSImage> rotatedDragImage = adoptNS([[NSImage alloc] initWithSize:(NSSize)(sizeRespectingOrientation)]);
[rotatedDragImage.get() lockFocus];
// ImageOrientation uses top-left coordinates, need to flip to bottom-left, apply...
transform = CGAffineTransformTranslate(transform, 0, destRect.height());
transform = CGAffineTransformScale(transform, 1, -1);
- RetainPtr<NSAffineTransform> cocoaTransform(AdoptNS, [[NSAffineTransform alloc] init]);
+ RetainPtr<NSAffineTransform> cocoaTransform = adoptNS([[NSAffineTransform alloc] init]);
[cocoaTransform.get() setTransformStruct:*(NSAffineTransformStruct*)&transform];
[cocoaTransform.get() concat];
}
}
- RetainPtr<NSImage> dragImage(AdoptNS, [image->getNSImage() copy]);
+ RetainPtr<NSImage> dragImage = adoptNS([image->getNSImage() copy]);
[dragImage.get() setSize:(NSSize)size];
return dragImage;
}
NSFontManager *fontManager = [NSFontManager sharedFontManager];
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] init];
NSUInteger stringLength = 0;
- RetainPtr<NSMutableDictionary> attrs(AdoptNS, [[NSMutableDictionary alloc] init]);
+ RetainPtr<NSMutableDictionary> attrs = adoptNS([[NSMutableDictionary alloc] init]);
for (TextIterator it(range); !it.atEnd(); it.advance()) {
RefPtr<Range> currentTextRange = it.range();
else
[attrs.get() removeObjectForKey:NSBackgroundColorAttributeName];
- RetainPtr<NSString> substring(AdoptNS, [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(it.characters()) length:currentTextLength freeWhenDone:NO]);
+ RetainPtr<NSString> substring = adoptNS([[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(it.characters()) length:currentTextLength freeWhenDone:NO]);
[string replaceCharactersInRange:NSMakeRange(stringLength, 0) withString:substring.get()];
[string setAttributes:attrs.get() range:NSMakeRange(stringLength, currentTextLength)];
stringLength += currentTextLength;
ASSERT(isMainThread());
// Look up the language code using CFBundle.
- RetainPtr<CFStringRef> preferredLanguageCode(AdoptCF, wkCopyCFLocalizationPreferredName((CFStringRef)languageCode));
+ RetainPtr<CFStringRef> preferredLanguageCode = adoptCF(wkCopyCFLocalizationPreferredName((CFStringRef)languageCode));
if (preferredLanguageCode)
languageCode = (NSString *)preferredLanguageCode.get();
// Turn a '_' into a '-' if it appears after a 2-letter language code.
if ([lowercaseLanguageCode length] >= 3 && [lowercaseLanguageCode characterAtIndex:2] == '_') {
- RetainPtr<NSMutableString> mutableLanguageCode(AdoptNS, [lowercaseLanguageCode mutableCopy]);
+ RetainPtr<NSMutableString> mutableLanguageCode = adoptNS([lowercaseLanguageCode mutableCopy]);
[mutableLanguageCode.get() replaceCharactersInRange:NSMakeRange(2, 1) withString:@"-"];
return mutableLanguageCode.get();
}
useCachedPreferredLanguages = YES;
userPreferredLanguages.clear();
- RetainPtr<CFArrayRef> languages(AdoptCF, CFLocaleCopyPreferredLanguages());
+ RetainPtr<CFArrayRef> languages = adoptCF(CFLocaleCopyPreferredLanguages());
CFIndex languageCount = CFArrayGetCount(languages.get());
if (!languageCount)
userPreferredLanguages.append("en");
ASSERT(isMainThread());
#endif
- RetainPtr<CFStringRef> keyString(AdoptCF, CFStringCreateWithCStringNoCopy(0, key, kCFStringEncodingUTF8, kCFAllocatorNull));
+ RetainPtr<CFStringRef> keyString = adoptCF(CFStringCreateWithCStringNoCopy(0, key, kCFStringEncodingUTF8, kCFAllocatorNull));
CFStringRef notFound = CFSTR("localized string not found");
RetainPtr<CFStringRef> result;
if (bundle) {
- result.adoptCF(CFBundleCopyLocalizedString(bundle, keyString.get(), notFound, 0));
+ result = adoptCF(CFBundleCopyLocalizedString(bundle, keyString.get(), notFound, 0));
ASSERT_WITH_MESSAGE(result.get() != notFound, "could not find localizable string %s in bundle", key);
} else
result = notFound;
range->setStart(enclosingAnchor, 0, IGNORE_EXCEPTION);
NSAttributedString* attributedString = nil;
- RetainPtr<WebHTMLConverter> converter(AdoptNS, [[WebHTMLConverter alloc] initWithDOMRange:kit(range.get())]);
+ RetainPtr<WebHTMLConverter> converter = adoptNS([[WebHTMLConverter alloc] initWithDOMRange:kit(range.get())]);
if (converter)
attributedString = [converter.get() attributedString];
void Pasteboard::writeSelectionForTypes(const Vector<String>& pasteboardTypes, bool canSmartCopyOrDelete, Frame* frame, ShouldSerializeSelectedTextForClipboard shouldSerializeSelectedTextForClipboard)
{
NSAttributedString* attributedString = nil;
- RetainPtr<WebHTMLConverter> converter(AdoptNS, [[WebHTMLConverter alloc] initWithDOMRange:kit(frame->editor()->selectedRange().get())]);
+ RetainPtr<WebHTMLConverter> converter = adoptNS([[WebHTMLConverter alloc] initWithDOMRange:kit(frame->editor()->selectedRange().get())]);
if (converter)
attributedString = [converter.get() attributedString];
return 0;
if (frame->loader()->client()->canShowMIMETypeAsHTML(MIMEType)) {
- RetainPtr<NSString> markupString(AdoptNS, [[NSString alloc] initWithData:[mainResource->data()->createNSData() autorelease] encoding:NSUTF8StringEncoding]);
+ RetainPtr<NSString> markupString = adoptNS([[NSString alloc] initWithData:[mainResource->data()->createNSData() autorelease] encoding:NSUTF8StringEncoding]);
// FIXME: seems poor form to do this as a side effect of getting a document fragment
if (DocumentLoader* loader = frame->loader()->documentLoader())
loader->addAllArchiveResources(coreArchive.get());
{
CMClockRef rawClockPtr = 0;
CMAudioDeviceClockCreate(kCFAllocatorDefault, NULL, &rawClockPtr);
- RetainPtr<CMClockRef> clock(AdoptCF, rawClockPtr);
+ RetainPtr<CMClockRef> clock = adoptCF(rawClockPtr);
initializeWithTimingSource(clock.get());
}
{
CMTimebaseRef rawTimebasePtr = 0;
CMTimebaseCreateWithMasterClock(kCFAllocatorDefault, clock, &rawTimebasePtr);
- m_timebase.adoptCF(rawTimebasePtr);
+ m_timebase = adoptCF(rawTimebasePtr);
}
void PlatformClockCM::setCurrentTime(double time)
void PlatformPasteboard::addTypes(const Vector<String>& pasteboardTypes)
{
- RetainPtr<NSMutableArray> types(AdoptNS, [[NSMutableArray alloc] init]);
+ RetainPtr<NSMutableArray> types = adoptNS([[NSMutableArray alloc] init]);
for (size_t i = 0; i < pasteboardTypes.size(); ++i)
[types.get() addObject:pasteboardTypes[i]];
return;
}
- RetainPtr<NSMutableArray> types(AdoptNS, [[NSMutableArray alloc] init]);
+ RetainPtr<NSMutableArray> types = adoptNS([[NSMutableArray alloc] init]);
for (size_t i = 0; i < pasteboardTypes.size(); ++i)
[types.get() addObject:pasteboardTypes[i]];
void PlatformPasteboard::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType)
{
- RetainPtr<NSMutableArray> paths(AdoptNS, [[NSMutableArray alloc] init]);
+ RetainPtr<NSMutableArray> paths = adoptNS([[NSMutableArray alloc] init]);
for (size_t i = 0; i < pathnames.size(); ++i)
[paths.get() addObject: [NSArray arrayWithObject:pathnames[i]]];
[m_pasteboard.get() setPropertyList:paths.get() forType:pasteboardType];
void PlatformSpeechSynthesizer::speak(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance)
{
if (!m_platformSpeechWrapper)
- m_platformSpeechWrapper.adoptNS([[WebSpeechSynthesisWrapper alloc] initWithSpeechSynthesizer:this]);
+ m_platformSpeechWrapper = adoptNS([[WebSpeechSynthesisWrapper alloc] initWithSpeechSynthesizer:this]);
[m_platformSpeechWrapper.get() speakUtterance:utterance.get()];
}
[attributes setObject:font forKey:NSFontAttributeName];
}
- RetainPtr<NSMutableParagraphStyle> paragraphStyle(AdoptNS, [[NSParagraphStyle defaultParagraphStyle] mutableCopy]);
+ RetainPtr<NSMutableParagraphStyle> paragraphStyle = adoptNS([[NSParagraphStyle defaultParagraphStyle] mutableCopy]);
[paragraphStyle.get() setAlignment:menuTextDirection == LTR ? NSLeftTextAlignment : NSRightTextAlignment];
NSWritingDirection writingDirection = style.textDirection() == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft;
[paragraphStyle.get() setBaseWritingDirection:writingDirection];
if (style.hasTextDirectionOverride()) {
- RetainPtr<NSNumber> writingDirectionValue(AdoptNS, [[NSNumber alloc] initWithInteger:writingDirection + NSTextWritingDirectionOverride]);
- RetainPtr<NSArray> writingDirectionArray(AdoptNS, [[NSArray alloc] initWithObjects:writingDirectionValue.get(), nil]);
+ RetainPtr<NSNumber> writingDirectionValue = adoptNS([[NSNumber alloc] initWithInteger:writingDirection + NSTextWritingDirectionOverride]);
+ RetainPtr<NSArray> writingDirectionArray = adoptNS([[NSArray alloc] initWithObjects:writingDirectionValue.get(), nil]);
[attributes setObject:writingDirectionArray.get() forKey:NSWritingDirectionAttributeName];
}
[attributes setObject:paragraphStyle.get() forKey:NSParagraphStyleAttributeName];
RefPtr<PopupMenuMac> protector(this);
- RetainPtr<NSView> dummyView(AdoptNS, [[NSView alloc] initWithFrame:r]);
+ RetainPtr<NSView> dummyView = adoptNS([[NSView alloc] initWithFrame:r]);
[view addSubview:dummyView.get()];
location = [dummyView.get() convertPoint:location fromView:view];
[self scrollAnimator]->setVisibleScrollerThumbRect(IntRect());
}
- scrollbarPartAnimation.adoptNS([[WebScrollbarPartAnimation alloc] initWithScrollbar:_scrollbar
+ scrollbarPartAnimation = adoptNS([[WebScrollbarPartAnimation alloc] initWithScrollbar:_scrollbar
featureToAnimate:part == ThumbPart ? ThumbAlpha : TrackAlpha
animateFrom:part == ThumbPart ? [scrollerPainter knobAlpha] : [scrollerPainter trackAlpha]
animateTo:newAlpha
[scrollbarPainter setUiStateTransitionProgress:1 - [scrollerImp uiStateTransitionProgress]];
if (!_uiStateTransitionAnimation)
- _uiStateTransitionAnimation.adoptNS([[WebScrollbarPartAnimation alloc] initWithScrollbar:_scrollbar
+ _uiStateTransitionAnimation = adoptNS([[WebScrollbarPartAnimation alloc] initWithScrollbar:_scrollbar
featureToAnimate:UIStateTransition
animateFrom:[scrollbarPainter uiStateTransitionProgress]
animateTo:1.0
[scrollbarPainter setExpansionTransitionProgress:1 - [scrollerImp expansionTransitionProgress]];
if (!_expansionTransitionAnimation) {
- _expansionTransitionAnimation.adoptNS([[WebScrollbarPartAnimation alloc] initWithScrollbar:_scrollbar
+ _expansionTransitionAnimation = adoptNS([[WebScrollbarPartAnimation alloc] initWithScrollbar:_scrollbar
featureToAnimate:ExpansionTransition
animateFrom:[scrollbarPainter expansionTransitionProgress]
animateTo:1.0
, m_haveScrolledSincePageLoad(false)
, m_needsScrollerStyleUpdate(false)
{
- m_scrollAnimationHelperDelegate.adoptNS([[WebScrollAnimationHelperDelegate alloc] initWithScrollAnimator:this]);
- m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelper") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
+ m_scrollAnimationHelperDelegate = adoptNS([[WebScrollAnimationHelperDelegate alloc] initWithScrollAnimator:this]);
+ m_scrollAnimationHelper = adoptNS([[NSClassFromString(@"NSScrollAnimationHelper") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]);
if (isScrollbarOverlayAPIAvailable()) {
- m_scrollbarPainterControllerDelegate.adoptNS([[WebScrollbarPainterControllerDelegate alloc] initWithScrollableArea:scrollableArea]);
+ m_scrollbarPainterControllerDelegate = adoptNS([[WebScrollbarPainterControllerDelegate alloc] initWithScrollableArea:scrollableArea]);
m_scrollbarPainterController = [[[NSClassFromString(@"NSScrollerImpPair") alloc] init] autorelease];
[m_scrollbarPainterController.get() setDelegate:m_scrollbarPainterControllerDelegate.get()];
[m_scrollbarPainterController.get() setScrollerStyle:recommendedScrollerStyle()];
return;
ASSERT(!m_verticalScrollbarPainterDelegate);
- m_verticalScrollbarPainterDelegate.adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
+ m_verticalScrollbarPainterDelegate = adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
[painter setDelegate:m_verticalScrollbarPainterDelegate.get()];
[m_scrollbarPainterController.get() setVerticalScrollerImp:painter];
return;
ASSERT(!m_horizontalScrollbarPainterDelegate);
- m_horizontalScrollbarPainterDelegate.adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
+ m_horizontalScrollbarPainterDelegate = adoptNS([[WebScrollbarPainterDelegate alloc] initWithScrollbar:scrollbar]);
[painter setDelegate:m_horizontalScrollbarPainterDelegate.get()];
[m_scrollbarPainterController.get() setHorizontalScrollerImp:painter];
return m_cfData.get();
}
- return (CFDataRef)RetainPtr<WebCoreSharedBufferData>(AdoptNS, [[WebCoreSharedBufferData alloc] initWithSharedBuffer:this]).leakRef();
+ return (CFDataRef)adoptNS([[WebCoreSharedBufferData alloc] initWithSharedBuffer:this]).leakRef();
}
#if !(PLATFORM(QT) && USE(QTKIT))
PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& filePath)
if (error != noErr)
return NSMacOSRomanStringEncoding;
- RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateFromFSRef(NULL, &fref));
+ RetainPtr<CFURLRef> url = adoptCF(CFURLCreateFromFSRef(NULL, &fref));
if (!url)
return NSMacOSRomanStringEncoding;
return NSMacOSRomanStringEncoding;
NSString *directoryName = [[path stringByDeletingPathExtension] lastPathComponent];
- RetainPtr<CFStringRef> locale(AdoptCF, CFLocaleCreateCanonicalLocaleIdentifierFromString(NULL, (CFStringRef)directoryName));
+ RetainPtr<CFStringRef> locale = adoptCF(CFLocaleCreateCanonicalLocaleIdentifierFromString(NULL, (CFStringRef)directoryName));
if (!locale)
return NSMacOSRomanStringEncoding;
bool ProtectionSpace::receivesCredentialSecurely() const
{
#if USE(CFNETWORK) && !PLATFORM(MAC)
- RetainPtr<CFURLProtectionSpaceRef> cfSpace(AdoptCF, createCF(*this));
+ RetainPtr<CFURLProtectionSpaceRef> cfSpace = adoptCF(createCF(*this));
return cfSpace && CFURLProtectionSpaceReceivesCredentialSecurely(cfSpace.get());
#else
return (m_serverType == ProtectionSpaceServerHTTPS ||
#if USE(CFNETWORK)
ResourceError SynchronousLoaderClient::platformBadResponseError()
{
- RetainPtr<CFErrorRef> cfError(AdoptCF, CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainCFNetwork, kCFURLErrorBadServerResponse, 0));
+ RetainPtr<CFErrorRef> cfError = adoptCF(CFErrorCreate(kCFAllocatorDefault, kCFErrorDomainCFNetwork, kCFURLErrorBadServerResponse, 0));
return cfError.get();
}
#endif
Credential CredentialStorage::getFromPersistentStorage(const ProtectionSpace& protectionSpace)
{
- RetainPtr<CFURLProtectionSpaceRef> protectionSpaceCF(AdoptCF, createCF(protectionSpace));
- RetainPtr<CFURLCredentialRef> credentialCF(AdoptCF, wkCopyCredentialFromCFPersistentStorage(protectionSpaceCF.get()));
+ RetainPtr<CFURLProtectionSpaceRef> protectionSpaceCF = adoptCF(createCF(protectionSpace));
+ RetainPtr<CFURLCredentialRef> credentialCF = adoptCF(wkCopyCredentialFromCFPersistentStorage(protectionSpaceCF.get()));
return core(credentialCF.get());
}
// as it doesn't necessarily look up the actual external IP. Also, if DNS returns a fake internal address,
// local caches may keep it even after re-connecting to another network.
- RetainPtr<CFDictionaryRef> proxySettings(AdoptCF, CFNetworkCopySystemProxySettings());
+ RetainPtr<CFDictionaryRef> proxySettings = adoptCF(CFNetworkCopySystemProxySettings());
if (!proxySettings)
return false;
static CFURLRef httpCFURL = KURL(ParsedURLString, "http://example.com/").createCFURL();
static CFURLRef httpsCFURL = KURL(ParsedURLString, "https://example.com/").createCFURL();
- RetainPtr<CFArrayRef> httpProxyArray(AdoptCF, CFNetworkCopyProxiesForURL(httpCFURL, proxySettings.get()));
- RetainPtr<CFArrayRef> httpsProxyArray(AdoptCF, CFNetworkCopyProxiesForURL(httpsCFURL, proxySettings.get()));
+ RetainPtr<CFArrayRef> httpProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpCFURL, proxySettings.get()));
+ RetainPtr<CFArrayRef> httpsProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpsCFURL, proxySettings.get()));
CFIndex httpProxyCount = CFArrayGetCount(httpProxyArray.get());
CFIndex httpsProxyCount = CFArrayGetCount(httpsProxyArray.get());
}
#if ENABLE(BLOB)
if (nextInput.m_fileStart > 0) {
- RetainPtr<CFNumberRef> position(AdoptCF, CFNumberCreate(0, kCFNumberLongLongType, &nextInput.m_fileStart));
+ RetainPtr<CFNumberRef> position = adoptCF(CFNumberCreate(0, kCFNumberLongLongType, &nextInput.m_fileStart));
CFReadStreamSetProperty(form->currentStream, kCFStreamPropertyFileCurrentOffset, position.get());
}
form->currentStreamRangeLength = nextInput.m_fileLength;
{
ASSERT(isMainThread());
// FIXME: Why don't we retain it? The only caller is an API method that takes cookie storage as a raw argument.
- cookieStorageOverride().adoptCF(cookieStorage);
+ cookieStorageOverride() = adoptCF(cookieStorage);
}
CFHTTPCookieStorageRef overridenCookieStorage()
Vector<ProxyServer>* proxyServers = (Vector<ProxyServer>*)context;
if (!proxies) {
ASSERT(error);
- RetainPtr<CFStringRef> errorDescriptionCF(AdoptCF, CFErrorCopyDescription(error));
+ RetainPtr<CFStringRef> errorDescriptionCF = adoptCF(CFErrorCopyDescription(error));
String errorDescription(errorDescriptionCF.get());
LOG(Network, "Failed to process proxy auto-configuration file with error: %s", errorDescription.utf8().data());
return;
continue;
CFStreamClientContext context = { 0, (void*)&proxyServers, 0, 0, 0 };
- RetainPtr<CFRunLoopSourceRef> runLoopSource(AdoptCF, CFNetworkExecuteProxyAutoConfigurationURL(scriptURL, url, proxyAutoConfigurationResultCallback, &context));
+ RetainPtr<CFRunLoopSourceRef> runLoopSource = adoptCF(CFNetworkExecuteProxyAutoConfigurationURL(scriptURL, url, proxyAutoConfigurationResultCallback, &context));
CFStringRef privateRunLoopMode = CFSTR("com.apple.WebKit.ProxyAutoConfiguration");
CFTimeInterval timeout = 5;
static void addProxyServersForURL(Vector<ProxyServer>& proxyServers, const KURL& url)
{
- RetainPtr<CFDictionaryRef> proxySettings(AdoptCF, CFNetworkCopySystemProxySettings());
+ RetainPtr<CFDictionaryRef> proxySettings = adoptCF(CFNetworkCopySystemProxySettings());
if (!proxySettings)
return;
- RetainPtr<CFURLRef> cfURL(AdoptCF, url.createCFURL());
- RetainPtr<CFArrayRef> proxiesForURL(AdoptCF, CFNetworkCopyProxiesForURL(cfURL.get(), proxySettings.get()));
+ RetainPtr<CFURLRef> cfURL = adoptCF(url.createCFURL());
+ RetainPtr<CFArrayRef> proxiesForURL = adoptCF(CFNetworkCopyProxiesForURL(cfURL.get(), proxySettings.get()));
if (!proxiesForURL)
return;
m_errorCode = CFErrorGetCode(m_platformError.get());
- RetainPtr<CFDictionaryRef> userInfo(AdoptCF, CFErrorCopyUserInfo(m_platformError.get()));
+ RetainPtr<CFDictionaryRef> userInfo = adoptCF(CFErrorCopyUserInfo(m_platformError.get()));
if (userInfo.get()) {
CFStringRef failingURLString = (CFStringRef) CFDictionaryGetValue(userInfo.get(), failingURLStringKey);
if (failingURLString)
else {
CFURLRef failingURL = (CFURLRef) CFDictionaryGetValue(userInfo.get(), failingURLKey);
if (failingURL) {
- RetainPtr<CFURLRef> absoluteURLRef(AdoptCF, CFURLCopyAbsoluteURL(failingURL));
+ RetainPtr<CFURLRef> absoluteURLRef = adoptCF(CFURLCopyAbsoluteURL(failingURL));
if (absoluteURLRef.get()) {
failingURLString = CFURLGetString(absoluteURLRef.get());
m_failingURL = String(failingURLString);
}
if (!m_platformError) {
- RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CFMutableDictionaryRef> userInfo = adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
if (!m_localizedDescription.isEmpty())
CFDictionarySetValue(userInfo.get(), kCFErrorLocalizedDescriptionKey, m_localizedDescription.createCFString().get());
if (!m_failingURL.isEmpty()) {
RetainPtr<CFStringRef> failingURLString = m_failingURL.createCFString();
CFDictionarySetValue(userInfo.get(), failingURLStringKey, failingURLString.get());
- RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithString(0, failingURLString.get(), 0));
+ RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithString(0, failingURLString.get(), 0));
CFDictionarySetValue(userInfo.get(), failingURLKey, url.get());
}
RetainPtr<CFStringRef> lastHTTPMethod = handle->lastHTTPMethod().createCFString();
RetainPtr<CFStringRef> newMethod = adoptCF(CFURLRequestCopyHTTPRequestMethod(cfRequest));
if (CFStringCompareWithOptions(lastHTTPMethod.get(), newMethod.get(), CFRangeMake(0, CFStringGetLength(lastHTTPMethod.get())), kCFCompareCaseInsensitive)) {
- RetainPtr<CFMutableURLRequestRef> mutableRequest(AdoptCF, CFURLRequestCreateMutableCopy(0, cfRequest));
+ RetainPtr<CFMutableURLRequestRef> mutableRequest = adoptCF(CFURLRequestCreateMutableCopy(0, cfRequest));
wkSetRequestStorageSession(handle->storageSession(), mutableRequest.get());
CFURLRequestSetHTTPRequestMethod(mutableRequest.get(), lastHTTPMethod.get());
RetainPtr<CFMutableDictionaryRef> sslProps;
if (allowsAnyHTTPSCertificateHosts().contains(firstRequest().url().host().lower())) {
- sslProps.adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ sslProps = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
CFDictionaryAddValue(sslProps.get(), kCFStreamSSLAllowsAnyRoot, kCFBooleanTrue);
CFDictionaryAddValue(sslProps.get(), kCFStreamSSLAllowsExpiredRoots, kCFBooleanTrue);
CFDictionaryAddValue(sslProps.get(), kCFStreamSSLAllowsExpiredCertificates, kCFBooleanTrue);
HashMap<String, RetainPtr<CFDataRef> >::iterator clientCert = clientCerts().find(firstRequest().url().host().lower());
if (clientCert != clientCerts().end()) {
if (!sslProps)
- sslProps.adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ sslProps = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
#if PLATFORM(WIN)
wkSetClientCertificateInSSLProperties(sslProps.get(), (clientCert->value).get());
#endif
RetainPtr<CFDictionaryRef> propertiesDictionary = adoptCF(CFDictionaryCreate(0, (const void**)&kCFURLConnectionSocketStreamProperties, (const void**)&streamProperties, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
CFRelease(streamProperties);
- d->m_connection.adoptCF(CFURLConnectionCreateWithProperties(0, request.get(), reinterpret_cast<CFURLConnectionClient*>(&client), propertiesDictionary.get()));
+ d->m_connection = adoptCF(CFURLConnectionCreateWithProperties(0, request.get(), reinterpret_cast<CFURLConnectionClient*>(&client), propertiesDictionary.get()));
}
bool ResourceHandle::start()
// Store the credential back, possibly adding it as a default for this directory.
CredentialStorage::set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
}
- RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(credential));
+ RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(credential));
CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
return;
}
// Manage per-session credentials internally, because once NSURLCredentialPersistencePerSession is used, there is no way
// to ignore it for a particular request (short of removing it altogether).
Credential webCredential(credential.user(), credential.password(), CredentialPersistenceNone);
- RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(webCredential));
+ RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(webCredential));
KURL urlToStore;
if (challenge.failureResponse().httpStatusCode() == 401)
CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
} else {
- RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(credential));
+ RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(credential));
CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
}
for (index = 0; index < count; index++)
totalSize += CFDataGetLength(static_cast<CFDataRef>(CFArrayGetValueAtIndex(dataArray, index)));
- RetainPtr<CFMutableDataRef> mergedData(AdoptCF, CFDataCreateMutable(kCFAllocatorDefault, totalSize));
+ RetainPtr<CFMutableDataRef> mergedData = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, totalSize));
for (index = 0; index < count; index++) {
CFDataRef data = static_cast<CFDataRef>(CFArrayGetValueAtIndex(dataArray, index));
CFDataAppendBytes(mergedData.get(), CFDataGetBytePtr(data), CFDataGetLength(data));
static inline void setHeaderFields(CFMutableURLRequestRef request, const HTTPHeaderMap& requestHeaders)
{
// Remove existing headers first, as some of them may no longer be present in the map.
- RetainPtr<CFDictionaryRef> oldHeaderFields(AdoptCF, CFURLRequestCopyAllHTTPHeaderFields(request));
+ RetainPtr<CFDictionaryRef> oldHeaderFields = adoptCF(CFURLRequestCopyAllHTTPHeaderFields(request));
CFIndex oldHeaderFieldCount = CFDictionaryGetCount(oldHeaderFields.get());
if (oldHeaderFieldCount) {
Vector<CFStringRef> oldHeaderFieldNames(oldHeaderFieldCount);
{
CFMutableURLRequestRef cfRequest;
- RetainPtr<CFURLRef> url(AdoptCF, ResourceRequest::url().createCFURL());
- RetainPtr<CFURLRef> firstPartyForCookies(AdoptCF, ResourceRequest::firstPartyForCookies().createCFURL());
+ RetainPtr<CFURLRef> url = adoptCF(ResourceRequest::url().createCFURL());
+ RetainPtr<CFURLRef> firstPartyForCookies = adoptCF(ResourceRequest::firstPartyForCookies().createCFURL());
if (m_cfRequest) {
cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
CFURLRequestSetURL(cfRequest, url.get());
CFURLRequestSetShouldHandleHTTPCookies(cfRequest, allowCookies());
unsigned fallbackCount = m_responseContentDispositionEncodingFallbackArray.size();
- RetainPtr<CFMutableArrayRef> encodingFallbacks(AdoptCF, CFArrayCreateMutable(kCFAllocatorDefault, fallbackCount, 0));
+ RetainPtr<CFMutableArrayRef> encodingFallbacks = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, fallbackCount, 0));
for (unsigned i = 0; i != fallbackCount; ++i) {
RetainPtr<CFStringRef> encodingName = m_responseContentDispositionEncodingFallbackArray[i].createCFString();
CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding(encodingName.get());
setContentDispositionEncodingFallbackArray(cfRequest, encodingFallbacks.get());
if (m_cfRequest) {
- RetainPtr<CFHTTPCookieStorageRef> cookieStorage(AdoptCF, CFURLRequestCopyHTTPCookieStorage(m_cfRequest.get()));
+ RetainPtr<CFHTTPCookieStorageRef> cookieStorage = adoptCF(CFURLRequestCopyHTTPCookieStorage(m_cfRequest.get()));
if (cookieStorage)
CFURLRequestSetHTTPCookieStorage(cfRequest, cookieStorage.get());
CFURLRequestSetHTTPCookieStorageAcceptPolicy(cfRequest, CFURLRequestGetHTTPCookieStorageAcceptPolicy(m_cfRequest.get()));
String partition = cachePartition();
if (!partition.isNull() && !partition.isEmpty()) {
CString utf8String = partition.utf8();
- RetainPtr<CFStringRef> partitionValue(AdoptCF, CFStringCreateWithBytes(0, reinterpret_cast<const UInt8*>(utf8String.data()), utf8String.length(), kCFStringEncodingUTF8, false));
+ RetainPtr<CFStringRef> partitionValue = adoptCF(CFStringCreateWithBytes(0, reinterpret_cast<const UInt8*>(utf8String.data()), utf8String.length(), kCFStringEncodingUTF8, false));
_CFURLRequestSetProtocolProperty(cfRequest, wkCachePartitionKey(), partitionValue.get());
}
#endif
- m_cfRequest.adoptCF(cfRequest);
+ m_cfRequest = adoptCF(cfRequest);
#if PLATFORM(MAC)
updateNSURLRequest();
#endif
{
CFMutableURLRequestRef cfRequest;
- RetainPtr<CFURLRef> url(AdoptCF, ResourceRequest::url().createCFURL());
- RetainPtr<CFURLRef> firstPartyForCookies(AdoptCF, ResourceRequest::firstPartyForCookies().createCFURL());
+ RetainPtr<CFURLRef> url = adoptCF(ResourceRequest::url().createCFURL());
+ RetainPtr<CFURLRef> firstPartyForCookies = adoptCF(ResourceRequest::firstPartyForCookies().createCFURL());
if (m_cfRequest) {
cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
CFURLRequestSetURL(cfRequest, url.get());
}
}
- m_cfRequest.adoptCF(cfRequest);
+ m_cfRequest = adoptCF(cfRequest);
#if PLATFORM(MAC)
updateNSURLRequest();
#endif
}
m_responseContentDispositionEncodingFallbackArray.clear();
- RetainPtr<CFArrayRef> encodingFallbacks(AdoptCF, copyContentDispositionEncodingFallbackArray(m_cfRequest.get()));
+ RetainPtr<CFArrayRef> encodingFallbacks = adoptCF(copyContentDispositionEncodingFallbackArray(m_cfRequest.get()));
if (encodingFallbacks) {
CFIndex count = CFArrayGetCount(encodingFallbacks.get());
for (CFIndex i = 0; i < count; ++i) {
}
#if ENABLE(CACHE_PARTITIONING)
- RetainPtr<CFStringRef> cachePartition(AdoptCF, static_cast<CFStringRef>(_CFURLRequestCopyProtocolPropertyForKey(m_cfRequest.get(), wkCachePartitionKey())));
+ RetainPtr<CFStringRef> cachePartition = adoptCF(static_cast<CFStringRef>(_CFURLRequestCopyProtocolPropertyForKey(m_cfRequest.get(), wkCachePartitionKey())));
if (cachePartition)
m_cachePartition = cachePartition.get();
#endif
CFMutableURLRequestRef cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
wkSetRequestStorageSession(storageSession, cfRequest);
- m_cfRequest.adoptCF(cfRequest);
+ m_cfRequest = adoptCF(cfRequest);
#if PLATFORM(MAC)
updateNSURLRequest();
#endif
CFURLResponseRef ResourceResponse::cfURLResponse() const
{
if (!m_cfResponse && !m_isNull) {
- RetainPtr<CFURLRef> url(AdoptCF, m_url.createCFURL());
+ RetainPtr<CFURLRef> url = adoptCF(m_url.createCFURL());
// FIXME: This creates a very incomplete CFURLResponse, which does not even have a status code.
- m_cfResponse.adoptCF(CFURLResponseCreate(0, url.get(), m_mimeType.createCFString().get(), m_expectedContentLength, m_textEncodingName.createCFString().get(), kCFURLCacheStorageAllowed));
+ m_cfResponse = adoptCF(CFURLResponseCreate(0, url.get(), m_mimeType.createCFString().get(), m_expectedContentLength, m_textEncodingName.createCFString().get(), kCFURLCacheStorageAllowed));
}
return m_cfResponse.get();
if (httpResponse) {
m_httpStatusCode = CFHTTPMessageGetResponseStatusCode(httpResponse);
- RetainPtr<CFDictionaryRef> headers(AdoptCF, CFHTTPMessageCopyAllHeaderFields(httpResponse));
+ RetainPtr<CFDictionaryRef> headers = adoptCF(CFHTTPMessageCopyAllHeaderFields(httpResponse));
for (int i = 0; i < numCommonHeaderFields; i++) {
CFStringRef value;
if (m_initLevel < CommonAndUncommonFields && initLevel >= CommonAndUncommonFields) {
CFHTTPMessageRef httpResponse = CFURLResponseGetHTTPResponse(m_cfResponse.get());
if (httpResponse) {
- RetainPtr<CFStringRef> statusLine(AdoptCF, CFHTTPMessageCopyResponseStatusLine(httpResponse));
+ RetainPtr<CFStringRef> statusLine = adoptCF(CFHTTPMessageCopyResponseStatusLine(httpResponse));
m_httpStatusText = extractReasonPhraseFromHTTPStatusLine(statusLine.get());
- RetainPtr<CFDictionaryRef> headers(AdoptCF, CFHTTPMessageCopyAllHeaderFields(httpResponse));
+ RetainPtr<CFDictionaryRef> headers = adoptCF(CFHTTPMessageCopyAllHeaderFields(httpResponse));
CFIndex headerCount = CFDictionaryGetCount(headers.get());
Vector<const void*, 128> keys(headerCount);
Vector<const void*, 128> values(headerCount);
}
if (m_initLevel < AllFields && initLevel >= AllFields) {
- RetainPtr<CFStringRef> suggestedFilename(AdoptCF, CFURLResponseCopySuggestedFilename(m_cfResponse.get()));
+ RetainPtr<CFStringRef> suggestedFilename = adoptCF(CFURLResponseCopySuggestedFilename(m_cfResponse.get()));
m_suggestedFilename = suggestedFilename.get();
}
ASSERT(url.protocolIs("ws") || url.protocolIs("wss"));
KURL httpsURL(KURL(), "https://" + m_url.host());
- m_httpsURL.adoptCF(httpsURL.createCFURL());
+ m_httpsURL = adoptCF(httpsURL.createCFURL());
createStreams();
ASSERT(!m_readStream == !m_writeStream);
{
// CFNetwork returns an empty proxy array for WebSocket schemes, so use m_httpsURL.
CFStreamClientContext clientContext = { 0, this, retainSocketStreamHandle, releaseSocketStreamHandle, copyPACExecutionDescription };
- m_pacRunLoopSource.adoptCF(CFNetworkExecuteProxyAutoConfigurationURL(pacFileURL, m_httpsURL.get(), pacExecutionCallback, &clientContext));
+ m_pacRunLoopSource = adoptCF(CFNetworkExecuteProxyAutoConfigurationURL(pacFileURL, m_httpsURL.get(), pacExecutionCallback, &clientContext));
#if PLATFORM(WIN)
CFRunLoopAddSource(loaderRunLoop(), m_pacRunLoopSource.get(), kCFRunLoopDefaultMode);
#else
void SocketStreamHandle::chooseProxy()
{
- RetainPtr<CFDictionaryRef> proxyDictionary(AdoptCF, CFNetworkCopySystemProxySettings());
+ RetainPtr<CFDictionaryRef> proxyDictionary = adoptCF(CFNetworkCopySystemProxySettings());
// SOCKS or HTTPS (AKA CONNECT) proxies are supported.
// WebSocket protocol relies on handshake being transferred unchanged, so we need a proxy that will not modify headers.
// CFNetworkCopyProxiesForURL doesn't know about WebSocket schemes, so pretend to use http.
// Always use "https" to get HTTPS proxies in result - we'll try to use those for ws:// even though many are configured to reject connections to ports other than 443.
- RetainPtr<CFArrayRef> proxyArray(AdoptCF, CFNetworkCopyProxiesForURL(m_httpsURL.get(), proxyDictionary.get()));
+ RetainPtr<CFArrayRef> proxyArray = adoptCF(CFNetworkCopyProxiesForURL(m_httpsURL.get(), proxyDictionary.get()));
chooseProxyFromArray(proxyArray.get());
}
CFWriteStreamSetProperty(writeStream, _kCFStreamSocketSetNoDelay, kCFBooleanTrue);
#endif
- m_readStream.adoptCF(readStream);
- m_writeStream.adoptCF(writeStream);
+ m_readStream = adoptCF(readStream);
+ m_writeStream = adoptCF(writeStream);
switch (m_connectionType) {
case Unknown:
// But SOCKS5 credentials don't work at the time of this writing anyway, see <rdar://6776698>.
const void* proxyKeys[] = { kCFStreamPropertySOCKSProxyHost, kCFStreamPropertySOCKSProxyPort };
const void* proxyValues[] = { m_proxyHost.get(), m_proxyPort.get() };
- RetainPtr<CFDictionaryRef> connectDictionary(AdoptCF, CFDictionaryCreate(0, proxyKeys, proxyValues, WTF_ARRAY_LENGTH(proxyKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CFDictionaryRef> connectDictionary = adoptCF(CFDictionaryCreate(0, proxyKeys, proxyValues, WTF_ARRAY_LENGTH(proxyKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
CFReadStreamSetProperty(m_readStream.get(), kCFStreamPropertySOCKSProxy, connectDictionary.get());
break;
}
if (shouldUseSSL()) {
const void* keys[] = { kCFStreamSSLPeerName, kCFStreamSSLLevel };
const void* values[] = { host.get(), kCFStreamSocketSecurityLevelNegotiatedSSL };
- RetainPtr<CFDictionaryRef> settings(AdoptCF, CFDictionaryCreate(0, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+ RetainPtr<CFDictionaryRef> settings = adoptCF(CFDictionaryCreate(0, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
CFReadStreamSetProperty(m_readStream.get(), kCFStreamPropertySSLSettings, settings.get());
CFWriteStreamSetProperty(m_writeStream.get(), kCFStreamPropertySSLSettings, settings.get());
}
void SocketStreamHandle::addCONNECTCredentials(CFHTTPMessageRef proxyResponse)
{
- RetainPtr<CFHTTPAuthenticationRef> authentication(AdoptCF, CFHTTPAuthenticationCreateFromResponse(0, proxyResponse));
+ RetainPtr<CFHTTPAuthenticationRef> authentication = adoptCF(CFHTTPAuthenticationCreateFromResponse(0, proxyResponse));
if (!CFHTTPAuthenticationRequiresUserNameAndPassword(authentication.get())) {
// That's all we can offer...
int port = 0;
CFNumberGetValue(m_proxyPort.get(), kCFNumberIntType, &port);
- RetainPtr<CFStringRef> methodCF(AdoptCF, CFHTTPAuthenticationCopyMethod(authentication.get()));
- RetainPtr<CFStringRef> realmCF(AdoptCF, CFHTTPAuthenticationCopyRealm(authentication.get()));
+ RetainPtr<CFStringRef> methodCF = adoptCF(CFHTTPAuthenticationCopyMethod(authentication.get()));
+ RetainPtr<CFStringRef> realmCF = adoptCF(CFHTTPAuthenticationCopyRealm(authentication.get()));
if (!methodCF || !realmCF) {
// This shouldn't happen, but on some OS versions we get incomplete authentication data, see <rdar://problem/10416316>.
if (!m_sentStoredCredentials && getStoredCONNECTProxyCredentials(protectionSpace, login, password)) {
// Try to apply stored credentials, if we haven't tried those already.
// Create a temporary request to make CFNetwork apply credentials to it. Unfortunately, this cannot work with NTLM authentication.
- RetainPtr<CFHTTPMessageRef> dummyRequest(AdoptCF, CFHTTPMessageCreateRequest(0, CFSTR("GET"), m_httpsURL.get(), kCFHTTPVersion1_1));
+ RetainPtr<CFHTTPMessageRef> dummyRequest = adoptCF(CFHTTPMessageCreateRequest(0, CFSTR("GET"), m_httpsURL.get(), kCFHTTPVersion1_1));
Boolean appliedCredentials = CFHTTPMessageApplyCredentials(dummyRequest.get(), authentication.get(), login.createCFString().get(), password.createCFString().get(), 0);
ASSERT_UNUSED(appliedCredentials, appliedCredentials);
- RetainPtr<CFStringRef> proxyAuthorizationString(AdoptCF, CFHTTPMessageCopyHeaderFieldValue(dummyRequest.get(), CFSTR("Proxy-Authorization")));
+ RetainPtr<CFStringRef> proxyAuthorizationString = adoptCF(CFHTTPMessageCopyHeaderFieldValue(dummyRequest.get(), CFSTR("Proxy-Authorization")));
if (!proxyAuthorizationString) {
// Fails e.g. for NTLM auth.
if (m_connectingSubstate == WaitingForConnect) {
if (m_connectionType == CONNECTProxy) {
- RetainPtr<CFHTTPMessageRef> proxyResponse(AdoptCF, wkCopyCONNECTProxyResponse(m_readStream.get(), m_httpsURL.get(), m_proxyHost.get(), m_proxyPort.get()));
+ RetainPtr<CFHTTPMessageRef> proxyResponse = adoptCF(wkCopyCONNECTProxyResponse(m_readStream.get(), m_httpsURL.get(), m_proxyHost.get(), m_proxyPort.get()));
if (!proxyResponse)
return;
ASSERT_NOT_REACHED();
return;
case kCFStreamEventErrorOccurred: {
- RetainPtr<CFErrorRef> error(AdoptCF, CFReadStreamCopyError(m_readStream.get()));
+ RetainPtr<CFErrorRef> error = adoptCF(CFReadStreamCopyError(m_readStream.get()));
reportErrorToClient(error.get());
return;
}
if (m_connectingSubstate == WaitingForConnect) {
if (m_connectionType == CONNECTProxy) {
- RetainPtr<CFHTTPMessageRef> proxyResponse(AdoptCF, wkCopyCONNECTProxyResponse(m_readStream.get(), m_httpsURL.get(), m_proxyHost.get(), m_proxyPort.get()));
+ RetainPtr<CFHTTPMessageRef> proxyResponse = adoptCF(wkCopyCONNECTProxyResponse(m_readStream.get(), m_httpsURL.get(), m_proxyHost.get(), m_proxyPort.get()));
if (!proxyResponse)
return;
return;
}
case kCFStreamEventErrorOccurred: {
- RetainPtr<CFErrorRef> error(AdoptCF, CFWriteStreamCopyError(m_writeStream.get()));
+ RetainPtr<CFErrorRef> error = adoptCF(CFWriteStreamCopyError(m_writeStream.get()));
reportErrorToClient(error.get());
return;
}
#endif
if (description.isNull()) {
- RetainPtr<CFStringRef> descriptionCF(AdoptCF, CFErrorCopyDescription(error));
+ RetainPtr<CFStringRef> descriptionCF = adoptCF(CFErrorCopyDescription(error));
description = String(descriptionCF.get());
}
NSURLProtectionSpace *mac(const ProtectionSpace& coreSpace)
{
- RetainPtr<CFURLProtectionSpaceRef> protectionSpace(AdoptCF, createCF(coreSpace));
+ RetainPtr<CFURLProtectionSpaceRef> protectionSpace = adoptCF(createCF(coreSpace));
return [[[NSURLProtectionSpace alloc] _initWithCFURLProtectionSpace:protectionSpace.get()] autorelease];
}
NSURLAuthenticationChallenge *mac(const AuthenticationChallenge& coreChallenge)
{
AuthenticationClient* authClient = coreChallenge.authenticationClient();
- RetainPtr<WebCoreAuthenticationClientAsChallengeSender> challengeSender(AdoptNS, [[WebCoreAuthenticationClientAsChallengeSender alloc] initWithAuthenticationClient:authClient]);
+ RetainPtr<WebCoreAuthenticationClientAsChallengeSender> challengeSender = adoptNS([[WebCoreAuthenticationClientAsChallengeSender alloc] initWithAuthenticationClient:authClient]);
RetainPtr<CFURLAuthChallengeRef> authChallenge = coreChallenge.cfURLAuthChallengeRef();
if (!authChallenge)
- authChallenge.adoptCF(createCF(coreChallenge));
+ authChallenge = adoptCF(createCF(coreChallenge));
[challengeSender.get() setCFChallenge:authChallenge.get()];
return [[NSURLAuthenticationChallenge _authenticationChallengeForCFAuthChallenge:authChallenge.get() sender:challengeSender.get()] autorelease];
}
NSURLCredential *mac(const Credential& coreCredential)
{
- RetainPtr<CFURLCredentialRef> credential(AdoptCF, createCF(coreCredential));
+ RetainPtr<CFURLCredentialRef> credential = adoptCF(createCF(coreCredential));
return [[[NSURLCredential alloc] _initWithCFURLCredential:credential.get()] autorelease];
}
void AuthenticationChallenge::setAuthenticationClient(AuthenticationClient* client)
{
if (client) {
- m_sender.adoptNS([[WebCoreAuthenticationClientAsChallengeSender alloc] initWithAuthenticationClient:client]);
+ m_sender = adoptNS([[WebCoreAuthenticationClientAsChallengeSender alloc] initWithAuthenticationClient:client]);
if (m_nsChallenge)
- m_nsChallenge.adoptNS([[NSURLAuthenticationChallenge alloc] initWithAuthenticationChallenge:m_nsChallenge.get() sender:m_sender.get()]);
+ m_nsChallenge = adoptNS([[NSURLAuthenticationChallenge alloc] initWithAuthenticationChallenge:m_nsChallenge.get() sender:m_sender.get()]);
} else {
if ([m_sender.get() isMemberOfClass:[WebCoreAuthenticationClientAsChallengeSender class]])
[(WebCoreAuthenticationClientAsChallengeSender *)m_sender.get() detachClient];
static RetainPtr<NSArray> filterCookies(NSArray *unfilteredCookies)
{
NSUInteger count = [unfilteredCookies count];
- RetainPtr<NSMutableArray> filteredCookies(AdoptNS, [[NSMutableArray alloc] initWithCapacity:count]);
+ RetainPtr<NSMutableArray> filteredCookies = adoptNS([[NSMutableArray alloc] initWithCapacity:count]);
for (NSUInteger i = 0; i < count; ++i) {
NSHTTPCookie *cookie = (NSHTTPCookie *)[unfilteredCookies objectAtIndex:i];
// Assume that we're offline until proven otherwise.
m_isOnLine = false;
- RetainPtr<CFStringRef> str(AdoptCF, SCDynamicStoreKeyCreateNetworkInterface(0, kSCDynamicStoreDomainState));
+ RetainPtr<CFStringRef> str = adoptCF(SCDynamicStoreKeyCreateNetworkInterface(0, kSCDynamicStoreDomainState));
- RetainPtr<CFPropertyListRef> propertyList(AdoptCF, SCDynamicStoreCopyValue(m_store.get(), str.get()));
+ RetainPtr<CFPropertyListRef> propertyList = adoptCF(SCDynamicStoreCopyValue(m_store.get(), str.get()));
if (!propertyList)
return;
if (CFStringFind(interface, CFSTR("lo"), kCFCompareAnchored).location != kCFNotFound)
continue;
- RetainPtr<CFStringRef> key(AdoptCF, SCDynamicStoreKeyCreateNetworkInterfaceEntity(0, kSCDynamicStoreDomainState, interface, kSCEntNetIPv4));
+ RetainPtr<CFStringRef> key = adoptCF(SCDynamicStoreKeyCreateNetworkInterfaceEntity(0, kSCDynamicStoreDomainState, interface, kSCEntNetIPv4));
- RetainPtr<CFArrayRef> keyList(AdoptCF, SCDynamicStoreCopyKeyList(m_store.get(), key.get()));
+ RetainPtr<CFArrayRef> keyList = adoptCF(SCDynamicStoreCopyKeyList(m_store.get(), key.get()));
if (keyList && CFArrayGetCount(keyList.get())) {
m_isOnLine = true;
{
SCDynamicStoreContext context = { 0, this, 0, 0, 0 };
- m_store.adoptCF(SCDynamicStoreCreate(0, CFSTR("com.apple.WebCore"), dynamicStoreCallback, &context));
+ m_store = adoptCF(SCDynamicStoreCreate(0, CFSTR("com.apple.WebCore"), dynamicStoreCallback, &context));
if (!m_store)
return;
- RetainPtr<CFRunLoopSourceRef> configSource(AdoptCF, SCDynamicStoreCreateRunLoopSource(0, m_store.get(), 0));
+ RetainPtr<CFRunLoopSourceRef> configSource = adoptCF(SCDynamicStoreCreateRunLoopSource(0, m_store.get(), 0));
if (!configSource)
return;
CFRunLoopAddSource(CFRunLoopGetMain(), configSource.get(), kCFRunLoopCommonModes);
- RetainPtr<CFMutableArrayRef> keys(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
- RetainPtr<CFMutableArrayRef> patterns(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
+ RetainPtr<CFMutableArrayRef> keys = adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
+ RetainPtr<CFMutableArrayRef> patterns = adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
RetainPtr<CFStringRef> key;
RetainPtr<CFStringRef> pattern;
- key.adoptCF(SCDynamicStoreKeyCreateNetworkGlobalEntity(0, kSCDynamicStoreDomainState, kSCEntNetIPv4));
+ key = adoptCF(SCDynamicStoreKeyCreateNetworkGlobalEntity(0, kSCDynamicStoreDomainState, kSCEntNetIPv4));
CFArrayAppendValue(keys.get(), key.get());
- pattern.adoptCF(SCDynamicStoreKeyCreateNetworkInterfaceEntity(0, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4));
+ pattern = adoptCF(SCDynamicStoreKeyCreateNetworkInterfaceEntity(0, kSCDynamicStoreDomainState, kSCCompAnyRegex, kSCEntNetIPv4));
CFArrayAppendValue(patterns.get(), pattern.get());
- key.adoptCF(SCDynamicStoreKeyCreateNetworkGlobalEntity(0, kSCDynamicStoreDomainState, kSCEntNetDNS));
+ key = adoptCF(SCDynamicStoreKeyCreateNetworkGlobalEntity(0, kSCDynamicStoreDomainState, kSCEntNetDNS));
CFArrayAppendValue(keys.get(), key.get());
SCDynamicStoreSetNotificationKeys(m_store.get(), keys.get(), patterns.get());
static RetainPtr<NSError> createNSErrorFromResourceErrorBase(const ResourceErrorBase& resourceError)
{
- RetainPtr<NSMutableDictionary> userInfo(AdoptNS, [[NSMutableDictionary alloc] init]);
+ RetainPtr<NSMutableDictionary> userInfo = adoptNS([[NSMutableDictionary alloc] init]);
if (!resourceError.localizedDescription().isEmpty())
[userInfo.get() setValue:resourceError.localizedDescription() forKey:NSLocalizedDescriptionKey];
[userInfo.get() setValue:cocoaURL.get() forKey:@"NSErrorFailingURLKey"];
}
- return RetainPtr<NSError>(AdoptNS, [[NSError alloc] initWithDomain:resourceError.domain() code:resourceError.errorCode() userInfo:userInfo.get()]);
+ return adoptNS([[NSError alloc] initWithDomain:resourceError.domain() code:resourceError.errorCode() userInfo:userInfo.get()]);
}
#if USE(CFNETWORK)
if (m_platformError) {
CFErrorRef error = m_platformError.get();
- RetainPtr<NSDictionary> userInfo(AdoptCF, (NSDictionary *) CFErrorCopyUserInfo(error));
- m_platformNSError.adoptNS([[NSError alloc] initWithDomain:(NSString *)CFErrorGetDomain(error) code:CFErrorGetCode(error) userInfo:userInfo.get()]);
+ RetainPtr<NSDictionary> userInfo = adoptCF((NSDictionary *) CFErrorCopyUserInfo(error));
+ m_platformNSError = adoptNS([[NSError alloc] initWithDomain:(NSString *)CFErrorGetDomain(error) code:CFErrorGetCode(error) userInfo:userInfo.get()]);
return m_platformNSError.get();
}
#endif
NSDictionary *propertyDictionary = [NSDictionary dictionaryWithObject:streamProperties forKey:@"kCFURLConnectionSocketStreamProperties"];
- d->m_connection.adoptNS([[NSURLConnection alloc] _initWithRequest:nsRequest delegate:delegate usesCache:YES maxContentLength:0 startImmediately:NO connectionProperties:propertyDictionary]);
+ d->m_connection = adoptNS([[NSURLConnection alloc] _initWithRequest:nsRequest delegate:delegate usesCache:YES maxContentLength:0 startImmediately:NO connectionProperties:propertyDictionary]);
}
bool ResourceHandle::start()
void ResourceRequest::updateNSURLRequest()
{
if (m_cfRequest)
- m_nsRequest.adoptNS([[NSURLRequest alloc] _initWithCFURLRequest:m_cfRequest.get()]);
+ m_nsRequest = adoptNS([[NSURLRequest alloc] _initWithCFURLRequest:m_cfRequest.get()]);
}
#else
}
#endif
- m_nsRequest.adoptNS(nsRequest);
+ m_nsRequest = adoptNS(nsRequest);
}
void ResourceRequest::doUpdatePlatformHTTPBody()
}
}
- m_nsRequest.adoptNS(nsRequest);
+ m_nsRequest = adoptNS(nsRequest);
}
void ResourceRequest::updateFromDelegatePreservingOldHTTPBody(const ResourceRequest& delegateProvidedRequest)
void ResourceRequest::setStorageSession(CFURLStorageSessionRef storageSession)
{
updatePlatformRequest();
- m_nsRequest.adoptNS(wkCopyRequestWithStorageSession(storageSession, m_nsRequest.get()));
+ m_nsRequest = adoptNS(wkCopyRequestWithStorageSession(storageSession, m_nsRequest.get()));
}
#endif // USE(CFNETWORK)
// FIXME: This creates a very incomplete NSURLResponse, which does not even have a status code.
- m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]);
+ m_nsResponse = adoptNS([[NSURLResponse alloc] initWithURL:m_url MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]);
}
#if USE(CFNETWORK)
return nil;
if (!m_nsResponse)
- m_nsResponse.adoptNS([[NSURLResponse _responseWithCFURLResponse:m_cfResponse.get()] retain]);
+ m_nsResponse = adoptNS([[NSURLResponse _responseWithCFURLResponse:m_cfResponse.get()] retain]);
return m_nsResponse.get();
}
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)m_nsResponse.get();
- RetainPtr<NSString> httpStatusLine(AdoptNS, wkCopyNSURLResponseStatusLine(m_nsResponse.get()));
+ RetainPtr<NSString> httpStatusLine = adoptNS(wkCopyNSURLResponseStatusLine(m_nsResponse.get()));
if (httpStatusLine)
m_httpStatusText = extractReasonPhraseFromHTTPStatusLine(httpStatusLine.get());
else
RetainPtr<CFStringRef> mimeTypeFromUTITree(CFStringRef uti)
{
// Check if this UTI has a MIME type.
- RetainPtr<CFStringRef> mimeType(AdoptCF, UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType));
+ RetainPtr<CFStringRef> mimeType = adoptCF(UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType));
if (mimeType)
return mimeType.get();
// If not, walk the ancestory of this UTI via its "ConformsTo" tags and return the first MIME type we find.
- RetainPtr<CFDictionaryRef> decl(AdoptCF, UTTypeCopyDeclaration(uti));
+ RetainPtr<CFDictionaryRef> decl = adoptCF(UTTypeCopyDeclaration(uti));
if (!decl)
return nil;
CFTypeRef value = CFDictionaryGetValue(decl.get(), kUTTypeConformsToKey);
CFURLRef url = wkGetCFURLResponseURL(cfResponse);
NSURL *nsURL = (NSURL *)url;
if ([nsURL isFileURL]) {
- RetainPtr<CFStringRef> extension(AdoptCF, CFURLCopyPathExtension(url));
+ RetainPtr<CFStringRef> extension = adoptCF(CFURLCopyPathExtension(url));
if (extension) {
// <rdar://problem/7007389> CoreTypes UTI map is missing 100+ file extensions that GateKeeper knew about
// When this radar is resolved, we can remove this file:// url specific code.
static CFDictionaryRef extensionMap = createExtensionToMIMETypeMap();
CFMutableStringRef mutableExtension = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, extension.get());
CFStringLowercase(mutableExtension, NULL);
- extension.adoptCF(mutableExtension);
+ extension = adoptCF(mutableExtension);
result = (CFStringRef) CFDictionaryGetValue(extensionMap, extension.get());
if (!result) {
// If the Gatekeeper-based map doesn't have a MIME type, we'll try to figure out what it should be by
// looking up the file extension in the UTI maps.
- RetainPtr<CFStringRef> uti(AdoptCF, UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extension.get(), 0));
+ RetainPtr<CFStringRef> uti = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extension.get(), 0));
result = mimeTypeFromUTITree(uti.get());
}
}
template<>
RetainPtr<CFLocaleRef> AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >::createValueForNullKey()
{
- RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCopyCurrent());
+ RetainPtr<CFLocaleRef> locale = adoptCF(CFLocaleCopyCurrent());
return CFStringIsHyphenationAvailableForLocale(locale.get()) ? locale : 0;
}
size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeIndex, const AtomicString& localeIdentifier)
{
- RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, reinterpret_cast<const UniChar*>(characters), length, kCFAllocatorNull));
+ RetainPtr<CFStringRef> string = adoptCF(CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, reinterpret_cast<const UniChar*>(characters), length, kCFAllocatorNull));
RetainPtr<CFLocaleRef> locale = cfLocaleCache().get(localeIdentifier);
ASSERT(locale);
template<>
bool AtomicStringKeyedMRUCache<bool>::createValueForKey(const AtomicString& localeIdentifier)
{
- RetainPtr<CFStringRef> cfLocaleIdentifier(AdoptCF, localeIdentifier.createCFString());
- RetainPtr<CFDictionaryRef> components(AdoptCF, CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorDefault, cfLocaleIdentifier.get()));
+ RetainPtr<CFStringRef> cfLocaleIdentifier = adoptCF(localeIdentifier.createCFString());
+ RetainPtr<CFDictionaryRef> components = adoptCF(CFLocaleCreateComponentsFromLocaleIdentifier(kCFAllocatorDefault, cfLocaleIdentifier.get()));
CFStringRef language = reinterpret_cast<CFStringRef>(CFDictionaryGetValue(components.get(), kCFLocaleLanguageCode));
static CFStringRef englishLanguage = CFSTR("en");
return language && CFEqual(language, englishLanguage);
{
ASSERT_UNUSED(localeIdentifier, canHyphenate(localeIdentifier));
- RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, length, kCFAllocatorNull));
+ RetainPtr<CFStringRef> string = adoptCF(CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, characters, length, kCFAllocatorNull));
return wkGetHyphenationLocationBeforeIndex(string.get(), beforeIndex);
}
if (equalIgnoringCase(currentLocaleLanguage, localeLanguage))
return currentLocale;
// It seems initWithLocaleIdentifier accepts dash-separated locale identifier.
- return RetainPtr<NSLocale>(AdoptNS, [[NSLocale alloc] initWithLocaleIdentifier:locale]);
+ return adoptNS([[NSLocale alloc] initWithLocaleIdentifier:locale]);
}
PassOwnPtr<Locale> Locale::create(const AtomicString& locale)
LocaleMac::LocaleMac(NSLocale* locale)
: m_locale(locale)
- , m_gregorianCalendar(AdoptNS, [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar])
+ , m_gregorianCalendar(adoptNS([[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]))
, m_didInitializeNumberData(false)
{
NSArray* availableLanguages = [NSLocale ISOLanguageCodes];
// NSLocale returns a lower case NSLocaleLanguageCode so we don't have care about case.
NSString* language = [m_locale.get() objectForKey:NSLocaleLanguageCode];
if ([availableLanguages indexOfObject:language] == NSNotFound)
- m_locale.adoptNS([[NSLocale alloc] initWithLocaleIdentifier:defaultLanguage()]);
+ m_locale = adoptNS([[NSLocale alloc] initWithLocaleIdentifier:defaultLanguage()]);
[m_gregorianCalendar.get() setLocale:m_locale.get()];
}
return;
m_didInitializeNumberData = true;
- RetainPtr<NSNumberFormatter> formatter(AdoptNS, [[NSNumberFormatter alloc] init]);
+ RetainPtr<NSNumberFormatter> formatter = adoptNS([[NSNumberFormatter alloc] init]);
[formatter.get() setLocale:m_locale.get()];
[formatter.get() setNumberStyle:NSNumberFormatterDecimalStyle];
[formatter.get() setUsesGroupingSeparator:NO];
- RetainPtr<NSNumber> sampleNumber(AdoptNS, [[NSNumber alloc] initWithDouble:9876543210]);
+ RetainPtr<NSNumber> sampleNumber = adoptNS([[NSNumber alloc] initWithDouble:9876543210]);
String nineToZero([formatter.get() stringFromNumber:sampleNumber.get()]);
if (nineToZero.length() != 10)
return;
static inline RetainPtr<CFStringRef> textBreakLocalePreference()
{
- RetainPtr<CFPropertyListRef> locale(AdoptCF, CFPreferencesCopyValue(CFSTR("AppleTextBreakLocale"),
+ RetainPtr<CFPropertyListRef> locale = adoptCF(CFPreferencesCopyValue(CFSTR("AppleTextBreakLocale"),
kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost));
if (!locale || CFGetTypeID(locale.get()) != CFStringGetTypeID())
return 0;
{
if (!locale)
return 0;
- RetainPtr<CFStringRef> canonicalLocale(AdoptCF,
- CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorDefault, locale));
+ RetainPtr<CFStringRef> canonicalLocale = adoptCF(CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorDefault, locale));
if (!canonicalLocale)
return locale;
return canonicalLocale;
RenderThemeMac::RenderThemeMac()
: m_isSliderThumbHorizontalPressed(false)
, m_isSliderThumbVerticalPressed(false)
- , m_notificationObserver(AdoptNS, [[WebCoreRenderThemeNotificationObserver alloc] initWithTheme:this])
+ , m_notificationObserver(adoptNS([[WebCoreRenderThemeNotificationObserver alloc] initWithTheme:this]))
{
[[NSNotificationCenter defaultCenter] addObserver:m_notificationObserver.get()
selector:@selector(systemColorsDidChange:)
ASSERT(style->appearance() != NoControlPart);
if (!m_levelIndicator)
- m_levelIndicator.adoptNS([[NSLevelIndicatorCell alloc] initWithLevelIndicatorStyle:NSContinuousCapacityLevelIndicatorStyle]);
+ m_levelIndicator = adoptNS([[NSLevelIndicatorCell alloc] initWithLevelIndicatorStyle:NSContinuousCapacityLevelIndicatorStyle]);
NSLevelIndicatorCell* cell = m_levelIndicator.get();
HTMLMeterElement* element = renderMeter->meterElement();
FloatRect topGradient(r.x(), r.y(), r.width(), r.height() / 2.0f);
struct CGFunctionCallbacks topCallbacks = { 0, TopGradientInterpolate, NULL };
- RetainPtr<CGFunctionRef> topFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &topCallbacks));
- RetainPtr<CGShadingRef> topShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(topGradient.x(), topGradient.y()), CGPointMake(topGradient.x(), topGradient.maxY()), topFunction.get(), false, false));
+ RetainPtr<CGFunctionRef> topFunction = adoptCF(CGFunctionCreate(NULL, 1, NULL, 4, NULL, &topCallbacks));
+ RetainPtr<CGShadingRef> topShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(topGradient.x(), topGradient.y()), CGPointMake(topGradient.x(), topGradient.maxY()), topFunction.get(), false, false));
FloatRect bottomGradient(r.x() + radius, r.y() + r.height() / 2.0f, r.width() - 2.0f * radius, r.height() / 2.0f);
struct CGFunctionCallbacks bottomCallbacks = { 0, BottomGradientInterpolate, NULL };
- RetainPtr<CGFunctionRef> bottomFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &bottomCallbacks));
- RetainPtr<CGShadingRef> bottomShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(bottomGradient.x(), bottomGradient.y()), CGPointMake(bottomGradient.x(), bottomGradient.maxY()), bottomFunction.get(), false, false));
+ RetainPtr<CGFunctionRef> bottomFunction = adoptCF(CGFunctionCreate(NULL, 1, NULL, 4, NULL, &bottomCallbacks));
+ RetainPtr<CGShadingRef> bottomShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bottomGradient.x(), bottomGradient.y()), CGPointMake(bottomGradient.x(), bottomGradient.maxY()), bottomFunction.get(), false, false));
struct CGFunctionCallbacks mainCallbacks = { 0, MainGradientInterpolate, NULL };
- RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
- RetainPtr<CGShadingRef> mainShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.x(), r.y()), CGPointMake(r.x(), r.maxY()), mainFunction.get(), false, false));
+ RetainPtr<CGFunctionRef> mainFunction = adoptCF(CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
+ RetainPtr<CGShadingRef> mainShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(r.x(), r.y()), CGPointMake(r.x(), r.maxY()), mainFunction.get(), false, false));
- RetainPtr<CGShadingRef> leftShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.x(), r.y()), CGPointMake(r.x() + radius, r.y()), mainFunction.get(), false, false));
+ RetainPtr<CGShadingRef> leftShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(r.x(), r.y()), CGPointMake(r.x() + radius, r.y()), mainFunction.get(), false, false));
- RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.maxX(), r.y()), CGPointMake(r.maxX() - radius, r.y()), mainFunction.get(), false, false));
+ RetainPtr<CGShadingRef> rightShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(r.maxX(), r.y()), CGPointMake(r.maxX() - radius, r.y()), mainFunction.get(), false, false));
{
GraphicsContextStateSaver stateSaver(*paintInfo.context);
CGContextClipToRect(context, bounds);
struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL };
- RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
+ RetainPtr<CGFunctionRef> mainFunction = adoptCF(CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks));
RetainPtr<CGShadingRef> mainShading;
if (o->style()->appearance() == SliderVerticalPart)
- mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.maxY()), CGPointMake(bounds.maxX(), bounds.maxY()), mainFunction.get(), false, false));
+ mainShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.maxY()), CGPointMake(bounds.maxX(), bounds.maxY()), mainFunction.get(), false, false));
else
- mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.maxY()), mainFunction.get(), false, false));
+ mainShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.maxY()), mainFunction.get(), false, false));
IntSize radius(trackRadius, trackRadius);
paintInfo.context->clipRoundedRect(RoundedRect(bounds, radius, radius, radius, radius));
NSPopUpButtonCell* RenderThemeMac::popupButton() const
{
if (!m_popupButton) {
- m_popupButton.adoptNS([[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]);
+ m_popupButton = adoptNS([[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]);
[m_popupButton.get() setUsesItemFromMenu:NO];
[m_popupButton.get() setFocusRingType:NSFocusRingTypeExterior];
}
NSSearchFieldCell* RenderThemeMac::search() const
{
if (!m_search) {
- m_search.adoptNS([[NSSearchFieldCell alloc] initTextCell:@""]);
+ m_search = adoptNS([[NSSearchFieldCell alloc] initTextCell:@""]);
[m_search.get() setBezelStyle:NSTextFieldRoundedBezel];
[m_search.get() setBezeled:YES];
[m_search.get() setEditable:YES];
NSMenu* RenderThemeMac::searchMenuTemplate() const
{
if (!m_searchMenuTemplate)
- m_searchMenuTemplate.adoptNS([[NSMenu alloc] initWithTitle:@""]);
+ m_searchMenuTemplate = adoptNS([[NSMenu alloc] initWithTitle:@""]);
return m_searchMenuTemplate.get();
}
NSSliderCell* RenderThemeMac::sliderThumbHorizontal() const
{
if (!m_sliderThumbHorizontal) {
- m_sliderThumbHorizontal.adoptNS([[NSSliderCell alloc] init]);
+ m_sliderThumbHorizontal = adoptNS([[NSSliderCell alloc] init]);
[m_sliderThumbHorizontal.get() setSliderType:NSLinearSlider];
[m_sliderThumbHorizontal.get() setControlSize:NSSmallControlSize];
[m_sliderThumbHorizontal.get() setFocusRingType:NSFocusRingTypeExterior];
NSSliderCell* RenderThemeMac::sliderThumbVertical() const
{
if (!m_sliderThumbVertical) {
- m_sliderThumbVertical.adoptNS([[NSSliderCell alloc] init]);
+ m_sliderThumbVertical = adoptNS([[NSSliderCell alloc] init]);
[m_sliderThumbVertical.get() setSliderType:NSLinearSlider];
[m_sliderThumbVertical.get() setControlSize:NSSmallControlSize];
[m_sliderThumbVertical.get() setFocusRingType:NSFocusRingTypeExterior];
NSTextFieldCell* RenderThemeMac::textField() const
{
if (!m_textField) {
- m_textField.adoptNS([[WebCoreTextFieldCell alloc] initTextCell:@""]);
+ m_textField = adoptNS([[WebCoreTextFieldCell alloc] initTextCell:@""]);
[m_textField.get() setBezeled:YES];
[m_textField.get() setEditable:YES];
[m_textField.get() setFocusRingType:NSFocusRingTypeExterior];
+2013-04-27 Darin Adler <darin@apple.com>
+
+ Move from constructor and member function adoptCF/NS to free function adoptCF/NS.
+ https://bugs.webkit.org/show_bug.cgi?id=115307
+
+ Reviewed by Geoffrey Garen.
+
+ * WebCoreSupport/WebInspectorClientCF.cpp:
+ (populateSetting): Use adoptCF.
+
2013-04-02 Timothy Hatcher <timothy@apple.com>
Provide a user default that can be used to disable docking of the Web Inspector.
static void populateSetting(const String& key, String* setting)
{
RetainPtr<CFStringRef> preferencesKey = createKeyForPreferences(key);
- RetainPtr<CFPropertyListRef> value(AdoptCF, CFPreferencesCopyAppValue(preferencesKey.get(), kCFPreferencesCurrentApplication));
+ RetainPtr<CFPropertyListRef> value = adoptCF(CFPreferencesCopyAppValue(preferencesKey.get(), kCFPreferencesCurrentApplication));
if (!value)
return;
+2013-04-27 Darin Adler <darin@apple.com>
+
+ Move from constructor and member function adoptCF/NS to free function adoptCF/NS.
+ https://bugs.webkit.org/show_bug.cgi?id=115307
+
+ Reviewed by Geoffrey Garen.
+
+ This change was done by a global replace followed by compiling and inspecting for
+ cases that needed to be tweaked by hand.
+
+ * DefaultDelegates/WebDefaultContextMenuDelegate.mm:
+ (-[WebDefaultUIDelegate menuItemWithTag:target:representedObject:]):
+ * Misc/WebNSFileManagerExtras.mm:
+ (-[NSFileManager _webkit_startupVolumeName]):
+ * Plugins/Hosted/HostedNetscapePluginStream.mm:
+ (WebKit::HostedNetscapePluginStream::HostedNetscapePluginStream):
+ * Plugins/Hosted/NetscapePluginHostManager.mm:
+ (WebKit::NetscapePluginHostManager::spawnPluginHost):
+ (WebKit::NetscapePluginHostManager::instantiatePlugin):
+ * Plugins/Hosted/NetscapePluginHostProxy.mm:
+ (WebKit::NetscapePluginHostProxy::NetscapePluginHostProxy):
+ (WebKit::NetscapePluginHostProxy::beginModal):
+ (WKPCBooleanAndDataReply):
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::print):
+ (WebKit::NetscapePluginInstanceProxy::snapshot):
+ (WebKit::NetscapePluginInstanceProxy::status):
+ (WebKit::NetscapePluginInstanceProxy::loadURL):
+ (WebKit::NetscapePluginInstanceProxy::evaluateJavaScript):
+ (WebKit::NetscapePluginInstanceProxy::enumerate):
+ (WebKit::NetscapePluginInstanceProxy::marshalValue):
+ (WebKit::NetscapePluginInstanceProxy::marshalValues):
+ (WebKit::NetscapePluginInstanceProxy::demarshalValue):
+ (WebKit::NetscapePluginInstanceProxy::demarshalValues):
+ * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+ (-[WebHostedNetscapePluginView setAttributeKeys:andValues:]):
+ (-[WebHostedNetscapePluginView createPlugin]):
+ * Plugins/WebBaseNetscapePluginView.mm:
+ (-[WebBaseNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:WebCore::]):
+ (-[WebBaseNetscapePluginView cacheSnapshot]):
+ (WebKit::getAuthenticationInfo):
+ * Plugins/WebBasePluginPackage.mm:
+ (-[WebBasePluginPackage initWithPath:]):
+ * Plugins/WebNetscapePluginEventHandlerCarbon.mm:
+ (WebNetscapePluginEventHandlerCarbon::startTimers):
+ * Plugins/WebNetscapePluginEventHandlerCocoa.mm:
+ (WebNetscapePluginEventHandlerCocoa::syntheticKeyDownWithCommandModifier):
+ (WebNetscapePluginEventHandlerCocoa::handleTSMEvent):
+ * Plugins/WebNetscapePluginPackage.mm:
+ (-[WebNetscapePluginPackage _initWithPath:]):
+ * Plugins/WebNetscapePluginStream.mm:
+ (WebNetscapePluginStream::WebNetscapePluginStream):
+ (WebNetscapePluginStream::deliverData):
+ (WebNetscapePluginStream::deliverDataToFile):
+ (WebNetscapePluginStream::didReceiveData):
+ * Plugins/WebNetscapePluginView.mm:
+ (-[WebNetscapePluginView createPlugin]):
+ (-[WebNetscapePluginView initWithFrame:pluginPackage:URL:baseURL:MIMEType:attributeKeys:attributeValues:loadManually:element:WebCore::]):
+ (-[WebNetscapePluginView evaluateJavaScriptPluginRequest:]):
+ * Storage/WebDatabaseManagerClient.mm:
+ (WebDatabaseManagerClient::dispatchDidModifyOrigin):
+ (WebDatabaseManagerClient::dispatchDidModifyDatabase):
+ * Storage/WebStorageTrackerClient.mm:
+ (WebStorageTrackerClient::dispatchDidModifyOrigin):
+ * WebCoreSupport/CorrectionPanel.mm:
+ (CorrectionPanel::handleAcceptedReplacement):
+ * WebCoreSupport/WebApplicationCache.mm:
+ (+[WebApplicationCache originsWithCache]):
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::didRunInsecureContent):
+ * WebCoreSupport/WebInspectorClient.mm:
+ (WebInspectorClient::WebInspectorClient):
+ (WebInspectorClient::openInspectorFrontend):
+ * WebView/WebFullScreenController.mm:
+ (-[WebFullScreenController enterFullScreen:]):
+ * WebView/WebPDFDocumentExtras.mm:
+ (allScriptsInPDFDocument):
+ * WebView/WebPreferences.mm:
+ (-[WebPreferences initWithIdentifier:]):
+ (-[WebPreferences initWithCoder:]):
+ * WebView/WebScriptDebugger.mm:
+ (WebScriptDebugger::initGlobalCallFrame):
+ (WebScriptDebugger::callEvent):
+ * WebView/WebView.mm:
+ (-[WebView previousValidKeyView]):
+ Use adoptNS and adoptCF free functions.
+
2013-04-25 Roger Fong <roger_fong@apple.com>
Disable sub-pixel layout on mac.
break;
case WebMenuItemTagSearchWeb: {
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
- RetainPtr<CFStringRef> searchProviderName(AdoptCF, WKCopyDefaultSearchProviderDisplayName());
+ RetainPtr<CFStringRef> searchProviderName = adoptCF(WKCopyDefaultSearchProviderDisplayName());
title = [NSString stringWithFormat:UI_STRING_INTERNAL("Search with %@", "Search with search provider context menu item with provider name inserted"), searchProviderName.get()];
#else
title = UI_STRING_INTERNAL("Search with Google", "Search with Google context menu item");
- (NSString *)_webkit_startupVolumeName
{
- RetainPtr<DASessionRef> session(AdoptCF, DASessionCreate(kCFAllocatorDefault));
- RetainPtr<DADiskRef> disk(AdoptCF, DADiskCreateFromVolumePath(kCFAllocatorDefault, session.get(), (CFURLRef)[NSURL fileURLWithPath:@"/"]));
- RetainPtr<CFDictionaryRef> diskDescription(AdoptCF, DADiskCopyDescription(disk.get()));
+ RetainPtr<DASessionRef> session = adoptCF(DASessionCreate(kCFAllocatorDefault));
+ RetainPtr<DADiskRef> disk = adoptCF(DADiskCreateFromVolumePath(kCFAllocatorDefault, session.get(), (CFURLRef)[NSURL fileURLWithPath:@"/"]));
+ RetainPtr<CFDictionaryRef> diskDescription = adoptCF(DADiskCopyDescription(disk.get()));
RetainPtr<NSString> diskName = (NSString *)CFDictionaryGetValue(diskDescription.get(), kDADiskDescriptionVolumeNameKey);
return WebCFAutorelease(diskName.leakRef());
}
HostedNetscapePluginStream::HostedNetscapePluginStream(NetscapePluginInstanceProxy* instance, uint32_t streamID, NSURLRequest *request)
: m_instance(instance)
, m_streamID(streamID)
- , m_request(AdoptNS, [request mutableCopy])
+ , m_request(adoptNS([request mutableCopy]))
, m_requestURL([request URL])
, m_frameLoader(0)
{
NSString *pluginHostAppPath = [[NSBundle bundleWithIdentifier:@"com.apple.WebKit"] pathForAuxiliaryExecutable:pluginHostAppName];
NSString *pluginHostAppExecutablePath = [[NSBundle bundleWithPath:pluginHostAppPath] executablePath];
- RetainPtr<CFStringRef> localization(AdoptCF, WKCopyCFLocalizationPreferredName(NULL));
+ RetainPtr<CFStringRef> localization = adoptCF(WKCopyCFLocalizationPreferredName(NULL));
NSDictionary *launchProperties = [[NSDictionary alloc] initWithObjectsAndKeys:
pluginHostAppExecutablePath, @"pluginHostPath",
if (!hostProxy)
return 0;
- RetainPtr<NSMutableDictionary> properties(AdoptNS, [[NSMutableDictionary alloc] init]);
+ RetainPtr<NSMutableDictionary> properties = adoptNS([[NSMutableDictionary alloc] init]);
if (mimeType)
[properties.get() setObject:mimeType forKey:@"mimeType"];
// FIXME: We should use libdispatch for this.
CFMachPortContext context = { 0, this, 0, 0, 0 };
- m_deadNameNotificationPort.adoptCF(CFMachPortCreate(0, deadNameNotificationCallback, &context, 0));
+ m_deadNameNotificationPort = adoptCF(CFMachPortCreate(0, deadNameNotificationCallback, &context, 0));
mach_port_t previous;
mach_port_request_notification(mach_task_self(), pluginHostPort, MACH_NOTIFY_DEAD_NAME, 0,
CFMachPortGetPort(m_deadNameNotificationPort.get()), MACH_MSG_TYPE_MAKE_SEND_ONCE, &previous);
ASSERT(previous == MACH_PORT_NULL);
- RetainPtr<CFRunLoopSourceRef> deathPortSource(AdoptCF, CFMachPortCreateRunLoopSource(0, m_deadNameNotificationPort.get(), 0));
+ RetainPtr<CFRunLoopSourceRef> deathPortSource = adoptCF(CFMachPortCreateRunLoopSource(0, m_deadNameNotificationPort.get(), 0));
CFRunLoopAddSource(CFRunLoopGetCurrent(), deathPortSource.get(), kCFRunLoopDefaultMode);
- m_clientPortSource.adoptCF(WKCreateMIGServerSource((mig_subsystem_t)&WKWebKitPluginClient_subsystem, m_clientPort));
+ m_clientPortSource = adoptCF(WKCreateMIGServerSource((mig_subsystem_t)&WKWebKitPluginClient_subsystem, m_clientPort));
CFRunLoopAddSource(CFRunLoopGetCurrent(), m_clientPortSource.get(), kCFRunLoopDefaultMode);
CFRunLoopAddSource(CFRunLoopGetCurrent(), m_clientPortSource.get(), (CFStringRef)NSEventTrackingRunLoopMode);
}
ASSERT(!m_placeholderWindow);
ASSERT(!m_activationObserver);
- m_placeholderWindow.adoptNS([[WebPlaceholderModalWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+ m_placeholderWindow = adoptNS([[WebPlaceholderModalWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
m_activationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationWillBecomeActiveNotification object:NSApp queue:nil
usingBlock:^(NSNotification *){ applicationDidBecomeActive(); }];
if (!instanceProxy)
return KERN_FAILURE;
- RetainPtr<CFDataRef> result(AdoptCF, CFDataCreate(0, reinterpret_cast<UInt8*>(resultData), resultLength));
+ RetainPtr<CFDataRef> result = adoptCF(CFDataCreate(0, reinterpret_cast<UInt8*>(resultData), resultLength));
instanceProxy->setCurrentReply(requestID, new NetscapePluginInstanceProxy::BooleanAndDataReply(returnValue, result));
return KERN_SUCCESS;
if (!reply.get() || !reply->m_returnValue)
return;
- RetainPtr<CGDataProvider> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(reply->m_result.get()));
- RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
- RetainPtr<CGImageRef> image(AdoptCF, CGImageCreate(width, height, 8, 32, width * 4, colorSpace.get(), kCGImageAlphaFirst, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
+ RetainPtr<CGDataProvider> dataProvider = adoptCF(CGDataProviderCreateWithCFData(reply->m_result.get()));
+ RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
+ RetainPtr<CGImageRef> image = adoptCF(CGImageCreate(width, height, 8, 32, width * 4, colorSpace.get(), kCGImageAlphaFirst, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
// Flip the context and draw the image.
CGContextSaveGState(context);
if (!reply.get() || !reply->m_returnValue)
return;
- RetainPtr<CGDataProvider> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(reply->m_result.get()));
- RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
- RetainPtr<CGImageRef> image(AdoptCF, CGImageCreate(width, height, 8, 32, width * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
+ RetainPtr<CGDataProvider> dataProvider = adoptCF(CGDataProviderCreateWithCFData(reply->m_result.get()));
+ RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
+ RetainPtr<CGImageRef> image = adoptCF(CGImageCreate(width, height, 8, 32, width * 4, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
CGContextDrawImage(context, CGRectMake(0, 0, width, height), image.get());
}
void NetscapePluginInstanceProxy::status(const char* message)
{
- RetainPtr<CFStringRef> status(AdoptCF, CFStringCreateWithCString(0, message ? message : "", kCFStringEncodingUTF8));
+ RetainPtr<CFStringRef> status = adoptCF(CFStringCreateWithCString(0, message ? message : "", kCFStringEncodingUTF8));
if (!status)
return;
// If we're posting a file, buf is either a file URL or a path to the file.
if (!postData)
return NPERR_INVALID_PARAM;
- RetainPtr<CFStringRef> bufString(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, postData, kCFStringEncodingWindowsLatin1));
+ RetainPtr<CFStringRef> bufString = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, postData, kCFStringEncodingWindowsLatin1));
if (!bufString)
return NPERR_INVALID_PARAM;
RefPtr<HostedNetscapePluginStream> stream = HostedNetscapePluginStream::create(this, pluginRequest->requestID(), pluginRequest->request());
m_streams.add(stream->streamID(), stream);
- RetainPtr<NSURLResponse> response(AdoptNS, [[NSURLResponse alloc] initWithURL:URL
+ RetainPtr<NSURLResponse> response = adoptNS([[NSURLResponse alloc] initWithURL:URL
MIMEType:@"text/plain"
expectedContentLength:[JSData length]
textEncodingName:nil]);
PropertyNameArray propertyNames(exec);
object->methodTable()->getPropertyNames(object, exec, propertyNames, ExcludeDontEnumProperties);
- RetainPtr<NSMutableArray*> array(AdoptNS, [[NSMutableArray alloc] init]);
+ RetainPtr<NSMutableArray*> array = adoptNS([[NSMutableArray alloc] init]);
for (unsigned i = 0; i < propertyNames.size(); i++) {
uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(propertyNames[i].string().utf8().data()));
void NetscapePluginInstanceProxy::marshalValue(ExecState* exec, JSValue value, data_t& resultData, mach_msg_type_number_t& resultLength)
{
- RetainPtr<NSMutableArray*> array(AdoptNS, [[NSMutableArray alloc] init]);
+ RetainPtr<NSMutableArray*> array = adoptNS([[NSMutableArray alloc] init]);
addValueToArray(array.get(), exec, value);
RetainPtr<NSData *> NetscapePluginInstanceProxy::marshalValues(ExecState* exec, const ArgList& args)
{
- RetainPtr<NSMutableArray*> array(AdoptNS, [[NSMutableArray alloc] init]);
+ RetainPtr<NSMutableArray*> array = adoptNS([[NSMutableArray alloc] init]);
for (unsigned i = 0; i < args.size(); i++)
addValueToArray(array.get(), exec, args.at(i));
JSValue NetscapePluginInstanceProxy::demarshalValue(ExecState* exec, const char* valueData, mach_msg_type_number_t valueLength)
{
- RetainPtr<NSData*> data(AdoptNS, [[NSData alloc] initWithBytesNoCopy:(void*)valueData length:valueLength freeWhenDone:NO]);
+ RetainPtr<NSData*> data = adoptNS([[NSData alloc] initWithBytesNoCopy:(void*)valueData length:valueLength freeWhenDone:NO]);
RetainPtr<NSArray*> array = [NSPropertyListSerialization propertyListFromData:data.get()
mutabilityOption:NSPropertyListImmutable
void NetscapePluginInstanceProxy::demarshalValues(ExecState* exec, data_t valuesData, mach_msg_type_number_t valuesLength, MarkedArgumentBuffer& result)
{
- RetainPtr<NSData*> data(AdoptNS, [[NSData alloc] initWithBytesNoCopy:valuesData length:valuesLength freeWhenDone:NO]);
+ RetainPtr<NSData*> data = adoptNS([[NSData alloc] initWithBytesNoCopy:valuesData length:valuesLength freeWhenDone:NO]);
RetainPtr<NSArray*> array = [NSPropertyListSerialization propertyListFromData:data.get()
mutabilityOption:NSPropertyListImmutable
ASSERT(!_attributeKeys);
ASSERT(!_attributeValues);
- _attributeKeys.adoptNS([keys copy]);
- _attributeValues.adoptNS([values copy]);
+ _attributeKeys = adoptNS([keys copy]);
+ _attributeValues = adoptNS([values copy]);
}
- (BOOL)createPlugin
// FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView.
// Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry
// in order to get the coordinate system right.
- RetainPtr<CALayer> realPluginLayer(AdoptNS, _pluginLayer.leakRef());
+ RetainPtr<CALayer> realPluginLayer = adoptNS(_pluginLayer.leakRef());
- _pluginLayer.adoptNS([[CALayer alloc] init]);
+ _pluginLayer = adoptNS([[CALayer alloc] init]);
_pluginLayer.get().bounds = realPluginLayer.get().bounds;
_pluginLayer.get().geometryFlipped = YES;
_pluginPackage = pluginPackage;
_element = element;
- _sourceURL.adoptNS([URL copy]);
- _baseURL.adoptNS([baseURL copy]);
- _MIMEType.adoptNS([MIME copy]);
+ _sourceURL = adoptNS([URL copy]);
+ _baseURL = adoptNS([baseURL copy]);
+ _MIMEType = adoptNS([MIME copy]);
// Enable "kiosk mode" when instantiating the QT plug-in inside of Dashboard. See <rdar://problem/6878105>
if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.dashboard.client"] &&
[_pluginPackage.get() bundleIdentifier] == "com.apple.QuickTime Plugin.plugin") {
- RetainPtr<NSMutableArray> mutableKeys(AdoptNS, [keys mutableCopy]);
- RetainPtr<NSMutableArray> mutableValues(AdoptNS, [values mutableCopy]);
+ RetainPtr<NSMutableArray> mutableKeys = adoptNS([keys mutableCopy]);
+ RetainPtr<NSMutableArray> mutableValues = adoptNS([values mutableCopy]);
[mutableKeys.get() addObject:@"kioskmode"];
[mutableValues.get() addObject:@"true"];
[snapshot unlockFocus];
_snapshotting = NO;
- _cachedSnapshot.adoptNS(snapshot);
+ _cachedSnapshot = adoptNS(snapshot);
}
- (void)clearCachedSnapshot
authenticationMethod = NSURLAuthenticationMethodHTTPDigest;
}
- RetainPtr<NSURLProtectionSpace> protectionSpace(AdoptNS, [[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:authenticationMethod]);
+ RetainPtr<NSURLProtectionSpace> protectionSpace = adoptNS([[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:authenticationMethod]);
NSURLCredential *credential = mac(CredentialStorage::get(core(protectionSpace.get())));
if (!credential)
return nil;
path = pathByResolvingSymlinksAndAliases(pluginPath);
- cfBundle.adoptCF(CFBundleCreate(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:path]));
+ cfBundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, (CFURLRef)[NSURL fileURLWithPath:path]));
if (!cfBundle) {
[self release];
CFTimeInterval interval = !throttleTimers ? NullEventIntervalActive : NullEventIntervalNotActive;
CFRunLoopTimerContext context = { 0, this, NULL, NULL, NULL };
- m_nullEventTimer.adoptCF(CFRunLoopTimerCreate(0, CFAbsoluteTimeGetCurrent() + interval, interval,
+ m_nullEventTimer = adoptCF(CFRunLoopTimerCreate(0, CFAbsoluteTimeGetCurrent() + interval, interval,
0, 0, nullEventTimerFired, &context));
CFRunLoopAddTimer(CFRunLoopGetCurrent(), m_nullEventTimer.get(), kCFRunLoopDefaultMode);
}
{
char nullTerminatedString[] = { character, '\0' };
- RetainPtr<NSString> characters(AdoptNS, [[NSString alloc] initWithUTF8String:nullTerminatedString]);
+ RetainPtr<NSString> characters = adoptNS([[NSString alloc] initWithUTF8String:nullTerminatedString]);
NPCocoaEvent event;
initializeEvent(&event, NPCocoaEventKeyDown);
if (result != noErr)
return result;
- RetainPtr<CFStringRef> text(AdoptCF, CFStringCreateWithCharacters(0, characters.data(), length));
+ RetainPtr<CFStringRef> text = adoptCF(CFStringCreateWithCharacters(0, characters.data(), length));
NPCocoaEvent event;
return NO;
#if USE(PLUGIN_HOST_PROCESS)
- RetainPtr<CFArrayRef> archs(AdoptCF, CFBundleCopyExecutableArchitectures(cfBundle.get()));
+ RetainPtr<CFArrayRef> archs = adoptCF(CFBundleCopyExecutableArchitectures(cfBundle.get()));
if ([(NSArray *)archs.get() containsObject:[NSNumber numberWithInteger:NSBundleExecutableArchitectureX86_64]])
pluginHostArchitecture = CPU_TYPE_X86_64;
else
return NO;
#else
- RetainPtr<CFURLRef> executableURL(AdoptCF, CFBundleCopyExecutableURL(cfBundle.get()));
+ RetainPtr<CFURLRef> executableURL = adoptCF(CFBundleCopyExecutableURL(cfBundle.get()));
if (!executableURL)
return NO;
NSFileHandle *executableFile = [NSFileHandle fileHandleForReadingAtPath:[(NSURL *)executableURL.get() path]];
, m_isTerminated(false)
, m_newStreamSuccessful(false)
, m_frameLoader(0)
- , m_request(AdoptNS, [request mutableCopy])
+ , m_request(adoptNS([request mutableCopy]))
, m_pluginFuncs(0)
, m_deliverDataTimer(this, &WebNetscapePluginStream::deliverDataTimerFired)
{
NSMutableData *newDeliveryData = [[NSMutableData alloc] initWithCapacity:totalBytes - totalBytesDelivered];
[newDeliveryData appendBytes:(char *)[m_deliveryData.get() bytes] + totalBytesDelivered length:totalBytes - totalBytesDelivered];
- m_deliveryData.adoptNS(newDeliveryData);
+ m_deliveryData = adoptNS(newDeliveryData);
} else {
[m_deliveryData.get() setLength:0];
if (m_reason != WEB_REASON_NONE)
return;
}
- m_path.adoptNS([[NSString stringWithUTF8String:temporaryFileName] retain]);
+ m_path = adoptNS([[NSString stringWithUTF8String:temporaryFileName] retain]);
free(temporaryFileName);
}
if (m_transferMode != NP_ASFILEONLY) {
if (!m_deliveryData)
- m_deliveryData.adoptNS([[NSMutableData alloc] initWithCapacity:[data length]]);
+ m_deliveryData = adoptNS([[NSMutableData alloc] initWithCapacity:[data length]]);
[m_deliveryData.get() appendData:data];
deliverData();
}
if ([_pluginPackage.get() pluginFuncs]->getvalue(plugin, NPPVpluginCoreAnimationLayer, &value) == NPERR_NO_ERROR && value) {
// The plug-in gives us a retained layer.
- _pluginLayer.adoptNS((CALayer *)value);
+ _pluginLayer = adoptNS((CALayer *)value);
BOOL accleratedCompositingEnabled = false;
#if USE(ACCELERATED_COMPOSITING)
// FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView.
// Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry
// in order to get the coordinate system right.
- RetainPtr<CALayer> realPluginLayer(AdoptNS, _pluginLayer.leakRef());
+ RetainPtr<CALayer> realPluginLayer = adoptNS(_pluginLayer.leakRef());
- _pluginLayer.adoptNS([[CALayer alloc] init]);
+ _pluginLayer = adoptNS([[CALayer alloc] init]);
_pluginLayer.get().bounds = realPluginLayer.get().bounds;
_pluginLayer.get().geometryFlipped = YES;
if (!self)
return nil;
- _pendingFrameLoads.adoptNS([[NSMutableDictionary alloc] init]);
+ _pendingFrameLoads = adoptNS([[NSMutableDictionary alloc] init]);
// load the plug-in if it is not already loaded
if (![pluginPackage load]) {
RefPtr<WebNetscapePluginStream> stream = WebNetscapePluginStream::create([NSURLRequest requestWithURL:URL], plugin, [JSPluginRequest sendNotification], [JSPluginRequest notifyData]);
- RetainPtr<NSURLResponse> response(AdoptNS, [[NSURLResponse alloc] initWithURL:URL
+ RetainPtr<NSURLResponse> response = adoptNS([[NSURLResponse alloc] initWithURL:URL
MIMEType:@"text/plain"
expectedContentLength:[JSData length]
textEncodingName:nil]);
return;
}
- RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
+ RetainPtr<WebSecurityOrigin> webSecurityOrigin = adoptNS([[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
[[NSNotificationCenter defaultCenter] postNotificationName:WebDatabaseDidModifyOriginNotification
object:webSecurityOrigin.get()];
return;
}
- RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
- RetainPtr<NSDictionary> userInfo(AdoptNS, [[NSDictionary alloc]
+ RetainPtr<WebSecurityOrigin> webSecurityOrigin = adoptNS([[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
+ RetainPtr<NSDictionary> userInfo = adoptNS([[NSDictionary alloc]
initWithObjectsAndKeys:(NSString *)databaseIdentifier, WebDatabaseIdentifierKey, nil]);
[[NSNotificationCenter defaultCenter] postNotificationName:WebDatabaseDidModifyDatabaseNotification
void WebStorageTrackerClient::dispatchDidModifyOrigin(PassRefPtr<SecurityOrigin> origin)
{
- RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin.get()]);
+ RetainPtr<WebSecurityOrigin> webSecurityOrigin = adoptNS([[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin.get()]);
[[NSNotificationCenter defaultCenter] postNotificationName:WebStorageDidModifyOriginNotification
object:webSecurityOrigin.get()];
[m_view.get() handleAcceptedAlternativeText:acceptedReplacement];
m_view.clear();
if (acceptedReplacement)
- m_resultForDismissal.adoptNS([acceptedReplacement copy]);
+ m_resultForDismissal = adoptNS([acceptedReplacement copy]);
}
#endif //USE(AUTOCORRECTION_PANEL)
HashSet<RefPtr<SecurityOrigin> >::const_iterator end = coreOrigins.end();
for (HashSet<RefPtr<SecurityOrigin> >::const_iterator it = coreOrigins.begin(); it != end; ++it) {
- RetainPtr<WebSecurityOrigin> webOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:(*it).get()]);
+ RetainPtr<WebSecurityOrigin> webOrigin = adoptNS([[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:(*it).get()]);
[webOrigins addObject:webOrigin.get()];
}
WebView *webView = getWebView(m_webFrame.get());
WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView);
if (implementations->didRunInsecureContentFunc) {
- RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
+ RetainPtr<WebSecurityOrigin> webSecurityOrigin = adoptNS([[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
CallFrameLoadDelegate(implementations->didRunInsecureContentFunc, webView, @selector(webView:didRunInsecureContent:), webSecurityOrigin.get());
}
}
WebInspectorClient::WebInspectorClient(WebView *webView)
: m_webView(webView)
- , m_highlighter(AdoptNS, [[WebNodeHighlighter alloc] initWithInspectedWebView:webView])
+ , m_highlighter(adoptNS([[WebNodeHighlighter alloc] initWithInspectedWebView:webView]))
, m_frontendPage(0)
, m_frontendClient(0)
{
InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(InspectorController* inspectorController)
{
- RetainPtr<WebInspectorWindowController> windowController(AdoptNS, [[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]);
+ RetainPtr<WebInspectorWindowController> windowController = adoptNS([[WebInspectorWindowController alloc] initWithInspectedWebView:m_webView]);
[windowController.get() setInspectorClient:this];
m_frontendPage = core([windowController.get() webView]);
OwnPtr<WebInspectorFrontendClient> frontendClient = adoptPtr(new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage, createFrontendSettings()));
m_frontendClient = frontendClient.get();
- RetainPtr<WebInspectorFrontend> webInspectorFrontend(AdoptNS, [[WebInspectorFrontend alloc] initWithFrontendClient:frontendClient.get()]);
+ RetainPtr<WebInspectorFrontend> webInspectorFrontend = adoptNS([[WebInspectorFrontend alloc] initWithFrontendClient:frontendClient.get()]);
[[m_webView inspector] setFrontend:webInspectorFrontend.get()];
m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient.release());
return this;
// Swap the webView placeholder into place.
if (!_webViewPlaceholder) {
- _webViewPlaceholder.adoptNS([[NSView alloc] init]);
+ _webViewPlaceholder = adoptNS([[NSView alloc] init]);
[_webViewPlaceholder.get() setLayer:[CALayer layer]];
[_webViewPlaceholder.get() setWantsLayer:YES];
}
RetainPtr<CFDataRef> data;
if (CGPDFDictionaryGetStream(javaScriptAction, "JS", &stream)) {
CGPDFDataFormat format;
- data.adoptCF(CGPDFStreamCopyData(stream, &format));
+ data = adoptCF(CGPDFStreamCopyData(stream, &format));
if (!data)
continue;
bytes = CFDataGetBytePtr(data.get());
return nil;
_private = new WebPreferencesPrivate;
- _private->values.adoptNS([[NSMutableDictionary alloc] init]);
- _private->identifier.adoptNS([anIdentifier copy]);
+ _private->values = adoptNS([[NSMutableDictionary alloc] init]);
+ _private->identifier = adoptNS([anIdentifier copy]);
_private->automaticallyDetectsCacheModel = YES;
[[self class] _setInstance:self forIdentifier:_private->identifier.get()];
}
if ([identifier isKindOfClass:[NSString class]])
- _private->identifier.adoptNS([identifier copy]);
+ _private->identifier = adoptNS([identifier copy]);
if ([values isKindOfClass:[NSDictionary class]])
- _private->values.adoptNS([values mutableCopy]); // ensure dictionary is mutable
+ _private->values = adoptNS([values mutableCopy]); // ensure dictionary is mutable
LOG(Encoding, "Identifier = %@, Values = %@\n", _private->identifier.get(), _private->values.get());
} @catch(id) {
WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
- m_topCallFrame.adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script()->windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
+ m_topCallFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script()->windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
m_globalCallFrame = m_topCallFrame;
WebView *webView = [webFrame webView];
WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
- m_topCallFrame.adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script()->windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
+ m_topCallFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script()->windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
WebView *webView = [webFrame webView];
WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
// Use a visited set so we don't loop indefinitely when walking crazy key loops.
// AppKit uses such sets internally and we want our loop to be as robust as its loops.
- RetainPtr<CFMutableSetRef> visitedViews(AdoptCF, CFSetCreateMutable(0, 0, 0));
+ RetainPtr<CFMutableSetRef> visitedViews = adoptCF(CFSetCreateMutable(0, 0, 0));
CFSetAddValue(visitedViews.get(), result);
NSView *previousView = self;
+2013-04-27 Darin Adler <darin@apple.com>
+
+ Move from constructor and member function adoptCF/NS to free function adoptCF/NS.
+ https://bugs.webkit.org/show_bug.cgi?id=115307
+
+ Reviewed by Geoffrey Garen.
+
+ This change was done by a global replace followed by compiling and inspecting for
+ cases that needed to be tweaked by hand.
+
+ * Platform/cg/CGUtilities.cpp:
+ (WebKit::paintBitmapContext):
+ * Platform/mac/ModuleMac.mm:
+ (WebKit::Module::load):
+ (WebKit::Module::platformFunctionPointer):
+ * PluginProcess/mac/PluginProcessMac.mm:
+ (WebKit::PluginProcess::initializeSandbox):
+ * Shared/API/c/mac/WKURLRequestNS.mm:
+ (WKURLRequestCreateWithNSURLRequest):
+ * Shared/API/c/mac/WKURLResponseNS.mm:
+ (WKURLResponseCreateWithNSURLResponse):
+ * Shared/Downloads/mac/DownloadMac.mm:
+ (WebKit::Download::start):
+ (WebKit::Download::startWithHandle):
+ * Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h:
+ (WebKit::ChildProcessMain):
+ * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
+ (WebKit::getPluginArchitecture):
+ (WebKit::contentsOfPropertyListAtURL):
+ (WebKit::getMIMETypesFromPluginBundle):
+ (WebKit::getStringListResource):
+ (WebKit::NetscapePluginModule::getPluginInfo):
+ * Shared/ShareableResource.cpp:
+ (WebKit::ShareableResource::Handle::tryWrapInSharedBuffer):
+ * Shared/cf/ArgumentCodersCF.cpp:
+ (CoreIPC::decode):
+ (CoreIPC::encode):
+ * Shared/cg/ShareableBitmapCG.cpp:
+ (WebKit::ShareableBitmap::createGraphicsContext):
+ (WebKit::ShareableBitmap::makeCGImageCopy):
+ (WebKit::ShareableBitmap::makeCGImage):
+ (WebKit::ShareableBitmap::createCGImage):
+ * Shared/mac/ArgumentCodersMac.mm:
+ (CoreIPC::decode):
+ * Shared/mac/PlatformCertificateInfo.mm:
+ (WebKit::PlatformCertificateInfo::dump):
+ * Shared/mac/WebCoreArgumentCodersMac.mm:
+ (CoreIPC::::encodePlatformData):
+ (CoreIPC::::decodePlatformData):
+ * UIProcess/API/mac/FindIndicatorWindow.mm:
+ (WebKit::FindIndicatorWindow::setFindIndicator):
+ (WebKit::FindIndicatorWindow::startFadeOutTimerFired):
+ * UIProcess/API/mac/PDFViewController.mm:
+ (-[WKPDFView initWithFrame:PDFViewController:]):
+ (WebKit::PDFViewController::PDFViewController):
+ (WebKit::convertPostScriptDataSourceToPDF):
+ (WebKit::PDFViewController::setPDFDocumentData):
+ * UIProcess/API/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::PageClientImpl):
+ (WebKit::PageClientImpl::registerEditCommand):
+ (WebKit::PageClientImpl::setDragImage):
+ * UIProcess/API/mac/WKBrowsingContextController.mm:
+ (didFailProvisionalLoadWithErrorForFrame):
+ (didFailLoadWithErrorForFrame):
+ * UIProcess/API/mac/WKConnection.mm:
+ (didReceiveMessage):
+ * UIProcess/API/mac/WKPrintingView.mm:
+ (-[WKPrintingView drawRect:]):
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView browsingContextController]):
+ (-[WKView _setAcceleratedCompositingModeRootLayer:]):
+ (-[WKView _setPromisedData:WebCore::withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:WebCore::forPasteboard:]):
+ (-[WKView namesOfPromisedFilesDroppedAtDestination:]):
+ (-[WKView fullScreenWindowController]):
+ (-[WKView _executeSavedCommandBySelector:]):
+ (-[WKView printOperationWithPrintInfo:forFrame:]):
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+ (WebKit::createProcess):
+ * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
+ (WebKit::PluginInfoStore::pluginPathsInDirectory):
+ (WebKit::PluginInfoStore::getMIMETypeForExtension):
+ * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
+ (WebKit::PluginProcessProxy::beginModal):
+ * UIProcess/cf/WebBackForwardListCF.cpp:
+ (WebKit::WebBackForwardList::createCFDictionaryRepresentation):
+ * UIProcess/cf/WebPageProxyCF.cpp:
+ (WebKit::WebPageProxy::sessionStateData):
+ (WebKit::WebPageProxy::restoreFromSessionStateData):
+ (WebKit::WebPageProxy::saveRecentSearches):
+ (WebKit::WebPageProxy::loadRecentSearches):
+ * UIProcess/cf/WebPreferencesCF.cpp:
+ (WebKit::cfStringFromWebCoreString):
+ (WebKit::setStringValueIfInUserDefaults):
+ (WebKit::setBoolValueIfInUserDefaults):
+ (WebKit::setUInt32ValueIfInUserDefaults):
+ (WebKit::setDoubleValueIfInUserDefaults):
+ (WebKit::WebPreferences::platformUpdateUInt32ValueForKey):
+ (WebKit::WebPreferences::platformUpdateDoubleValueForKey):
+ (WebKit::WebPreferences::platformUpdateFloatValueForKey):
+ * UIProcess/mac/BackingStoreMac.mm:
+ (WebKit::BackingStore::resetScrolledRect):
+ (WebKit::BackingStore::backingStoreContext):
+ * UIProcess/mac/CorrectionPanel.mm:
+ (WebKit::CorrectionPanel::handleAcceptedReplacement):
+ * UIProcess/mac/TextCheckerMac.mm:
+ (WebKit::TextChecker::checkTextOfParagraph):
+ (WebKit::TextChecker::updateSpellingUIWithGrammarString):
+ * UIProcess/mac/WKFullScreenWindowController.mm:
+ (-[WKFullScreenWindowController enterFullScreen:]):
+ (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
+ (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
+ * UIProcess/mac/WebContextMac.mm:
+ (WebKit::WebContext::platformDefaultDiskCacheDirectory):
+ * UIProcess/mac/WebContextMenuProxyMac.mm:
+ (WebKit::nsMenuItemVector):
+ (WebKit::WebContextMenuProxyMac::populate):
+ * UIProcess/mac/WebInspectorProxyMac.mm:
+ (WebKit::WebInspectorProxy::createInspectorWindow):
+ (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+ * UIProcess/mac/WebPopupMenuProxyMac.mm:
+ (WebKit::WebPopupMenuProxyMac::populate):
+ (WebKit::WebPopupMenuProxyMac::showPopupMenu):
+ * WebProcess/InjectedBundle/mac/InjectedBundleMac.mm:
+ (WebKit::InjectedBundle::load):
+ * WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm:
+ (WebKit::NetscapePlugin::updatePluginLayer):
+ * WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm:
+ (WebKit::PluginProxy::pluginLayer):
+ * WebProcess/Plugins/PDF/PDFPlugin.mm:
+ (WebKit::PDFPlugin::PDFPlugin):
+ (WebKit::PDFPlugin::createScrollbar):
+ (WebKit::PDFPlugin::pdfDocumentDidLoad):
+ (WebKit::PDFPlugin::writeItemsToPasteboard):
+ * WebProcess/Plugins/PDF/SimplePDFPlugin.mm:
+ (getAllScriptsInPDFDocument):
+ (WebKit::SimplePDFPlugin::pdfDocumentDidLoad):
+ (WebKit::SimplePDFPlugin::streamDidReceiveData):
+ (WebKit::SimplePDFPlugin::manualStreamDidReceiveData):
+ * WebProcess/ResourceCache/WebResourceCacheManager.cpp:
+ (WebKit::WebResourceCacheManager::clearCacheForOrigin):
+ * WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp:
+ (WebKit::WebResourceCacheManager::cfURLCacheHostNames):
+ (WebKit::WebResourceCacheManager::clearCFURLCacheForHostNames):
+ * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:
+ (WebKit::createNSError):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::drawPagesToPDF):
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::performDictionaryLookupForRange):
+ (WebKit::cachedResponseForURL):
+ (WebKit::WebPage::drawPagesToPDFFromPDFDocument):
+ * WebProcess/mac/WebProcessMac.mm:
+ (WebKit::WebProcess::platformSetCacheModel):
+ Use adoptCF and adoptNS free functions.
+
2013-04-27 Alexey Proskuryakov <ap@apple.com>
<rdar://problem/13757007> Crashes in NetworkResourceLoader::didReceiveResponseAsync
void paintBitmapContext(CGContextRef context, CGContextRef bitmapContext, CGFloat scaleFactor, CGPoint destination, CGRect source)
{
- RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(bitmapContext));
+ RetainPtr<CGImageRef> image = adoptCF(CGBitmapContextCreateImage(bitmapContext));
paintImage(context, image.get(), scaleFactor, destination, source);
}
if (!CFBundleLoadExecutable(bundle.get()))
return false;
- m_bundle.adoptCF(bundle.leakRef());
+ m_bundle = adoptCF(bundle.leakRef());
return true;
}
{
if (!m_bundle)
return 0;
- RetainPtr<CFStringRef> functionNameString(AdoptCF, CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, functionName, kCFStringEncodingASCII, kCFAllocatorNull));
+ RetainPtr<CFStringRef> functionNameString = adoptCF(CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, functionName, kCFStringEncodingASCII, kCFAllocatorNull));
return CFBundleGetFunctionPointerForName(m_bundle.get(), functionNameString.get());
}
sandboxParameters.addPathParameter("PLUGIN_PATH", m_pluginPath);
- RetainPtr<CFStringRef> cachePath(AdoptCF, WKCopyFoundationCacheDirectory());
+ RetainPtr<CFStringRef> cachePath = adoptCF(WKCopyFoundationCacheDirectory());
sandboxParameters.addPathParameter("NSURL_CACHE_DIR", (NSString *)cachePath.get());
RetainPtr<NSDictionary> defaults = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"NSUseRemoteSavePanel", nil]);
WKURLRequestRef WKURLRequestCreateWithNSURLRequest(NSURLRequest* urlRequest)
{
- RetainPtr<NSURLRequest> copiedURLRequest(AdoptNS, [urlRequest copy]);
+ RetainPtr<NSURLRequest> copiedURLRequest = adoptNS([urlRequest copy]);
RefPtr<WebURLRequest> request = WebURLRequest::create(copiedURLRequest.get());
return toAPI(request.release().leakRef());
}
WKURLResponseRef WKURLResponseCreateWithNSURLResponse(NSURLResponse* urlResponse)
{
- RetainPtr<NSURLResponse> copiedURLResponse(AdoptNS, [urlResponse copy]);
+ RetainPtr<NSURLResponse> copiedURLResponse = adoptNS([urlResponse copy]);
RefPtr<WebURLResponse> response = WebURLResponse::create(copiedURLResponse.get());
return toAPI(response.release().leakRef());
}
ASSERT(!m_nsURLDownload);
ASSERT(!m_delegate);
- m_delegate.adoptNS([[WKDownloadAsDelegate alloc] initWithDownload:this]);
- m_nsURLDownload.adoptNS([[NSURLDownload alloc] initWithRequest:m_request.nsURLRequest(UpdateHTTPBody) delegate:m_delegate.get()]);
+ m_delegate = adoptNS([[WKDownloadAsDelegate alloc] initWithDownload:this]);
+ m_nsURLDownload = adoptNS([[NSURLDownload alloc] initWithRequest:m_request.nsURLRequest(UpdateHTTPBody) delegate:m_delegate.get()]);
// FIXME: Allow this to be changed by the client.
[m_nsURLDownload.get() setDeletesFileUponFailure:NO];
ASSERT(!m_nsURLDownload);
ASSERT(!m_delegate);
- m_delegate.adoptNS([[WKDownloadAsDelegate alloc] initWithDownload:this]);
+ m_delegate = adoptNS([[WKDownloadAsDelegate alloc] initWithDownload:this]);
m_nsURLDownload = [NSURLDownload _downloadWithLoadingConnection:handle->connection()
request:m_request.nsURLRequest(UpdateHTTPBody)
response:response.nsURLResponse()