Move from constructor and member function adoptCF/NS to free function adoptCF/NS.
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Apr 2013 03:51:20 +0000 (03:51 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Apr 2013 03:51:20 +0000 (03:51 +0000)
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

171 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/HeapTimer.cpp
Source/JavaScriptCore/runtime/VM.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/RunLoopTimerCF.cpp
Source/WTF/wtf/SchedulePair.h
Source/WTF/wtf/SchedulePairMac.mm
Source/WTF/wtf/unicode/icu/CollatorICU.cpp
Source/WebCore/ChangeLog
Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm
Source/WebCore/accessibility/mac/AXObjectCacheMac.mm
Source/WebCore/bridge/objc/objc_class.mm
Source/WebCore/bridge/objc/objc_runtime.mm
Source/WebCore/editing/mac/EditorMac.mm
Source/WebCore/history/cf/HistoryPropertyList.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp
Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm
Source/WebCore/loader/mac/ResourceLoaderMac.mm
Source/WebCore/page/CaptionUserPreferencesMac.mm
Source/WebCore/platform/Language.cpp
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/MIMETypeRegistry.cpp
Source/WebCore/platform/audio/mac/AudioFileReaderMac.cpp
Source/WebCore/platform/cf/KURLCFNet.cpp
Source/WebCore/platform/cf/SharedBufferCF.cpp
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/mac/LayerFlushSchedulerMac.cpp
Source/WebCore/platform/graphics/ca/mac/PlatformCAAnimationMac.mm
Source/WebCore/platform/graphics/ca/mac/PlatformCAFiltersMac.mm
Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp
Source/WebCore/platform/graphics/cg/ColorCG.cpp
Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp
Source/WebCore/platform/graphics/cg/ImageCG.cpp
Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp
Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp
Source/WebCore/platform/graphics/cg/PathCG.cpp
Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm
Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp
Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm
Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm
Source/WebCore/platform/graphics/mac/ImageMac.mm
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp
Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm
Source/WebCore/platform/graphics/mac/WebGLLayer.mm
Source/WebCore/platform/mac/ContentFilterMac.mm
Source/WebCore/platform/mac/ContextMenuItemMac.mm
Source/WebCore/platform/mac/CursorMac.mm
Source/WebCore/platform/mac/DisplaySleepDisabler.cpp
Source/WebCore/platform/mac/DragImageMac.mm
Source/WebCore/platform/mac/HTMLConverter.mm
Source/WebCore/platform/mac/Language.mm
Source/WebCore/platform/mac/LocalizedStringsMac.cpp
Source/WebCore/platform/mac/PasteboardMac.mm
Source/WebCore/platform/mac/PlatformClockCM.mm
Source/WebCore/platform/mac/PlatformPasteboardMac.mm
Source/WebCore/platform/mac/PlatformSpeechSynthesizerMac.mm
Source/WebCore/platform/mac/PopupMenuMac.mm
Source/WebCore/platform/mac/ScrollAnimatorMac.mm
Source/WebCore/platform/mac/SharedBufferMac.mm
Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
Source/WebCore/platform/network/ProtectionSpace.cpp
Source/WebCore/platform/network/SynchronousLoaderClient.cpp
Source/WebCore/platform/network/cf/CredentialStorageCFNet.cpp
Source/WebCore/platform/network/cf/DNSCFNet.cpp
Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp
Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp
Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp
Source/WebCore/platform/network/cf/ResourceErrorCF.cpp
Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp
Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp
Source/WebCore/platform/network/mac/AuthenticationMac.mm
Source/WebCore/platform/network/mac/CookieJarMac.mm
Source/WebCore/platform/network/mac/NetworkStateNotifierMac.cpp
Source/WebCore/platform/network/mac/ResourceErrorMac.mm
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebCore/platform/network/mac/ResourceRequestMac.mm
Source/WebCore/platform/network/mac/ResourceResponseMac.mm
Source/WebCore/platform/network/mac/UTIUtilities.mm
Source/WebCore/platform/network/mac/WebCoreURLResponse.mm
Source/WebCore/platform/text/cf/HyphenationCF.cpp
Source/WebCore/platform/text/mac/HyphenationMac.mm
Source/WebCore/platform/text/mac/LocaleMac.mm
Source/WebCore/platform/text/mac/TextBreakIteratorInternalICUMac.mm
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebKit/cf/ChangeLog
Source/WebKit/cf/WebCoreSupport/WebInspectorClientCF.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm
Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm
Source/WebKit/mac/Plugins/Hosted/HostedNetscapePluginStream.mm
Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm
Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm
Source/WebKit/mac/Plugins/WebBasePluginPackage.mm
Source/WebKit/mac/Plugins/WebNetscapePluginEventHandlerCarbon.mm
Source/WebKit/mac/Plugins/WebNetscapePluginEventHandlerCocoa.mm
Source/WebKit/mac/Plugins/WebNetscapePluginPackage.mm
Source/WebKit/mac/Plugins/WebNetscapePluginStream.mm
Source/WebKit/mac/Plugins/WebNetscapePluginView.mm
Source/WebKit/mac/Storage/WebDatabaseManagerClient.mm
Source/WebKit/mac/Storage/WebStorageTrackerClient.mm
Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm
Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKit/mac/WebView/WebFullScreenController.mm
Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebScriptDebugger.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/cg/CGUtilities.cpp
Source/WebKit2/Platform/mac/ModuleMac.mm
Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm
Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm
Source/WebKit2/Shared/API/c/mac/WKURLResponseNS.mm
Source/WebKit2/Shared/Downloads/mac/DownloadMac.mm
Source/WebKit2/Shared/EntryPointUtilities/mac/LegacyProcess/ChildProcessEntryPoint.h
Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
Source/WebKit2/Shared/ShareableResource.cpp
Source/WebKit2/Shared/cf/ArgumentCodersCF.cpp
Source/WebKit2/Shared/cg/ShareableBitmapCG.cpp
Source/WebKit2/Shared/mac/ArgumentCodersMac.mm
Source/WebKit2/Shared/mac/PlatformCertificateInfo.mm
Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm
Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
Source/WebKit2/UIProcess/API/mac/WKConnection.mm
Source/WebKit2/UIProcess/API/mac/WKPrintingView.mm
Source/WebKit2/UIProcess/API/mac/WKView.mm
Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm
Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp
Source/WebKit2/UIProcess/cf/WebPageProxyCF.cpp
Source/WebKit2/UIProcess/cf/WebPreferencesCF.cpp
Source/WebKit2/UIProcess/mac/BackingStoreMac.mm
Source/WebKit2/UIProcess/mac/CorrectionPanel.mm
Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm
Source/WebKit2/UIProcess/mac/WebContextMac.mm
Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
Source/WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.mm
Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapePluginMac.mm
Source/WebKit2/WebProcess/Plugins/Netscape/mac/PluginProxyMac.mm
Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm
Source/WebKit2/WebProcess/Plugins/PDF/SimplePDFPlugin.mm
Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp
Source/WebKit2/WebProcess/ResourceCache/cf/WebResourceCacheManagerCFNet.cpp
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
Source/WebKit2/WebProcess/mac/WebProcessMac.mm

index 17769c7..0a7ea8e 100644 (file)
@@ -1,3 +1,16 @@
+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.
index d3676ba..580c45b 100644 (file)
@@ -65,7 +65,7 @@ HeapTimer::HeapTimer(VM* vm, CFRunLoopRef runLoop)
     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);
 }
 
index b352063..dc08cee 100644 (file)
@@ -114,12 +114,12 @@ static bool enableAssembler(ExecutableAllocator& executableAllocator)
 #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
index db0cee5..c0866cd 100644 (file)
@@ -1,3 +1,20 @@
+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
index 65785a2..40b620f 100644 (file)
@@ -57,7 +57,7 @@ void RunLoopTimerBase::start(double nextFireInterval, double repeatInterval)
     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)
index afee475..fe1e18c 100644 (file)
@@ -60,7 +60,7 @@ private:
         : m_runLoop(runLoop)
     {
         if (mode)
-            m_mode.adoptCF(CFStringCreateCopy(0, mode));
+            m_mode = adoptCF(CFStringCreateCopy(0, mode));
     }
 
 #if PLATFORM(MAC) && !USE(CFNETWORK)
index a41954f..dc58aa0 100644 (file)
@@ -38,7 +38,7 @@ SchedulePair::SchedulePair(NSRunLoop* runLoop, CFStringRef mode)
     , m_runLoop([runLoop getCFRunLoop])
 {
     if (mode)
-        m_mode.adoptCF(CFStringCreateCopy(0, mode));
+        m_mode = adoptCF(CFStringCreateCopy(0, mode));
 }
 
 } // namespace
index fa1ab28..c74f148 100644 (file)
@@ -63,10 +63,10 @@ PassOwnPtr<Collator> Collator::userDefault()
 #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];
index 1a6ee5f..65a46c0 100644 (file)
@@ -1,3 +1,305 @@
+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
index a24dba6..479a2ca 100644 (file)
@@ -45,7 +45,7 @@ void AXObjectCache::detachWrapper(AccessibilityObject* obj)
 
 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());
 }
 
index bd96284..5887083 100644 (file)
@@ -51,7 +51,7 @@ void AXObjectCache::detachWrapper(AccessibilityObject* obj)
 
 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());
 }
 
index b92190b..5bacf7a 100644 (file)
@@ -107,7 +107,7 @@ Method* ObjcClass::methodNamed(PropertyName propertyName, Instance*) const
     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;
@@ -159,7 +159,7 @@ Field* ObjcClass::fieldNamed(PropertyName propertyName, Instance* instance) cons
     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) {
index 6258210..0b93687 100644 (file)
@@ -76,7 +76,7 @@ NSMethodSignature* ObjcMethod::getMethodSignature() const
 
 ObjcField::ObjcField(Ivar ivar) 
     : _ivar(ivar)
-    , _name(AdoptCF, CFStringCreateWithCString(0, ivar_getName(_ivar), kCFStringEncodingASCII))
+    , _name(adoptCF(CFStringCreateWithCString(0, ivar_getName(_ivar), kCFStringEncodingASCII)))
 {
 }
 
index 1d650b9..4c0c280 100644 (file)
@@ -205,7 +205,7 @@ NSDictionary* Editor::fontAttributesForSelectionStart() const
 
     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())];
index fd28237..68d5b7d 100644 (file)
@@ -62,7 +62,7 @@ RetainPtr<CFDataRef> HistoryPropertyListWriter::releaseData()
     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;
index 507c60e..d6d58d9 100644 (file)
@@ -968,7 +968,7 @@ static KURL createFileURLForApplicationCacheResource(const String& path)
     // 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;
index ac44cd9..3c369bb 100644 (file)
@@ -70,22 +70,22 @@ RetainPtr<CFDictionaryRef> LegacyWebArchive::createPropertyListRepresentation(Ar
         // 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
@@ -122,7 +122,7 @@ RetainPtr<CFDictionaryRef> LegacyWebArchive::createPropertyListRepresentation(Ar
 
 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);
@@ -130,7 +130,7 @@ RetainPtr<CFDictionaryRef> LegacyWebArchive::createPropertyListRepresentation(Ar
         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);
@@ -142,7 +142,7 @@ RetainPtr<CFDictionaryRef> LegacyWebArchive::createPropertyListRepresentation(Ar
     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());
@@ -268,13 +268,13 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(const KURL&, SharedBuffer*
     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";
@@ -385,12 +385,12 @@ RetainPtr<CFDataRef> LegacyWebArchive::rawDataRepresentation()
         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());
index 6a35753..ae4991c 100644 (file)
@@ -70,7 +70,7 @@ RetainPtr<CFDataRef> LegacyWebArchive::createPropertyListRepresentation(const Re
     [archiver finishEncoding];
     [archiver release];
     
-    return RetainPtr<CFDataRef>(AdoptCF, responseData);
+    return adoptCF(responseData);
 }
 
 }
index 2c33b08..5f60345 100644 (file)
@@ -53,7 +53,7 @@ CFCachedURLResponseRef ResourceLoader::willCacheResponse(ResourceHandle*, CFCach
     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];
 }
 
index 47769db..0676eba 100644 (file)
@@ -172,7 +172,7 @@ bool CaptionUserPreferencesMac::userPrefersCaptions() const
     if (captionSetting || testingMode() || !MediaAccessibilityLibrary())
         return captionSetting;
     
-    RetainPtr<CFArrayRef> captioningMediaCharacteristics(AdoptCF, MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(kMACaptionAppearanceDomainUser));
+    RetainPtr<CFArrayRef> captioningMediaCharacteristics = adoptCF(MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(kMACaptionAppearanceDomainUser));
     return captioningMediaCharacteristics && CFArrayGetCount(captioningMediaCharacteristics.get());
 }
 
@@ -182,7 +182,7 @@ bool CaptionUserPreferencesMac::userPrefersSubtitles() const
     if (subtitlesSetting || testingMode() || !MediaAccessibilityLibrary())
         return subtitlesSetting;
     
-    RetainPtr<CFArrayRef> captioningMediaCharacteristics(AdoptCF, MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(kMACaptionAppearanceDomainUser));
+    RetainPtr<CFArrayRef> captioningMediaCharacteristics = adoptCF(MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(kMACaptionAppearanceDomainUser));
     return !(captioningMediaCharacteristics && CFArrayGetCount(captioningMediaCharacteristics.get()));
 }
 
@@ -213,7 +213,7 @@ void CaptionUserPreferencesMac::captionPreferencesChanged()
 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())
@@ -244,7 +244,7 @@ String CaptionUserPreferencesMac::captionsBackgroundCSS() const
 
     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;
@@ -272,7 +272,7 @@ String CaptionUserPreferencesMac::captionsBackgroundCSS() const
 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.
@@ -395,11 +395,11 @@ String CaptionUserPreferencesMac::captionsDefaultFontCSS() const
 {
     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();
     
@@ -463,7 +463,7 @@ Vector<String> CaptionUserPreferencesMac::preferredLanguages() const
     }
 
     CFIndex languageCount = 0;
-    RetainPtr<CFArrayRef> languages(AdoptCF, MACaptionAppearanceCopySelectedLanguages(kMACaptionAppearanceDomainUser));
+    RetainPtr<CFArrayRef> languages = adoptCF(MACaptionAppearanceCopySelectedLanguages(kMACaptionAppearanceDomainUser));
     if (languages)
         languageCount = CFArrayGetCount(languages.get());
 
@@ -561,22 +561,22 @@ static String trackDisplayName(TextTrack* track)
     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();
                 }
                 
index 637aab9..fcd3125 100644 (file)
@@ -149,7 +149,7 @@ String displayNameForLanguageLocale(const String& localeName)
 {
 #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
index d8a6f36..13f139d 100644 (file)
@@ -245,7 +245,7 @@ String contextMenuItemTagSearchInSpotlight()
 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");
@@ -788,15 +788,15 @@ String imageTitle(const String& filename, const IntSize& size)
 {
 #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
index 817290a..3833492 100644 (file)
@@ -194,10 +194,10 @@ typedef HashMap<String, Vector<String>*, CaseFoldingHash> MediaMIMETypeMap;
 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);
@@ -281,10 +281,10 @@ static void initializeSupportedImageMIMETypesForEncoding()
 
 #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);
index 0572cc4..ec81f2c 100644 (file)
@@ -63,8 +63,8 @@ AudioFileReader::AudioFileReader(const char* filePath)
     , 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;
 
index d4ede0b..3cb4fbf 100644 (file)
@@ -79,7 +79,7 @@ CFURLRef KURL::createCFURL() const
 #if !(PLATFORM(QT) && USE(QTKIT))
 String KURL::fileSystemPath() const
 {
-    RetainPtr<CFURLRef> cfURL(AdoptCF, createCFURL());
+    RetainPtr<CFURLRef> cfURL = adoptCF(createCFURL());
     if (!cfURL)
         return String();
 
@@ -88,7 +88,7 @@ String KURL::fileSystemPath() const
 #else
     CFURLPathStyle pathStyle = kCFURLPOSIXPathStyle;
 #endif
-    return RetainPtr<CFStringRef>(AdoptCF, CFURLCopyFileSystemPath(cfURL.get(), pathStyle)).get();
+    return adoptCF(CFURLCopyFileSystemPath(cfURL.get(), pathStyle)).get();
 }
 #endif
 
index bc5df50..6e12eeb 100644 (file)
@@ -83,7 +83,7 @@ void SharedBuffer::maybeTransferPlatformData()
     
     // 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()));
 }
index e8695fb..5a91f70 100644 (file)
@@ -228,11 +228,11 @@ void MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(MediaEngineRegistra
 
 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)
@@ -364,7 +364,7 @@ void MediaPlayerPrivateAVFoundationObjC::createVideoLayer()
         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"];
@@ -399,12 +399,12 @@ void MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(const String& url)
 
     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())
@@ -419,7 +419,7 @@ void MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(const String& url)
 #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()];
@@ -439,7 +439,7 @@ void MediaPlayerPrivateAVFoundationObjC::createAVPlayer()
 
     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)
@@ -462,7 +462,7 @@ void MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem()
     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()];
 
@@ -1089,7 +1089,7 @@ void MediaPlayerPrivateAVFoundationObjC::createVideoOutput()
     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()];
@@ -1164,7 +1164,7 @@ void MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput(GraphicsContext* c
         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.
index a0f4ac9..f46fdd5 100644 (file)
@@ -789,7 +789,7 @@ void GraphicsLayerCA::setContentsToImage(Image* image)
             // 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;
index 221cd17..1462d5e 100644 (file)
@@ -77,7 +77,7 @@ void LayerFlushScheduler::schedule()
         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);
 }
index b0920f2..3737350 100644 (file)
@@ -162,9 +162,9 @@ PlatformCAAnimation::PlatformCAAnimation(AnimationType type, const String& keyPa
     : 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)
index ca5eb04..b01e794 100644 (file)
@@ -102,7 +102,7 @@ void PlatformCAFilters::setFiltersOnLayer(PlatformCALayer* platformCALayer, cons
     
     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);
@@ -116,8 +116,8 @@ void PlatformCAFilters::setFiltersOnLayer(PlatformCALayer* platformCALayer, cons
 
             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];
@@ -348,7 +348,7 @@ RetainPtr<NSValue> PlatformCAFilters::filterValueForOperation(const FilterOperat
             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: {
@@ -376,7 +376,7 @@ RetainPtr<NSValue> PlatformCAFilters::filterValueForOperation(const FilterOperat
                                                       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;
     }
@@ -389,7 +389,7 @@ RetainPtr<NSValue> PlatformCAFilters::filterValueForOperation(const FilterOperat
             amount = op->amount();
         }
         
-        value.adoptNS([[NSNumber numberWithDouble:amount] retain]);
+        value = adoptNS([[NSNumber numberWithDouble:amount] retain]);
         break;
     }
     case FilterOperation::HUE_ROTATE: {
@@ -401,7 +401,7 @@ RetainPtr<NSValue> PlatformCAFilters::filterValueForOperation(const FilterOperat
             amount = op->amount();
         }
         amount = deg2rad(amount);
-        value.adoptNS([[NSNumber numberWithDouble:amount] retain]);
+        value = adoptNS([[NSNumber numberWithDouble:amount] retain]);
         break;
     }
     case FilterOperation::INVERT: {
@@ -429,7 +429,7 @@ RetainPtr<NSValue> PlatformCAFilters::filterValueForOperation(const FilterOperat
         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;
     }
@@ -446,7 +446,7 @@ RetainPtr<NSValue> PlatformCAFilters::filterValueForOperation(const FilterOperat
             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;
     }
@@ -470,7 +470,7 @@ RetainPtr<NSValue> PlatformCAFilters::filterValueForOperation(const FilterOperat
         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;
     }
@@ -488,7 +488,7 @@ RetainPtr<NSValue> PlatformCAFilters::filterValueForOperation(const FilterOperat
             amount = op->amount();
         }
 
-        value.adoptNS([[NSNumber numberWithDouble:amount] retain]);
+        value = adoptNS([[NSNumber numberWithDouble:amount] retain]);
 #endif
         break;
     }
@@ -502,7 +502,7 @@ RetainPtr<NSValue> PlatformCAFilters::filterValueForOperation(const FilterOperat
             amount = floatValueForLength(op->stdDeviation(), 0);
         }
         
-        value.adoptNS([[NSNumber numberWithDouble:amount] retain]);
+        value = adoptNS([[NSNumber numberWithDouble:amount] retain]);
         break;
     }
     default:
index fb478a7..36d7379 100644 (file)
@@ -214,7 +214,7 @@ PlatformCALayer::PlatformCALayer(LayerType layerType, PlatformLayer* layer, Plat
         }
 
         if (layerClass)
-            m_layer.adoptNS([[layerClass alloc] init]);
+            m_layer = adoptNS([[layerClass alloc] init]);
     }
     
     // Save a pointer to 'this' in the CALayer
@@ -434,7 +434,7 @@ void PlatformCALayer::addAnimationForKey(const String& key, PlatformCAAnimation*
     // Add the delegate
     if (!m_delegate) {
         WebAnimationDelegate* webAnimationDelegate = [[WebAnimationDelegate alloc] init];
-        m_delegate.adoptNS(webAnimationDelegate);
+        m_delegate = adoptNS(webAnimationDelegate);
         [webAnimationDelegate setOwner:this];
     }
     
@@ -680,8 +680,8 @@ void PlatformCALayer::setBackgroundColor(const Color& value)
     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()];
@@ -710,8 +710,8 @@ void PlatformCALayer::setBorderColor(const Color& value)
     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()];
index 51c0cf8..cd037a9 100644 (file)
@@ -114,7 +114,7 @@ void BitmapImage::checkForSolidColor()
     // 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;
@@ -158,7 +158,7 @@ RetainPtr<CFArrayRef> BitmapImage::getCGImageArray()
         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)
index 55a3017..d74b4b4 100644 (file)
@@ -123,7 +123,7 @@ template<ColorSpace colorSpace> static CGColorRef cachedCGColor(const Color& col
 
     static size_t cursor;
     cachedRGBAValues[cursor] = color.rgb();
-    cachedCGColors[cursor].adoptCF(newCGColor);
+    cachedCGColors[cursor] = adoptCF(newCGColor);
     if (++cursor == cacheSize)
         cursor = 0;
 
index 8a485ee..7bb42ef 100644 (file)
@@ -328,7 +328,7 @@ bool GraphicsContext3D::ImageExtractor::extractImage(bool premultiplyAlpha, bool
         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();
@@ -352,7 +352,7 @@ bool GraphicsContext3D::ImageExtractor::extractImage(bool premultiplyAlpha, bool
         // 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)
@@ -363,7 +363,7 @@ bool GraphicsContext3D::ImageExtractor::extractImage(bool premultiplyAlpha, bool
         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();
     }
 
@@ -457,7 +457,7 @@ bool GraphicsContext3D::ImageExtractor::extractImage(bool premultiplyAlpha, bool
     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;
 
index a75a573..7c20f47 100644 (file)
@@ -558,11 +558,11 @@ void GraphicsContext::applyStrokePattern()
     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;
@@ -574,11 +574,11 @@ void GraphicsContext::applyFillPattern()
     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;
@@ -1393,7 +1393,7 @@ void GraphicsContext::setURLForRect(const KURL& link, const IntRect& destRect)
     if (paintingDisabled())
         return;
 
-    RetainPtr<CFURLRef> urlRef(AdoptCF, link.createCFURL());
+    RetainPtr<CFURLRef> urlRef = adoptCF(link.createCFURL());
     if (!urlRef)
         return;
 
index 30d44f6..ad89614 100644 (file)
@@ -93,11 +93,11 @@ static RetainPtr<IOSurfaceRef> createIOSurface(const IntSize& size)
     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
 
@@ -157,7 +157,7 @@ ImageBuffer::ImageBuffer(const IntSize& size, float resolutionScale, ColorSpace
     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.
@@ -169,9 +169,9 @@ ImageBuffer::ImageBuffer(const IntSize& size, float resolutionScale, ColorSpace
         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)
@@ -217,8 +217,8 @@ PassRefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, ScaleBeh
     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());
@@ -270,9 +270,9 @@ void ImageBuffer::draw(GraphicsContext* destContext, ColorSpace styleColorSpace,
 
     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);
@@ -302,7 +302,7 @@ void ImageBuffer::clip(GraphicsContext* contextToClip, const FloatRect& rect) co
 {
     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());
@@ -364,7 +364,7 @@ void ImageBuffer::putByteArray(Multiply multiplied, Uint8ClampedArray* source, c
     // 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
@@ -407,17 +407,17 @@ static bool CGImageEncodeToData(CGImageRef image, CFStringRef uti, const double*
     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
@@ -432,7 +432,7 @@ static String CGImageToDataURL(CGImageRef image, const String& mimeType, const d
     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:,";
 
@@ -459,21 +459,21 @@ String ImageBuffer::toDataURL(const String& mimeType, const double* quality, Coo
             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);
@@ -515,12 +515,12 @@ String ImageDataToDataURL(const ImageData& source, const String& mimeType, const
     }
 
     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));
 
index 649d9b7..35dc2b8 100644 (file)
@@ -202,9 +202,9 @@ PassRefPtr<Uint8ClampedArray> ImageBufferData::getData(const IntRect& rect, cons
         }
 #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)
@@ -291,9 +291,9 @@ PassRefPtr<Uint8ClampedArray> ImageBufferData::getData(const IntRect& rect, cons
         }
 #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.
 
@@ -425,9 +425,9 @@ void ImageBufferData::putData(Uint8ClampedArray*& source, const IntSize& sourceS
         }
 #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)
@@ -504,9 +504,9 @@ void ImageBufferData::putData(Uint8ClampedArray*& source, const IntSize& sourceS
         }
 #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.
 
index 8a12368..a535737 100644 (file)
@@ -58,9 +58,9 @@ RetainPtr<CGImageRef> Image::imageWithColorSpace(CGImageRef originalImage, Color
     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();
@@ -107,7 +107,7 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
         // 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.
@@ -129,16 +129,16 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
     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).
index 9fa82e2..2f5f102 100644 (file)
@@ -134,7 +134,7 @@ void ImageSource::setData(SharedBuffer* data, bool allDataReceived)
         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) {
@@ -153,7 +153,7 @@ void ImageSource::setData(SharedBuffer* data, bool allDataReceived)
     // 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
 }
@@ -173,7 +173,7 @@ bool ImageSource::isSizeAvailable()
 
     // 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);
@@ -198,7 +198,7 @@ static ImageOrientation orientationFromProperties(CFDictionaryRef imagePropertie
 
 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();
@@ -219,7 +219,7 @@ IntSize ImageSource::frameSizeAtIndex(size_t index, RespectImageOrientationEnum
 
 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;
 
@@ -233,7 +233,7 @@ IntSize ImageSource::size(RespectImageOrientationEnum shouldRespectOrientation)
 
 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;
 
@@ -270,7 +270,7 @@ int ImageSource::repetitionCount()
     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) {
@@ -298,7 +298,7 @@ CGImageRef ImageSource::createFrameAtIndex(size_t index)
     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))
@@ -306,7 +306,7 @@ CGImageRef ImageSource::createFrameAtIndex(size_t index)
     
     // 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();
 
@@ -339,7 +339,7 @@ float ImageSource::frameDurationAtIndex(size_t index)
         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) {
index 4082cc4..ecd73ef 100644 (file)
@@ -89,15 +89,15 @@ bool PDFDocumentImage::dataChanged(bool allDataReceived)
 #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);
index 1751a0a..57304e9 100644 (file)
@@ -57,7 +57,7 @@ static size_t putBytesNowhere(void*, const void*, size_t count)
 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 };
@@ -148,7 +148,7 @@ bool Path::contains(const FloatPoint &point, WindRule rule) const
         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;
 }
index f8d82d2..fab3025 100644 (file)
@@ -70,7 +70,7 @@ FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool isPrinterFon
     if (m_font)
         CFRetain(m_font);
 
-    m_cgFont.adoptCF(cgFont);
+    m_cgFont = adoptCF(cgFont);
 }
 
 FontPlatformData:: ~FontPlatformData()
@@ -126,7 +126,7 @@ void FontPlatformData::setFont(NSFont *font)
     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));
@@ -171,8 +171,8 @@ inline int mapFontWidthVariantToCTFeatureSelector(FontWidthVariant variant)
 
 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() };
@@ -189,7 +189,7 @@ static CTFontDescriptorRef cascadeToLastResortFontDescriptor()
     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());
 
@@ -202,15 +202,15 @@ static CTFontDescriptorRef cascadeToLastResortAndDisableSwashesFontDescriptor()
     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());
 
@@ -225,24 +225,24 @@ CTFontRef FontPlatformData::ctFont() const
     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;
@@ -254,7 +254,7 @@ CTFontRef FontPlatformData::ctFont() const
 #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" : "");
 }
index 5837e3a..76c8227 100644 (file)
@@ -70,7 +70,7 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context,
         
     // 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    
index fee056d..c588a47 100644 (file)
@@ -79,7 +79,7 @@
 
     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;
 }
 
@@ -196,14 +196,14 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp,
         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());
@@ -221,18 +221,18 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp,
 
 #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());
@@ -252,11 +252,11 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp,
             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;
@@ -266,7 +266,7 @@ void ComplexTextController::collectComplexTextRunsForCharacters(const UChar* cp,
                     // 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;
index 85388d7..be480aa 100644 (file)
@@ -63,8 +63,8 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
 
     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)
index 45a6691..8fe2f13 100644 (file)
@@ -81,9 +81,9 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b
         }
     } 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);
@@ -98,7 +98,7 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b
 
         // 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.
@@ -108,7 +108,7 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b
 
             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()) {
index 7b5942f..c9b6b36 100644 (file)
@@ -166,7 +166,7 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi
 
     // 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    
index 4da16d5..26b5f7c 100644 (file)
@@ -74,7 +74,7 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int
     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));
@@ -187,7 +187,7 @@ CGColorSpaceRef linearRGBColorSpaceRef()
         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());
index 091f2da..251f574 100644 (file)
@@ -88,8 +88,8 @@ CFDataRef BitmapImage::getTIFFRepresentation()
 
     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;
@@ -112,7 +112,7 @@ NSImage* BitmapImage::getNSImage()
     if (!data)
         return 0;
     
-    m_nsImage.adoptNS([[NSImage alloc] initWithData:(NSData*)data]);
+    m_nsImage = adoptNS([[NSImage alloc] initWithData:(NSData*)data]);
     return m_nsImage.get();
 }
 
index 83792c0..45cf162 100644 (file)
@@ -199,7 +199,7 @@ void MediaPlayerPrivateQTKit::registerMediaEngine(MediaEngineRegistrar registrar
 
 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)
@@ -353,7 +353,7 @@ void MediaPlayerPrivateQTKit::createQTMovie(NSURL *url, NSDictionary *movieAttri
         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;
@@ -444,7 +444,7 @@ void MediaPlayerPrivateQTKit::createQTMovieView()
     // 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)
@@ -484,7 +484,7 @@ void MediaPlayerPrivateQTKit::createQTVideoRenderer(QTVideoRendererMode renderer
     LOG(Media, "MediaPlayerPrivateQTKit::createQTVideoRenderer(%p)", this);
     destroyQTVideoRenderer();
 
-    m_qtVideoRenderer.adoptNS([[QTVideoRendererClass() alloc] init]);
+    m_qtVideoRenderer = adoptNS([[QTVideoRendererClass() alloc] init]);
     if (!m_qtVideoRenderer)
         return;
     
@@ -527,7 +527,7 @@ void MediaPlayerPrivateQTKit::createQTMovieLayer()
     ASSERT(supportsAcceleratedRendering());
     
     if (!m_qtVideoLayer) {
-        m_qtVideoLayer.adoptNS([[QTMovieLayer alloc] init]);
+        m_qtVideoLayer = adoptNS([[QTMovieLayer alloc] init]);
         if (!m_qtVideoLayer)
             return;
 
@@ -927,7 +927,7 @@ void MediaPlayerPrivateQTKit::setPreservesPitch(bool preservesPitch)
     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();
@@ -1449,10 +1449,10 @@ static void addFileTypesToCache(NSArray * fileTypes, HashSet<String> &cache)
     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());
 
index 6c2c117..9aaf825 100644 (file)
@@ -39,7 +39,7 @@ CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typese
     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());
index 28a87f6..67b7647 100644 (file)
@@ -55,7 +55,7 @@ namespace WebCore {
 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);
@@ -81,11 +81,11 @@ static NSString *webFallbackFontFamily(void)
 
 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)
@@ -237,14 +237,14 @@ void SimpleFontData::platformCharWidthInit()
     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];
@@ -399,10 +399,10 @@ bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters
     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);
@@ -412,7 +412,7 @@ bool SimpleFontData::canRenderCombiningCharacterSequence(const UChar* characters
         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;
     }
index 2000e12..e99695b 100644 (file)
@@ -116,7 +116,7 @@ static void freeData(void *, const void *data, size_t /* size */)
 
     RetainPtr<CGColorSpaceRef> imageColorSpace = colorSpace;
     if (!imageColorSpace)
-        imageColorSpace.adoptCF(CGColorSpaceCreateDeviceRGB());
+        imageColorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
 
     CGRect layerBounds = CGRectIntegral([self bounds]);
     
index 4367696..feccbc8 100644 (file)
@@ -39,7 +39,7 @@ PassRefPtr<ContentFilter> ContentFilter::create(const ResourceResponse& response
 }
 
 ContentFilter::ContentFilter(const ResourceResponse& response)
-    : m_platformContentFilter(AdoptNS, wkFilterCreateInstance(response.nsURLResponse()))
+    : m_platformContentFilter(adoptNS(wkFilterCreateInstance(response.nsURLResponse())))
 {
     ASSERT(m_platformContentFilter);
 }
index 2d72ba9..4c61567 100644 (file)
@@ -73,7 +73,7 @@ static PlatformMenuItemDescription createPlatformMenuItemDescription(ContextMenu
 
 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);
@@ -81,12 +81,12 @@ ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction act
 
 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);
 }
index 3265eb7..96e97bb 100644 (file)
@@ -48,7 +48,7 @@ static RetainPtr<NSCursor> createCustomCursor(Image* image, const IntPoint& hotS
     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;
 }
@@ -56,8 +56,8 @@ static RetainPtr<NSCursor> createCustomCursor(Image* image, const IntPoint& hotS
 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;
 
index af9cf87..e3738c2 100644 (file)
@@ -37,7 +37,7 @@ DisplaySleepDisabler::DisplaySleepDisabler(const char* reason)
     : 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);
index c22a614..1e1583d 100644 (file)
@@ -68,7 +68,7 @@ RetainPtr<NSImage> dissolveDragImageToFraction(RetainPtr<NSImage> image, float d
     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];
@@ -93,7 +93,7 @@ RetainPtr<NSImage> createDragImageFromImage(Image* image, RespectImageOrientatio
             // 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...
@@ -108,7 +108,7 @@ RetainPtr<NSImage> createDragImageFromImage(Image* image, RespectImageOrientatio
             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];
 
@@ -119,7 +119,7 @@ RetainPtr<NSImage> createDragImageFromImage(Image* image, RespectImageOrientatio
         }
     }
 
-    RetainPtr<NSImage> dragImage(AdoptNS, [image->getNSImage() copy]);
+    RetainPtr<NSImage> dragImage = adoptNS([image->getNSImage() copy]);
     [dragImage.get() setSize:(NSSize)size];
     return dragImage;
 }
index 668c07c..4e225b7 100644 (file)
@@ -1664,7 +1664,7 @@ static NSInteger _colCompare(id block1, id block2, void *)
     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();
@@ -1707,7 +1707,7 @@ static NSInteger _colCompare(id block1, id block2, void *)
         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;
index c15ff5a..1afcc37 100644 (file)
@@ -61,7 +61,7 @@ static String httpStyleLanguageCode(NSString *languageCode)
     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();
@@ -71,7 +71,7 @@ static String httpStyleLanguageCode(NSString *languageCode)
 
     // 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();
     }
@@ -91,7 +91,7 @@ Vector<String> platformUserPreferredLanguages()
         useCachedPreferredLanguages = YES;
         userPreferredLanguages.clear();
 
-        RetainPtr<CFArrayRef> languages(AdoptCF, CFLocaleCopyPreferredLanguages());
+        RetainPtr<CFArrayRef> languages = adoptCF(CFLocaleCopyPreferredLanguages());
         CFIndex languageCount = CFArrayGetCount(languages.get());
         if (!languageCount)
             userPreferredLanguages.append("en");
index 8cabe86..ad33430 100644 (file)
@@ -44,11 +44,11 @@ String localizedString(const char* key)
     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;
index c380771..48d3eba 100644 (file)
@@ -158,7 +158,7 @@ PassRefPtr<SharedBuffer> Pasteboard::getDataSelection(Frame* frame, const String
         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];
     
@@ -178,7 +178,7 @@ PassRefPtr<SharedBuffer> Pasteboard::getDataSelection(Frame* frame, const String
 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];
     
@@ -473,7 +473,7 @@ static PassRefPtr<DocumentFragment> fragmentFromWebArchive(Frame* frame, PassRef
         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());
index 81fb6fd..117514a 100644 (file)
@@ -54,7 +54,7 @@ PlatformClockCM::PlatformClockCM()
 {
     CMClockRef rawClockPtr = 0;
     CMAudioDeviceClockCreate(kCFAllocatorDefault, NULL, &rawClockPtr);
-    RetainPtr<CMClockRef> clock(AdoptCF, rawClockPtr);
+    RetainPtr<CMClockRef> clock = adoptCF(rawClockPtr);
     initializeWithTimingSource(clock.get());
 }
 
@@ -69,7 +69,7 @@ void PlatformClockCM::initializeWithTimingSource(CMClockRef clock)
 {
     CMTimebaseRef rawTimebasePtr = 0;
     CMTimebaseCreateWithMasterClock(kCFAllocatorDefault, clock, &rawTimebasePtr);
-    m_timebase.adoptCF(rawTimebasePtr);
+    m_timebase = adoptCF(rawTimebasePtr);
 }
 
 void PlatformClockCM::setCurrentTime(double time)
index 1d8a1f8..4058826 100644 (file)
@@ -113,7 +113,7 @@ void PlatformPasteboard::copy(const String& fromPasteboard)
 
 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]];
 
@@ -127,7 +127,7 @@ void PlatformPasteboard::setTypes(const Vector<String>& pasteboardTypes)
         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]];
 
@@ -141,7 +141,7 @@ void PlatformPasteboard::setBufferForType(PassRefPtr<SharedBuffer> buffer, const
 
 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];
index 31e9c58..9f71892 100644 (file)
@@ -243,7 +243,7 @@ void PlatformSpeechSynthesizer::resume()
 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()];
 }
index add0ed8..6a5633d 100644 (file)
@@ -96,13 +96,13 @@ void PopupMenuMac::populate()
                 [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];
@@ -184,7 +184,7 @@ void PopupMenuMac::show(const IntRect& r, FrameView* v, int index)
     
     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];
     
index 0374fc4..434c086 100644 (file)
@@ -486,7 +486,7 @@ enum FeatureToAnimate {
             [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 
@@ -532,7 +532,7 @@ enum FeatureToAnimate {
     [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
@@ -562,7 +562,7 @@ enum FeatureToAnimate {
     [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
@@ -613,11 +613,11 @@ ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea)
     , 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()];
@@ -896,7 +896,7 @@ void ScrollAnimatorMac::didAddVerticalScrollbar(Scrollbar* scrollbar)
         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];
@@ -931,7 +931,7 @@ void ScrollAnimatorMac::didAddHorizontalScrollbar(Scrollbar* scrollbar)
         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];
index 228d691..dfffbca 100644 (file)
@@ -112,7 +112,7 @@ CFDataRef SharedBuffer::createCFData()
         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)
index 38211c1..9e0fed7 100644 (file)
@@ -92,7 +92,7 @@ CFStringEncoding stringEncodingForResource(Handle resource)
     if (error != noErr)
         return NSMacOSRomanStringEncoding;
     
-    RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateFromFSRef(NULL, &fref));
+    RetainPtr<CFURLRef> url = adoptCF(CFURLCreateFromFSRef(NULL, &fref));
     if (!url)
         return NSMacOSRomanStringEncoding;
 
@@ -104,7 +104,7 @@ CFStringEncoding stringEncodingForResource(Handle resource)
         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;
 
index 26c258f..e926ad1 100644 (file)
@@ -93,7 +93,7 @@ ProtectionSpaceAuthenticationScheme ProtectionSpace::authenticationScheme() cons
 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 || 
index 5376d99..16431b0 100644 (file)
@@ -100,7 +100,7 @@ void SynchronousLoaderClient::didFail(ResourceHandle*, const ResourceError& erro
 #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
index 97f0287..c34f6f6 100644 (file)
@@ -43,8 +43,8 @@ namespace WebCore {
 
 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());
 }
 
index cbfe969..1130614 100644 (file)
@@ -51,15 +51,15 @@ bool DNSResolveQueue::platformProxyIsEnabledInSystemPreferences()
     // 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());
index 28fb6eb..8754233 100644 (file)
@@ -163,7 +163,7 @@ static bool advanceCurrentStream(FormStreamFields* form)
         }
 #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;
index e145dbc..3923c90 100644 (file)
@@ -72,7 +72,7 @@ void overrideCookieStorage(CFHTTPCookieStorageRef cookieStorage)
 {
     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()
index f82a4e2..8ed5487 100644 (file)
@@ -47,7 +47,7 @@ static void proxyAutoConfigurationResultCallback(void *context, CFArrayRef proxi
     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;
@@ -81,7 +81,7 @@ static void processProxyServers(Vector<ProxyServer>& proxyServers, CFArrayRef pr
                 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;
@@ -121,12 +121,12 @@ static void processProxyServers(Vector<ProxyServer>& proxyServers, CFArrayRef pr
 
 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;
 
index e472138..919f03a 100644 (file)
@@ -98,7 +98,7 @@ void ResourceError::platformLazyInit()
 
     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)
@@ -106,7 +106,7 @@ void ResourceError::platformLazyInit()
         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);
@@ -145,7 +145,7 @@ CFErrorRef ResourceError::cfError() const
     }
 
     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());
@@ -153,7 +153,7 @@ CFErrorRef ResourceError::cfError() const
         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());
         }
 
index 951f4b7..f5a3b72 100644 (file)
@@ -128,7 +128,7 @@ static CFURLRequestRef willSendRequest(CFURLConnectionRef conn, CFURLRequestRef
             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());
 
@@ -382,7 +382,7 @@ void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool
     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);
@@ -392,7 +392,7 @@ void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool
     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
@@ -436,7 +436,7 @@ void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool
     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()
@@ -569,7 +569,7 @@ void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChall
                     // 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;
             }
@@ -610,7 +610,7 @@ void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge
         // 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)
@@ -619,7 +619,7 @@ void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge
 
         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());
     }
 
@@ -793,7 +793,7 @@ void ResourceHandle::handleDataArray(CFArrayRef dataArray)
     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));
index 31fa223..aa24028 100644 (file)
@@ -113,7 +113,7 @@ CFURLRequestRef ResourceRequest::cfURLRequest(HTTPBodyUpdatePolicy bodyPolicy) c
 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);
@@ -130,8 +130,8 @@ void ResourceRequest::doUpdatePlatformRequest()
 {
     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());
@@ -154,7 +154,7 @@ void ResourceRequest::doUpdatePlatformRequest()
     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());
@@ -164,7 +164,7 @@ void ResourceRequest::doUpdatePlatformRequest()
     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()));
@@ -175,12 +175,12 @@ void ResourceRequest::doUpdatePlatformRequest()
     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
@@ -190,8 +190,8 @@ void ResourceRequest::doUpdatePlatformHTTPBody()
 {
     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());
@@ -216,7 +216,7 @@ void ResourceRequest::doUpdatePlatformHTTPBody()
         }
     }
 
-    m_cfRequest.adoptCF(cfRequest);
+    m_cfRequest = adoptCF(cfRequest);
 #if PLATFORM(MAC)
     updateNSURLRequest();
 #endif
@@ -255,7 +255,7 @@ void ResourceRequest::doUpdateResourceRequest()
     }
 
     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) {
@@ -266,7 +266,7 @@ void ResourceRequest::doUpdateResourceRequest()
     }
 
 #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
@@ -298,7 +298,7 @@ void ResourceRequest::setStorageSession(CFURLStorageSessionRef storageSession)
 
     CFMutableURLRequestRef cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
     wkSetRequestStorageSession(storageSession, cfRequest);
-    m_cfRequest.adoptCF(cfRequest);
+    m_cfRequest = adoptCF(cfRequest);
 #if PLATFORM(MAC)
     updateNSURLRequest();
 #endif
index 9293043..568be71 100644 (file)
@@ -50,11 +50,11 @@ static const int numCommonHeaderFields = sizeof(commonHeaderFields) / sizeof(CFS
 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();
@@ -101,7 +101,7 @@ void ResourceResponse::platformLazyInit(InitLevel initLevel)
         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;
@@ -115,10 +115,10 @@ void ResourceResponse::platformLazyInit(InitLevel initLevel)
     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);
@@ -129,7 +129,7 @@ void ResourceResponse::platformLazyInit(InitLevel initLevel)
     }
     
     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();
     }
 
index d22ad4e..2bf6952 100644 (file)
@@ -66,7 +66,7 @@ SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient
     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);
@@ -151,7 +151,7 @@ void SocketStreamHandle::executePACFileURL(CFURLRef pacFileURL)
 {
     // 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
@@ -175,7 +175,7 @@ void SocketStreamHandle::removePACRunLoopSource()
 
 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.
@@ -189,7 +189,7 @@ void SocketStreamHandle::chooseProxy()
 
     // 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());
 }
@@ -274,8 +274,8 @@ void SocketStreamHandle::createStreams()
     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:
@@ -288,7 +288,7 @@ void SocketStreamHandle::createStreams()
         // 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;
         }
@@ -300,7 +300,7 @@ void SocketStreamHandle::createStreams()
     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());
     }
@@ -340,7 +340,7 @@ static ProtectionSpaceAuthenticationScheme authenticationSchemeFromAuthenticatio
 
 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...
@@ -350,8 +350,8 @@ void SocketStreamHandle::addCONNECTCredentials(CFHTTPMessageRef proxyResponse)
 
     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>.
@@ -365,12 +365,12 @@ void SocketStreamHandle::addCONNECTCredentials(CFHTTPMessageRef proxyResponse)
     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.
@@ -454,7 +454,7 @@ void SocketStreamHandle::readStreamCallback(CFStreamEventType type)
 
         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;
 
@@ -500,7 +500,7 @@ void SocketStreamHandle::readStreamCallback(CFStreamEventType type)
         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;
     }
@@ -530,7 +530,7 @@ void SocketStreamHandle::writeStreamCallback(CFStreamEventType type)
 
         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;
 
@@ -556,7 +556,7 @@ void SocketStreamHandle::writeStreamCallback(CFStreamEventType type)
         return;
     }
     case kCFStreamEventErrorOccurred: {
-        RetainPtr<CFErrorRef> error(AdoptCF, CFWriteStreamCopyError(m_writeStream.get()));
+        RetainPtr<CFErrorRef> error = adoptCF(CFWriteStreamCopyError(m_writeStream.get()));
         reportErrorToClient(error.get());
         return;
     }
@@ -591,7 +591,7 @@ void SocketStreamHandle::reportErrorToClient(CFErrorRef error)
 #endif
 
     if (description.isNull()) {
-        RetainPtr<CFStringRef> descriptionCF(AdoptCF, CFErrorCopyDescription(error));
+        RetainPtr<CFStringRef> descriptionCF = adoptCF(CFErrorCopyDescription(error));
         description = String(descriptionCF.get());
     }
 
index 18fe68b..6bbf3a8 100644 (file)
@@ -142,24 +142,24 @@ ProtectionSpace core(NSURLProtectionSpace *macSpace)
 
 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];
 }
 
@@ -192,9 +192,9 @@ AuthenticationChallenge::AuthenticationChallenge(NSURLAuthenticationChallenge *c
 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];
index 2a63296..bc22375 100644 (file)
@@ -40,7 +40,7 @@ namespace WebCore {
 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];
index 5b1220b..63583bf 100644 (file)
@@ -38,9 +38,9 @@ void NetworkStateNotifier::updateState()
     // 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;
@@ -61,9 +61,9 @@ void NetworkStateNotifier::updateState()
         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;
@@ -101,29 +101,29 @@ NetworkStateNotifier::NetworkStateNotifier()
 {
     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());
index 4e8d3c6..4462230 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore {
 
 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];
@@ -50,7 +50,7 @@ static RetainPtr<NSError> createNSErrorFromResourceErrorBase(const ResourceError
         [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)
@@ -76,8 +76,8 @@ NSError *ResourceError::nsError() const
 
     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();
     }
 
index 4135ca0..ace0449 100644 (file)
@@ -147,7 +147,7 @@ void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredential
 #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()
index 14920d3..6670652 100644 (file)
@@ -67,7 +67,7 @@ ResourceRequest::ResourceRequest(NSURLRequest *nsRequest)
 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
@@ -200,7 +200,7 @@ void ResourceRequest::doUpdatePlatformRequest()
     }
 #endif
 
-    m_nsRequest.adoptNS(nsRequest);
+    m_nsRequest = adoptNS(nsRequest);
 }
 
 void ResourceRequest::doUpdatePlatformHTTPBody()
@@ -232,7 +232,7 @@ void ResourceRequest::doUpdatePlatformHTTPBody()
         }
     }
 
-    m_nsRequest.adoptNS(nsRequest);
+    m_nsRequest = adoptNS(nsRequest);
 }
 
 void ResourceRequest::updateFromDelegatePreservingOldHTTPBody(const ResourceRequest& delegateProvidedRequest)
@@ -252,7 +252,7 @@ void ResourceRequest::applyWebArchiveHackForMail()
 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)
index 0b456de..ddd19b8 100644 (file)
@@ -63,7 +63,7 @@ void ResourceResponse::initNSURLResponse() const
 
     // 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)
@@ -80,7 +80,7 @@ NSURLResponse *ResourceResponse::nsURLResponse() const
         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();
 }
@@ -148,7 +148,7 @@ void ResourceResponse::platformLazyInit(InitLevel initLevel)
 
             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
index a8010ed..4259298 100644 (file)
@@ -47,12 +47,12 @@ namespace WebCore {
 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);
index 32801ba..8a83ec0 100644 (file)
@@ -294,20 +294,20 @@ void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse)
         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());
                 }
             }
index 6d19ed1..6475bfe 100644 (file)
@@ -38,7 +38,7 @@ namespace WebCore {
 template<>
 RetainPtr<CFLocaleRef> AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >::createValueForNullKey()
 {
-    RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCopyCurrent());
+    RetainPtr<CFLocaleRef> locale = adoptCF(CFLocaleCopyCurrent());
 
     return CFStringIsHyphenationAvailableForLocale(locale.get()) ? locale : 0;
 }
@@ -64,7 +64,7 @@ bool canHyphenate(const AtomicString& localeIdentifier)
 
 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);
index 40b77c8..cf6cb51 100644 (file)
@@ -44,8 +44,8 @@ bool AtomicStringKeyedMRUCache<bool>::createValueForNullKey()
 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);
@@ -61,7 +61,7 @@ size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeI
 {
     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);
 }
 
index 87e586d..a23f983 100644 (file)
@@ -62,7 +62,7 @@ static RetainPtr<NSLocale> determineLocale(const String& locale)
     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)
@@ -83,14 +83,14 @@ static RetainPtr<NSDateFormatter> createDateTimeFormatter(NSLocale* locale, NSCa
 
 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()];
 }
 
@@ -308,12 +308,12 @@ void LocaleMac::initializeLocaleData()
         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;
index 6af5616..5901d83 100644 (file)
@@ -29,7 +29,7 @@ static const int maxLocaleStringLength = 32;
 
 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;
@@ -53,8 +53,7 @@ static RetainPtr<CFStringRef> canonicalLanguageIdentifier(CFStringRef locale)
 {
     if (!locale)
         return 0;
-    RetainPtr<CFStringRef> canonicalLocale(AdoptCF,
-        CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorDefault, locale));
+    RetainPtr<CFStringRef> canonicalLocale = adoptCF(CFLocaleCreateCanonicalLanguageIdentifierFromString(kCFAllocatorDefault, locale));
     if (!canonicalLocale)
         return locale;
     return canonicalLocale;
index 1d697f3..0a4d286 100644 (file)
@@ -161,7 +161,7 @@ PassRefPtr<RenderTheme> RenderThemeMac::create()
 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:)
@@ -1271,7 +1271,7 @@ NSLevelIndicatorCell* RenderThemeMac::levelIndicatorFor(const RenderMeter* rende
     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();
@@ -1469,21 +1469,21 @@ void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const PaintIn
 
     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);
@@ -1728,12 +1728,12 @@ bool RenderThemeMac::paintSliderTrack(RenderObject* o, const PaintInfo& paintInf
     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));
@@ -2184,7 +2184,7 @@ bool RenderThemeMac::shouldShowPlaceholderWhenFocused() const
 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];
     }
@@ -2195,7 +2195,7 @@ NSPopUpButtonCell* RenderThemeMac::popupButton() const
 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];
@@ -2208,7 +2208,7 @@ NSSearchFieldCell* RenderThemeMac::search() const
 NSMenu* RenderThemeMac::searchMenuTemplate() const
 {
     if (!m_searchMenuTemplate)
-        m_searchMenuTemplate.adoptNS([[NSMenu alloc] initWithTitle:@""]);
+        m_searchMenuTemplate = adoptNS([[NSMenu alloc] initWithTitle:@""]);
 
     return m_searchMenuTemplate.get();
 }
@@ -2216,7 +2216,7 @@ NSMenu* RenderThemeMac::searchMenuTemplate() const
 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];
@@ -2228,7 +2228,7 @@ NSSliderCell* RenderThemeMac::sliderThumbHorizontal() const
 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];
@@ -2240,7 +2240,7 @@ NSSliderCell* RenderThemeMac::sliderThumbVertical() const
 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];
index 678d2be..6be357b 100644 (file)
@@ -1,3 +1,13 @@
+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.
index c44e334..120e1fd 100644 (file)
@@ -72,7 +72,7 @@ static inline RetainPtr<CFStringRef> createKeyForPreferences(const String& key)
 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;
index 9588c35..d53036b 100644 (file)
@@ -1,3 +1,90 @@
+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.
index 7466618..18ba516 100644 (file)
@@ -90,7 +90,7 @@
             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");
index e7a8043..5fe657e 100644 (file)
@@ -98,9 +98,9 @@ static void *setMetaData(void* context)
 
 - (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());
 }
index f0f0aa2..0a7a57e 100644 (file)
@@ -55,7 +55,7 @@ DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, hostedNetscapePluginStreamC
 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)
 {
index 4732d23..e8ceab9 100644 (file)
@@ -114,7 +114,7 @@ bool NetscapePluginHostManager::spawnPluginHost(const String& pluginPath, cpu_ty
     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",
@@ -225,7 +225,7 @@ PassRefPtr<NetscapePluginInstanceProxy> NetscapePluginHostManager::instantiatePl
     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"];
index fc054bd..57d598e 100644 (file)
@@ -105,18 +105,18 @@ NetscapePluginHostProxy::NetscapePluginHostProxy(mach_port_t clientPort, mach_po
     
     // 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);
 }
@@ -230,7 +230,7 @@ void NetscapePluginHostProxy::beginModal()
     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(); }];
@@ -515,7 +515,7 @@ kern_return_t WKPCBooleanAndDataReply(mach_port_t clientPort, uint32_t pluginID,
     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;
index 79576ef..d7a05dc 100644 (file)
@@ -499,9 +499,9 @@ void NetscapePluginInstanceProxy::print(CGContextRef context, unsigned width, un
     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);
@@ -522,9 +522,9 @@ void NetscapePluginInstanceProxy::snapshot(CGContextRef context, unsigned width,
     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());
 }
@@ -536,7 +536,7 @@ void NetscapePluginInstanceProxy::stopTimers()
 
 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;
 
@@ -558,7 +558,7 @@ NPError NetscapePluginInstanceProxy::loadURL(const char* url, const char* target
             // 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;
             
@@ -713,7 +713,7 @@ void NetscapePluginInstanceProxy::evaluateJavaScript(PluginRequest* pluginReques
         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]);
@@ -1221,7 +1221,7 @@ bool NetscapePluginInstanceProxy::enumerate(uint32_t objectID, data_t& resultDat
     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()));
 
@@ -1289,7 +1289,7 @@ void NetscapePluginInstanceProxy::addValueToArray(NSMutableArray *array, ExecSta
 
 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);
 
@@ -1304,7 +1304,7 @@ void NetscapePluginInstanceProxy::marshalValue(ExecState* exec, JSValue value, d
 
 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));
@@ -1372,7 +1372,7 @@ bool NetscapePluginInstanceProxy::demarshalValueFromArray(ExecState* exec, NSArr
 
 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
@@ -1388,7 +1388,7 @@ JSValue NetscapePluginInstanceProxy::demarshalValue(ExecState* exec, const char*
 
 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
index b5815be..1c22631 100644 (file)
@@ -99,8 +99,8 @@ extern "C" {
     ASSERT(!_attributeKeys);
     ASSERT(!_attributeValues);
     
-    _attributeKeys.adoptNS([keys copy]);
-    _attributeValues.adoptNS([values copy]);
+    _attributeKeys = adoptNS([keys copy]);
+    _attributeValues = adoptNS([values copy]);
 }    
 
 - (BOOL)createPlugin
@@ -127,9 +127,9 @@ extern "C" {
             // 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;
             
index fc60e9b..b23bd9b 100644 (file)
@@ -98,15 +98,15 @@ using namespace WebCore;
     
     _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"];
@@ -488,7 +488,7 @@ using namespace WebCore;
     [snapshot unlockFocus];
     _snapshotting = NO;
     
-    _cachedSnapshot.adoptNS(snapshot);
+    _cachedSnapshot = adoptNS(snapshot);
 }
 
 - (void)clearCachedSnapshot
@@ -921,7 +921,7 @@ bool getAuthenticationInfo(const char* protocolStr, const char* hostStr, int32_t
             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)
index 4a4f6cc..eb05f27 100644 (file)
@@ -134,7 +134,7 @@ static NSString *pathByResolvingSymlinksAndAliases(NSString *thePath)
         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];
index b57dd3b..f2d7e9f 100644 (file)
@@ -390,7 +390,7 @@ void WebNetscapePluginEventHandlerCarbon::startTimers(bool throttleTimers)
     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);
 }
index a8ad861..8ea95b0 100644 (file)
@@ -158,7 +158,7 @@ void WebNetscapePluginEventHandlerCocoa::syntheticKeyDownWithCommandModifier(int
 {
     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);
@@ -286,7 +286,7 @@ OSStatus WebNetscapePluginEventHandlerCocoa::handleTSMEvent(EventRef eventRef)
     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;
     
index 1785156..5024db4 100644 (file)
@@ -168,7 +168,7 @@ using namespace WebCore;
         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;
@@ -177,7 +177,7 @@ using namespace WebCore;
     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]];
index ae4a4c9..1fbda7a 100644 (file)
@@ -154,7 +154,7 @@ WebNetscapePluginStream::WebNetscapePluginStream(NSURLRequest *request, NPP plug
     , 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)
 {
@@ -544,7 +544,7 @@ void WebNetscapePluginStream::deliverData()
             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) 
@@ -572,7 +572,7 @@ void WebNetscapePluginStream::deliverDataToFile(NSData *data)
             return;
         }
 
-        m_path.adoptNS([[NSString stringWithUTF8String:temporaryFileName] retain]);
+        m_path = adoptNS([[NSString stringWithUTF8String:temporaryFileName] retain]);
         free(temporaryFileName);
     }
 
@@ -617,7 +617,7 @@ void WebNetscapePluginStream::didReceiveData(NetscapePlugInStreamLoader*, const
     
     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();
     }
index 44618a0..c0df10f 100644 (file)
@@ -1091,7 +1091,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
         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)
@@ -1101,9 +1101,9 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
                 // 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;
 
@@ -1336,7 +1336,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
     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]) {
@@ -1605,7 +1605,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
         
         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]);
index 0275944..02e73f3 100644 (file)
@@ -84,7 +84,7 @@ void WebDatabaseManagerClient::dispatchDidModifyOrigin(SecurityOrigin* origin)
         return;
     }
 
-    RetainPtr<WebSecurityOrigin> webSecurityOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
+    RetainPtr<WebSecurityOrigin> webSecurityOrigin = adoptNS([[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]);
 
     [[NSNotificationCenter defaultCenter] postNotificationName:WebDatabaseDidModifyOriginNotification 
                                                         object:webSecurityOrigin.get()];
@@ -97,8 +97,8 @@ void WebDatabaseManagerClient::dispatchDidModifyDatabase(SecurityOrigin* origin,
         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
index 3bc9f10..49183b4 100644 (file)
@@ -58,7 +58,7 @@ void WebStorageTrackerClient::dispatchDidModifyOriginOnMainThread(void* context)
 
 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()];
index 771910b..d73d0df 100644 (file)
@@ -136,7 +136,7 @@ void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, N
     [m_view.get() handleAcceptedAlternativeText:acceptedReplacement];
     m_view.clear();
     if (acceptedReplacement)
-        m_resultForDismissal.adoptNS([acceptedReplacement copy]);
+        m_resultForDismissal = adoptNS([acceptedReplacement copy]);
 }
 
 #endif //USE(AUTOCORRECTION_PANEL)
index 43a69a5..d77edbc 100644 (file)
@@ -80,7 +80,7 @@ using namespace WebCore;
     
     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()];
     }
     
index f03a87a..b37e695 100644 (file)
@@ -970,7 +970,7 @@ void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin* origin, const K
     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());
     }
 }
index c8f3201..c30e3d5 100644 (file)
@@ -126,7 +126,7 @@ using namespace WebCore;
 
 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)
 {
@@ -140,13 +140,13 @@ void WebInspectorClient::inspectorDestroyed()
 
 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;
index 5e6228d..6b55670 100644 (file)
@@ -232,7 +232,7 @@ static NSRect convertRectToScreen(NSWindow *window, NSRect rect)
 
     // 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];
     }
index 71d21a3..295aa85 100644 (file)
@@ -104,7 +104,7 @@ NSArray *allScriptsInPDFDocument(PDFDocument *document)
         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());
index 1975b5e..64238b8 100644 (file)
@@ -219,8 +219,8 @@ public:
         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()];
@@ -256,9 +256,9 @@ public:
         }
 
         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) {
index e95954e..e47e92b 100644 (file)
@@ -87,7 +87,7 @@ void WebScriptDebugger::initGlobalCallFrame(const DebuggerCallFrame& debuggerCal
 
     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];
@@ -145,7 +145,7 @@ void WebScriptDebugger::callEvent(const DebuggerCallFrame& debuggerCallFrame, in
 
     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);
index 14734da..c85b908 100644 (file)
@@ -4516,7 +4516,7 @@ static WebFrame *incrementFrame(WebFrame *frame, WebFindOptions options = 0)
 
     // 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;
index 58f68aa..e910f7d 100644 (file)
@@ -1,3 +1,158 @@
+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):