Source/WebCore: Use adoptCF and adoptNS in more places
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 May 2013 07:40:11 +0000 (07:40 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 May 2013 07:40:11 +0000 (07:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115657

Reviewed by Sam Weinig.

This is similar to my last set of changes, but covers code that I missed with
global replace using the Safari Xcode workspace.

* platform/cf/win/CertificateCFWin.cpp:
(WebCore::copyCertificateToData):
* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::MediaPlayerPrivateAVFoundationCF::platformBufferedTimeRanges):
(WebCore::MediaPlayerPrivateAVFoundationCF::platformMinTimeSeekable):
(WebCore::MediaPlayerPrivateAVFoundationCF::platformMaxTimeSeekable):
(WebCore::MediaPlayerPrivateAVFoundationCF::platformMaxTimeLoaded):
(WebCore::MediaPlayerPrivateAVFoundationCF::totalBytes):
(WebCore::mimeTypeCache):
(WebCore::MediaPlayerPrivateAVFoundationCF::tracksChanged):
(WebCore::MediaPlayerPrivateAVFoundationCF::sizeChanged):
(WebCore::AVFWrapper::createAssetForURL):
(WebCore::AVFWrapper::createPlayer):
(WebCore::AVFWrapper::createPlayerItem):
(WebCore::AVFWrapper::setAsset):
(WebCore::AVFWrapper::platformLayer):
(WebCore::AVFWrapper::createAVCFVideoLayer):
(WebCore::AVFWrapper::createImageGenerator):
* platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm:
(WebCore::InbandTextTrackPrivateLegacyAVFObjC::language):
* platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
(toCACFTimingFunction):
(PlatformCAAnimation::PlatformCAAnimation):
(PlatformCAAnimation::setFromValue):
(PlatformCAAnimation::setToValue):
(PlatformCAAnimation::setValues):
(PlatformCAAnimation::setKeyTimes):
(PlatformCAAnimation::setTimingFunctions):
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayer::PlatformCALayer):
(PlatformCALayer::setBackgroundColor):
(PlatformCALayer::setBorderColor):
* platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
(PlatformCALayerWinInternal::PlatformCALayerWinInternal):
(PlatformCALayerWinInternal::addTile):
* platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp:
(WebCore::WKCACFViewLayerTreeHost::WKCACFViewLayerTreeHost):
* platform/graphics/gstreamer/PlatformVideoWindowMac.mm:
(PlatformVideoWindow::PlatformVideoWindow):
* platform/graphics/win/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::fontPlatformData):
* platform/graphics/win/FontPlatformDataCGWin.cpp:
(WebCore::getPostScriptName):
(WebCore::FontPlatformData::platformDataInit):
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContext::drawWindowsBitmap):
* platform/graphics/win/ImageCGWin.cpp:
(WebCore::BitmapImage::create):
* platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp:
(WebCore::MediaPlayerPrivateFullscreenWindow::setRootChildLayer):
* platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
(WebCore::MediaPlayerPrivateQuickTimeVisualContext::rfc2616DateStringFromTime):
(WebCore::QTCFDictionaryCreateWithDataCallback):
(WebCore::MediaPlayerPrivateQuickTimeVisualContext::retrieveCurrentImage):
* platform/graphics/win/WKCAImageQueue.cpp:
(WebCore::WKCAImageQueue::WKCAImageQueue):
* platform/image-decoders/ImageDecoder.h:
(WebCore::ImageDecoder::qcmsOutputDeviceProfile):
* platform/network/cf/AuthenticationCF.cpp:
(WebCore::core):
* platform/network/cf/CookieJarCFNet.cpp:
(WebCore::cookieDomain):
(WebCore::cookieName):
(WebCore::cookiePath):
(WebCore::cookieValue):
(WebCore::filterCookies):
(WebCore::setCookiesFromDOM):
(WebCore::cookiesForDOM):
(WebCore::cookieRequestHeaderFieldValue):
(WebCore::getRawCookies):
(WebCore::deleteCookie):
(WebCore::getHostnamesWithCookies):
(WebCore::deleteCookiesForHostname):
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::certificatePath):
* platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::urlFromPath):
(WebCore::getURL):
* platform/win/LocalizedStringsWin.cpp:
(WebCore::createWebKitBundle):
(WebCore::localizedString):
* platform/win/SearchPopupMenuWin.cpp:
(WebCore::SearchPopupMenuWin::saveRecentSearches):
(WebCore::SearchPopupMenuWin::loadRecentSearches):
* plugins/mac/PluginPackageMac.cpp:
(WebCore::stringListFromResourceId):
(WebCore::PluginPackage::fetchInfo):
(WebCore::PluginPackage::load):
* plugins/mac/PluginViewMac.mm:
(WebCore::PluginView::platformStart):
* rendering/RenderThemeSafari.cpp:
(WebCore::RenderThemeSafari::platformFocusRingColor):
(WebCore::RenderThemeSafari::paintMenuListButtonGradients):
(WebCore::RenderThemeSafari::paintSliderTrack):
Use adoptCF and adoptNS throughout.

Source/WebKit/win: Use adoptCF and adoptNS in more places
https://bugs.webkit.org/show_bug.cgi?id=115657

Reviewed by Sam Weinig.

This is similar to my last set of changes, but covers code that I missed with
global replace using the Safari Xcode workspace.

* CFDictionaryPropertyBag.cpp:
(CFDictionaryPropertyBag::Write):
* WebCache.cpp:
(WebCache::statistics):
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::dispatchDidFailToStartPlugin):
* WebCoreSupport/WebInspectorClient.cpp:
(WebInspectorClient::openInspectorFrontend):
(WebInspectorFrontendClient::localizedStringsURL):
* WebDatabaseManager.cpp:
(WebDatabaseManager::dispatchDidModifyDatabase):
* WebDownloadCFNet.cpp:
(WebDownload::init):
(WebDownload::initWithRequest):
(WebDownload::initToResumeWithBundle):
(WebDownload::cancelForResume):
(WebDownload::useCredential):
(WebDownload::didReceiveAuthenticationChallenge):
* WebError.cpp:
(WebError::sslPeerCertificate):
* WebHistory.cpp:
(createUserInfoFromArray):
(createUserInfoFromHistoryItem):
(WebHistory::WebHistory):
(WebHistory::loadFromURL):
(WebHistory::loadHistoryGutsFromURL):
(WebHistory::saveToURL):
(WebHistory::saveHistoryGuts):
(WebHistory::removeAllItems):
(WebHistory::removeItem):
(WebHistory::addItem):
(WebHistory::itemForURL):
(WebHistory::addItemToDateCaches):
(getDayBoundaries):
* WebIconDatabase.cpp:
(postDidAddIconNotification):
* WebLocalizableStrings.cpp:
(cfBundleForStringsBundle):
* WebMutableURLRequest.cpp:
(WebMutableURLRequest::mutableCopy):
* WebPreferences.cpp:
(cfNumber):
(WebPreferences::initializeDefaultSettings):
(WebPreferences::valueForKey):
(WebPreferences::setStringValue):
(WebPreferences::load):
(WebPreferences::migrateWebKitPreferencesToCFPreferences):
(WebPreferences::setPreferenceForTest):
* WebView.cpp:
(WebView::setCacheModel):
(WebView::notifyPreferencesChanged):
Use adoptCF and adoptNS.

Source/WebKit2: Use adoptCF and adoptNS in more places
https://bugs.webkit.org/show_bug.cgi?id=115657

Reviewed by Sam Weinig.

* Shared/Downloads/cfnet/DownloadCFNet.cpp:
(WebKit::Download::useCredential):
(WebKit::Download::start):
(WebKit::Download::startWithHandle):
(WebKit::Download::cancel):
(WebKit::Download::didDecideDestination):
Use adoptCF and adoptNS.

Tools: Use adoptCF and adoptNS in more places, test code and code not compiled on Mac
https://bugs.webkit.org/show_bug.cgi?id=115657

Reviewed by Sam Weinig.

This is similar to my last set of changes, but covers code that I missed with
global replace using the Safari Xcode workspace.

* DumpRenderTree/cf/WebArchiveDumpSupport.cpp:
(convertWebResourceDataToString):
(convertWebResourceResponseToDictionary):
(createXMLStringFromWebArchiveData):
* DumpRenderTree/cg/ImageDiffCG.cpp:
(createImageFromStdin):
(createDifferenceImage):
(main):
* DumpRenderTree/cg/PixelDumpSupportCG.cpp:
(printPNG):
(dumpBitmap):
* DumpRenderTree/cg/PixelDumpSupportCG.h:
(BitmapContext::BitmapContext):
* DumpRenderTree/mac/MockWebNotificationProvider.mm:
(-[MockWebNotificationProvider init]):
* DumpRenderTree/mac/PixelDumpSupportMac.mm:
(createBitmapContext):
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::addDisallowedURL):
(TestRunner::applicationCacheDiskUsageForOrigin):
(TestRunner::localStorageDiskUsageForOrigin):
(TestRunner::clearApplicationCacheForOrigin):
(TestRunner::deleteLocalStorageForOrigin):
(TestRunner::copyDecodedHostName):
(TestRunner::copyEncodedHostName):
(TestRunner::queueLoad):
(TestRunner::setDomainRelaxationForbiddenForURLScheme):
(TestRunner::setMockGeolocationPositionUnavailableError):
(TestRunner::setUserStyleSheetLocation):
(TestRunner::setValueForUser):
(TestRunner::overridePreference):
(TestRunner::setPersistentUserStyleSheetLocation):
(TestRunner::execCommand):
(TestRunner::findString):
(TestRunner::isCommandEnabled):
(TestRunner::addOriginAccessWhitelistEntry):
(TestRunner::removeOriginAccessWhitelistEntry):
(TestRunner::addUserScript):
(TestRunner::addUserStyleSheet):
(TestRunner::evaluateInWebInspector):
(TestRunner::evaluateScriptInIsolatedWorld):
(TestRunner::apiTestNewWindowDataLoadBaseURL):
(-[SynchronousLoader connection:didReceiveAuthenticationChallenge:]):
(TestRunner::authenticateSession):
(TestRunner::grantWebNotificationPermission):
(TestRunner::denyWebNotificationPermission):
* DumpRenderTree/mac/WebArchiveDumpSupportMac.mm:
(createCFURLResponseFromResponseData):
* DumpRenderTree/mac/WorkQueueItemMac.mm:
(LoadItem::invoke):
(LoadHTMLStringItem::invoke):
(ScriptItem::invoke):
* DumpRenderTree/win/DumpRenderTree.cpp:
(substringFromIndex):
(urlSuitableForTestResult):
(lastPathComponent):
(sharedCFURLCache):
* DumpRenderTree/win/ImageDiffCairo.cpp:
(createImageFromStdin):
(main):
* DumpRenderTree/win/PixelDumpSupportWin.cpp:
(createBitmapContextFromWebView):
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setUserStyleSheetLocation):
(TestRunner::setPersistentUserStyleSheetLocation):
* TestWebKitAPI/Tests/CustomProtocolsSyncXHRTest.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/TestWebKitAPI/mac/InstanceMethodSwizzler.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WTF/cf/RetainPtrHashing.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/FindMatches.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/WebArchive.cpp:
(TestWebKitAPI::didReceiveMessageFromInjectedBundle):
* TestWebKitAPI/Tests/WebKit2/mac/GetBackingScaleFactor.mm:
(TestWebKitAPI::createWindow):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/win/DoNotCopyANullCFURLResponse.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/AcceptsFirstMouse.mm:
(TestWebKitAPI::AcceptsFirstMouse::runTest):
* TestWebKitAPI/Tests/mac/AttributedString.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/BackForwardList.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/CancelLoadFromResourceLoadDelegate.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/DOMHTMLTableCellCellAbove.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/DOMRangeOfString.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/DeviceScaleFactorInDashboardRegions.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/DeviceScaleFactorOnBack.mm:
(TestWebKitAPI::DeviceScaleFactorOnBack::createWindow):
* TestWebKitAPI/Tests/mac/DynamicDeviceScaleFactor.mm:
(TestWebKitAPI::DynamicDeviceScaleFactor::createWindow):
* TestWebKitAPI/Tests/mac/HTMLCollectionNamedItem.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/HTMLFormCollectionNamedItem.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/InspectorBar.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/MemoryCacheDisableWithinResourceLoadDelegate.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/MemoryCachePruneWithinResourceLoadDelegate.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:
(TestWebKitAPI::PageVisibilityStateWithWindowChanges::runTest):
* TestWebKitAPI/Tests/mac/RenderedImageFromDOMRange.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/SetDocumentURI.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/SimplifyMarkup.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/StringByEvaluatingJavaScriptFromString.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/WillSendSubmitEvent.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/WindowlessWebViewWithMedia.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/mac/PlatformUtilitiesMac.mm:
(TestWebKitAPI::Util::MIMETypeForWKURLResponse):
* TestWebKitAPI/mac/WebKitAgnosticTest.mm:
(TestWebKitAPI::WebKitAgnosticTest::runWebKit1Test):
(TestWebKitAPI::WebKitAgnosticTest::runWebKit2Test):
* WebKitTestRunner/InjectedBundle/mac/InjectedBundlePageMac.mm:
(WTR::testPathFromURL):
* WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:
(WTR::TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded):
* WebKitTestRunner/cg/TestInvocationCG.cpp:
(WTR::createCGContextFromImage):
(WTR::dumpBitmap):
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
* WebKitTestRunner/mac/EventSenderProxy.mm:
(WTR::EventSenderProxy::mouseScrollBy):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::windowSnapshotImage):
* WebKitTestRunner/win/TestControllerWin.cpp:
(WTR::TestController::initializeTestPluginDirectory):
Use adoptCF and adoptNS.

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

94 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/cf/win/CertificateCFWin.cpp
Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm
Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp
Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp
Source/WebCore/platform/graphics/gstreamer/PlatformVideoWindowMac.mm
Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/win/FontPlatformDataCGWin.cpp
Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
Source/WebCore/platform/graphics/win/ImageCGWin.cpp
Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp
Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
Source/WebCore/platform/graphics/win/WKCAImageQueue.cpp
Source/WebCore/platform/image-decoders/ImageDecoder.h
Source/WebCore/platform/network/cf/AuthenticationCF.cpp
Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
Source/WebCore/platform/network/curl/ResourceHandleManager.cpp
Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp
Source/WebCore/platform/win/LocalizedStringsWin.cpp
Source/WebCore/platform/win/SearchPopupMenuWin.cpp
Source/WebCore/plugins/mac/PluginPackageMac.cpp
Source/WebCore/plugins/mac/PluginViewMac.mm
Source/WebCore/rendering/RenderThemeSafari.cpp
Source/WebKit/win/CFDictionaryPropertyBag.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCache.cpp
Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
Source/WebKit/win/WebDatabaseManager.cpp
Source/WebKit/win/WebDownloadCFNet.cpp
Source/WebKit/win/WebError.cpp
Source/WebKit/win/WebHistory.cpp
Source/WebKit/win/WebIconDatabase.cpp
Source/WebKit/win/WebLocalizableStrings.cpp
Source/WebKit/win/WebMutableURLRequest.cpp
Source/WebKit/win/WebPreferences.cpp
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/Downloads/cfnet/DownloadCFNet.cpp
Tools/ChangeLog
Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp
Tools/DumpRenderTree/cg/ImageDiffCG.cpp
Tools/DumpRenderTree/cg/PixelDumpSupportCG.cpp
Tools/DumpRenderTree/cg/PixelDumpSupportCG.h
Tools/DumpRenderTree/mac/MockWebNotificationProvider.mm
Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm
Tools/DumpRenderTree/mac/TestRunnerMac.mm
Tools/DumpRenderTree/mac/WebArchiveDumpSupportMac.mm
Tools/DumpRenderTree/mac/WorkQueueItemMac.mm
Tools/DumpRenderTree/win/DumpRenderTree.cpp
Tools/DumpRenderTree/win/ImageDiffCairo.cpp
Tools/DumpRenderTree/win/PixelDumpSupportWin.cpp
Tools/DumpRenderTree/win/TestRunnerWin.cpp
Tools/TestWebKitAPI/Tests/CustomProtocolsSyncXHRTest.mm
Tools/TestWebKitAPI/Tests/TestWebKitAPI/mac/InstanceMethodSwizzler.mm
Tools/TestWebKitAPI/Tests/WTF/cf/RetainPtrHashing.cpp
Tools/TestWebKitAPI/Tests/WebKit2/FindMatches.mm
Tools/TestWebKitAPI/Tests/WebKit2/WebArchive.cpp
Tools/TestWebKitAPI/Tests/WebKit2/mac/GetBackingScaleFactor.mm
Tools/TestWebKitAPI/Tests/WebKit2/win/DoNotCopyANullCFURLResponse.cpp
Tools/TestWebKitAPI/Tests/mac/AcceptsFirstMouse.mm
Tools/TestWebKitAPI/Tests/mac/AttributedString.mm
Tools/TestWebKitAPI/Tests/mac/BackForwardList.mm
Tools/TestWebKitAPI/Tests/mac/CancelLoadFromResourceLoadDelegate.mm
Tools/TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm
Tools/TestWebKitAPI/Tests/mac/DOMHTMLTableCellCellAbove.mm
Tools/TestWebKitAPI/Tests/mac/DOMRangeOfString.mm
Tools/TestWebKitAPI/Tests/mac/DeviceScaleFactorInDashboardRegions.mm
Tools/TestWebKitAPI/Tests/mac/DeviceScaleFactorOnBack.mm
Tools/TestWebKitAPI/Tests/mac/DynamicDeviceScaleFactor.mm
Tools/TestWebKitAPI/Tests/mac/HTMLCollectionNamedItem.mm
Tools/TestWebKitAPI/Tests/mac/HTMLFormCollectionNamedItem.mm
Tools/TestWebKitAPI/Tests/mac/InspectorBar.mm
Tools/TestWebKitAPI/Tests/mac/MemoryCacheDisableWithinResourceLoadDelegate.mm
Tools/TestWebKitAPI/Tests/mac/MemoryCachePruneWithinResourceLoadDelegate.mm
Tools/TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm
Tools/TestWebKitAPI/Tests/mac/RenderedImageFromDOMRange.mm
Tools/TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm
Tools/TestWebKitAPI/Tests/mac/SetDocumentURI.mm
Tools/TestWebKitAPI/Tests/mac/SimplifyMarkup.mm
Tools/TestWebKitAPI/Tests/mac/StringByEvaluatingJavaScriptFromString.mm
Tools/TestWebKitAPI/Tests/mac/WillSendSubmitEvent.mm
Tools/TestWebKitAPI/Tests/mac/WindowlessWebViewWithMedia.mm
Tools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm
Tools/TestWebKitAPI/mac/WebKitAgnosticTest.mm
Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundlePageMac.mm
Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm
Tools/WebKitTestRunner/cg/TestInvocationCG.cpp
Tools/WebKitTestRunner/mac/EventSenderProxy.mm
Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm
Tools/WebKitTestRunner/win/TestControllerWin.cpp

index ff390ae..bdf9430 100644 (file)
@@ -1,3 +1,109 @@
+2013-05-06  Darin Adler  <darin@apple.com>
+
+        Use adoptCF and adoptNS in more places
+        https://bugs.webkit.org/show_bug.cgi?id=115657
+
+        Reviewed by Sam Weinig.
+
+        This is similar to my last set of changes, but covers code that I missed with
+        global replace using the Safari Xcode workspace.
+
+        * platform/cf/win/CertificateCFWin.cpp:
+        (WebCore::copyCertificateToData):
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+        (WebCore::MediaPlayerPrivateAVFoundationCF::platformBufferedTimeRanges):
+        (WebCore::MediaPlayerPrivateAVFoundationCF::platformMinTimeSeekable):
+        (WebCore::MediaPlayerPrivateAVFoundationCF::platformMaxTimeSeekable):
+        (WebCore::MediaPlayerPrivateAVFoundationCF::platformMaxTimeLoaded):
+        (WebCore::MediaPlayerPrivateAVFoundationCF::totalBytes):
+        (WebCore::mimeTypeCache):
+        (WebCore::MediaPlayerPrivateAVFoundationCF::tracksChanged):
+        (WebCore::MediaPlayerPrivateAVFoundationCF::sizeChanged):
+        (WebCore::AVFWrapper::createAssetForURL):
+        (WebCore::AVFWrapper::createPlayer):
+        (WebCore::AVFWrapper::createPlayerItem):
+        (WebCore::AVFWrapper::setAsset):
+        (WebCore::AVFWrapper::platformLayer):
+        (WebCore::AVFWrapper::createAVCFVideoLayer):
+        (WebCore::AVFWrapper::createImageGenerator):
+        * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm:
+        (WebCore::InbandTextTrackPrivateLegacyAVFObjC::language):
+        * platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
+        (toCACFTimingFunction):
+        (PlatformCAAnimation::PlatformCAAnimation):
+        (PlatformCAAnimation::setFromValue):
+        (PlatformCAAnimation::setToValue):
+        (PlatformCAAnimation::setValues):
+        (PlatformCAAnimation::setKeyTimes):
+        (PlatformCAAnimation::setTimingFunctions):
+        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+        (PlatformCALayer::PlatformCALayer):
+        (PlatformCALayer::setBackgroundColor):
+        (PlatformCALayer::setBorderColor):
+        * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
+        (PlatformCALayerWinInternal::PlatformCALayerWinInternal):
+        (PlatformCALayerWinInternal::addTile):
+        * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp:
+        (WebCore::WKCACFViewLayerTreeHost::WKCACFViewLayerTreeHost):
+        * platform/graphics/gstreamer/PlatformVideoWindowMac.mm:
+        (PlatformVideoWindow::PlatformVideoWindow):
+        * platform/graphics/win/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::fontPlatformData):
+        * platform/graphics/win/FontPlatformDataCGWin.cpp:
+        (WebCore::getPostScriptName):
+        (WebCore::FontPlatformData::platformDataInit):
+        * platform/graphics/win/GraphicsContextCGWin.cpp:
+        (WebCore::GraphicsContext::drawWindowsBitmap):
+        * platform/graphics/win/ImageCGWin.cpp:
+        (WebCore::BitmapImage::create):
+        * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp:
+        (WebCore::MediaPlayerPrivateFullscreenWindow::setRootChildLayer):
+        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::rfc2616DateStringFromTime):
+        (WebCore::QTCFDictionaryCreateWithDataCallback):
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::retrieveCurrentImage):
+        * platform/graphics/win/WKCAImageQueue.cpp:
+        (WebCore::WKCAImageQueue::WKCAImageQueue):
+        * platform/image-decoders/ImageDecoder.h:
+        (WebCore::ImageDecoder::qcmsOutputDeviceProfile):
+        * platform/network/cf/AuthenticationCF.cpp:
+        (WebCore::core):
+        * platform/network/cf/CookieJarCFNet.cpp:
+        (WebCore::cookieDomain):
+        (WebCore::cookieName):
+        (WebCore::cookiePath):
+        (WebCore::cookieValue):
+        (WebCore::filterCookies):
+        (WebCore::setCookiesFromDOM):
+        (WebCore::cookiesForDOM):
+        (WebCore::cookieRequestHeaderFieldValue):
+        (WebCore::getRawCookies):
+        (WebCore::deleteCookie):
+        (WebCore::getHostnamesWithCookies):
+        (WebCore::deleteCookiesForHostname):
+        * platform/network/curl/ResourceHandleManager.cpp:
+        (WebCore::certificatePath):
+        * platform/win/ClipboardUtilitiesWin.cpp:
+        (WebCore::urlFromPath):
+        (WebCore::getURL):
+        * platform/win/LocalizedStringsWin.cpp:
+        (WebCore::createWebKitBundle):
+        (WebCore::localizedString):
+        * platform/win/SearchPopupMenuWin.cpp:
+        (WebCore::SearchPopupMenuWin::saveRecentSearches):
+        (WebCore::SearchPopupMenuWin::loadRecentSearches):
+        * plugins/mac/PluginPackageMac.cpp:
+        (WebCore::stringListFromResourceId):
+        (WebCore::PluginPackage::fetchInfo):
+        (WebCore::PluginPackage::load):
+        * plugins/mac/PluginViewMac.mm:
+        (WebCore::PluginView::platformStart):
+        * rendering/RenderThemeSafari.cpp:
+        (WebCore::RenderThemeSafari::platformFocusRingColor):
+        (WebCore::RenderThemeSafari::paintMenuListButtonGradients):
+        (WebCore::RenderThemeSafari::paintSliderTrack):
+        Use adoptCF and adoptNS throughout.
+
 2013-05-07  Benjamin Poulain  <bpoulain@apple.com>
 
         Make CanvasStyle's CMYKAValues allocated on the heap and move the pointer in the union.
index 88ea933..8203c03 100644 (file)
@@ -46,7 +46,7 @@ RetainPtr<CFDataRef> copyCertificateToData(PCCERT_CONTEXT certificate)
 {
     static CFAllocatorRef certDealloc = createCertContextDeallocator();
     PCCERT_CONTEXT certificateCopy = CertDuplicateCertificateContext(certificate);
-    return RetainPtr<CFDataRef>(AdoptCF, CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(certificateCopy), sizeof(*certificateCopy), certDealloc));
+    return adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(certificateCopy), sizeof(*certificateCopy), certDealloc));
 }
 
 } // namespace WebCore
index 79b327c..a2dd834 100644 (file)
@@ -548,7 +548,7 @@ PassRefPtr<TimeRanges> MediaPlayerPrivateAVFoundationCF::platformBufferedTimeRan
     if (!avPlayerItem(m_avfWrapper))
         return timeRanges.release();
 
-    RetainPtr<CFArrayRef> loadedRanges(AdoptCF, AVCFPlayerItemCopyLoadedTimeRanges(avPlayerItem(m_avfWrapper)));
+    RetainPtr<CFArrayRef> loadedRanges = adoptCF(AVCFPlayerItemCopyLoadedTimeRanges(avPlayerItem(m_avfWrapper)));
     if (!loadedRanges)
         return timeRanges.release();
 
@@ -570,7 +570,7 @@ PassRefPtr<TimeRanges> MediaPlayerPrivateAVFoundationCF::platformBufferedTimeRan
 
 double MediaPlayerPrivateAVFoundationCF::platformMinTimeSeekable() const 
 { 
-    RetainPtr<CFArrayRef> seekableRanges(AdoptCF, AVCFPlayerItemCopySeekableTimeRanges(avPlayerItem(m_avfWrapper)));
+    RetainPtr<CFArrayRef> seekableRanges = adoptCF(AVCFPlayerItemCopySeekableTimeRanges(avPlayerItem(m_avfWrapper)));
     if (!seekableRanges) 
         return 0; 
 
@@ -597,7 +597,7 @@ double MediaPlayerPrivateAVFoundationCF::platformMaxTimeSeekable() const
     if (!avPlayerItem(m_avfWrapper))
         return 0;
 
-    RetainPtr<CFArrayRef> seekableRanges(AdoptCF, AVCFPlayerItemCopySeekableTimeRanges(avPlayerItem(m_avfWrapper)));
+    RetainPtr<CFArrayRef> seekableRanges = adoptCF(AVCFPlayerItemCopySeekableTimeRanges(avPlayerItem(m_avfWrapper)));
     if (!seekableRanges)
         return 0;
 
@@ -623,7 +623,7 @@ float MediaPlayerPrivateAVFoundationCF::platformMaxTimeLoaded() const
     if (!avPlayerItem(m_avfWrapper))
         return 0;
 
-    RetainPtr<CFArrayRef> loadedRanges(AdoptCF, AVCFPlayerItemCopyLoadedTimeRanges(avPlayerItem(m_avfWrapper)));
+    RetainPtr<CFArrayRef> loadedRanges = adoptCF(AVCFPlayerItemCopyLoadedTimeRanges(avPlayerItem(m_avfWrapper)));
     if (!loadedRanges)
         return 0;
 
@@ -650,7 +650,7 @@ unsigned MediaPlayerPrivateAVFoundationCF::totalBytes() const
         return 0;
 
     int64_t totalMediaSize = 0;
-    RetainPtr<CFArrayRef> tracks(AdoptCF, AVCFAssetCopyAssetTracks(avAsset(m_avfWrapper)));
+    RetainPtr<CFArrayRef> tracks = adoptCF(AVCFAssetCopyAssetTracks(avAsset(m_avfWrapper)));
     CFIndex trackCount = CFArrayGetCount(tracks.get());
     for (CFIndex i = 0; i < trackCount; i++) {
         AVCFAssetTrackRef assetTrack = (AVCFAssetTrackRef)CFArrayGetValueAtIndex(tracks.get(), i);
@@ -734,7 +734,7 @@ static HashSet<String> mimeTypeCache()
         return cache;
     typeListInitialized = true;
     
-    RetainPtr<CFArrayRef> supportedTypes(AdoptCF, AVCFURLAssetCopyAudiovisualMIMETypes());
+    RetainPtr<CFArrayRef> supportedTypes = adoptCF(AVCFURLAssetCopyAudiovisualMIMETypes());
     
     ASSERT(supportedTypes);
     if (!supportedTypes)
@@ -787,27 +787,27 @@ void MediaPlayerPrivateAVFoundationCF::tracksChanged()
     if (!avPlayerItem(m_avfWrapper)) {
         // We don't have a player item yet, so check with the asset because some assets support inspection
         // prior to becoming ready to play.
-        RetainPtr<CFArrayRef> visualTracks(AdoptCF, AVCFAssetCopyTracksWithMediaCharacteristic(avAsset(m_avfWrapper), AVCFMediaCharacteristicVisual));
+        RetainPtr<CFArrayRef> visualTracks = adoptCF(AVCFAssetCopyTracksWithMediaCharacteristic(avAsset(m_avfWrapper), AVCFMediaCharacteristicVisual));
         setHasVideo(CFArrayGetCount(visualTracks.get()));
 
-        RetainPtr<CFArrayRef> audioTracks(AdoptCF, AVCFAssetCopyTracksWithMediaCharacteristic(avAsset(m_avfWrapper), AVCFMediaCharacteristicAudible));
+        RetainPtr<CFArrayRef> audioTracks = adoptCF(AVCFAssetCopyTracksWithMediaCharacteristic(avAsset(m_avfWrapper), AVCFMediaCharacteristicAudible));
         setHasAudio(CFArrayGetCount(audioTracks.get()));
 
-        RetainPtr<CFArrayRef> captionTracks(AdoptCF, AVCFAssetCopyTracksWithMediaType(avAsset(m_avfWrapper), AVCFMediaTypeClosedCaption));
+        RetainPtr<CFArrayRef> captionTracks = adoptCF(AVCFAssetCopyTracksWithMediaType(avAsset(m_avfWrapper), AVCFMediaTypeClosedCaption));
         setHasAudio(CFArrayGetCount(captionTracks.get()));
     } else {
         bool hasVideo = false;
         bool hasAudio = false;
         bool hasCaptions = false;
 
-        RetainPtr<CFArrayRef> tracks(AdoptCF, AVCFPlayerItemCopyTracks(avPlayerItem(m_avfWrapper)));
+        RetainPtr<CFArrayRef> tracks = adoptCF(AVCFPlayerItemCopyTracks(avPlayerItem(m_avfWrapper)));
 
         CFIndex trackCount = CFArrayGetCount(tracks.get());
         for (CFIndex i = 0; i < trackCount; i++) {
             AVCFPlayerItemTrackRef track = (AVCFPlayerItemTrackRef)(CFArrayGetValueAtIndex(tracks.get(), i));
             
             if (AVCFPlayerItemTrackIsEnabled(track)) {
-                RetainPtr<AVCFAssetTrackRef> assetTrack(AdoptCF, AVCFPlayerItemTrackCopyAssetTrack(track));
+                RetainPtr<AVCFAssetTrackRef> assetTrack = adoptCF(AVCFPlayerItemTrackCopyAssetTrack(track));
                 CFStringRef mediaType = AVCFAssetTrackGetMediaType(assetTrack.get());
                 if (!mediaType)
                     continue;
@@ -840,7 +840,7 @@ void MediaPlayerPrivateAVFoundationCF::sizeChanged()
     // AVAsset's 'naturalSize' property only considers the movie's first video track, so we need to compute
     // the union of all visual track rects.
     CGRect trackRectUnion = CGRectZero;
-    RetainPtr<CFArrayRef> tracks(AdoptCF, AVCFAssetCopyTracksWithMediaType(avAsset(m_avfWrapper), AVCFMediaCharacteristicVisual));
+    RetainPtr<CFArrayRef> tracks = adoptCF(AVCFAssetCopyTracksWithMediaType(avAsset(m_avfWrapper), AVCFMediaCharacteristicVisual));
     CFIndex trackCount = CFArrayGetCount(tracks.get());
     for (CFIndex i = 0; i < trackCount; i++) {
         AVCFAssetTrackRef assetTrack = (AVCFAssetTrackRef)(CFArrayGetValueAtIndex(tracks.get(), i));
@@ -983,17 +983,17 @@ void AVFWrapper::createAssetForURL(const String& url)
 {
     ASSERT(!avAsset());
 
-    RetainPtr<CFURLRef> urlRef(AdoptCF, KURL(ParsedURLString, url).createCFURL());
+    RetainPtr<CFURLRef> urlRef = adoptCF(KURL(ParsedURLString, url).createCFURL());
 
     AVCFURLAssetRef assetRef = AVCFURLAssetCreateWithURLAndOptions(kCFAllocatorDefault, urlRef.get(), 0, m_notificationQueue);
-    m_avAsset.adoptCF(assetRef);
+    m_avAsset = adoptCF(assetRef);
 }
 
 void AVFWrapper::createPlayer(IDirect3DDevice9* d3dDevice)
 {
     ASSERT(!avPlayer() && avPlayerItem());
 
-    RetainPtr<CFMutableDictionaryRef> optionsRef(AdoptCF, CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+    RetainPtr<CFMutableDictionaryRef> optionsRef = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
     if (d3dDevice) {
         // QI for an IDirect3DDevice9Ex interface, it is required to do HW video decoding.
@@ -1007,7 +1007,7 @@ void AVFWrapper::createPlayer(IDirect3DDevice9* d3dDevice)
 
     // FIXME: We need a way to create a AVPlayer without an AVPlayerItem, see <rdar://problem/9877730>.
     AVCFPlayerRef playerRef = AVCFPlayerCreateWithPlayerItemAndOptions(kCFAllocatorDefault, avPlayerItem(), optionsRef.get(), m_notificationQueue);
-    m_avPlayer.adoptCF(playerRef);
+    m_avPlayer = adoptCF(playerRef);
 
     if (m_d3dDevice && AVCFPlayerSetDirect3DDevicePtr())
         AVCFPlayerSetDirect3DDevicePtr()(playerRef, m_d3dDevice.get());
@@ -1020,7 +1020,7 @@ void AVFWrapper::createPlayer(IDirect3DDevice9* d3dDevice)
     // Add a time observer, ask to be called infrequently because we don't really want periodic callbacks but
     // our observer will also be called whenever a seek happens.
     const double veryLongInterval = 60*60*60*24*30;
-    m_timeObserver.adoptCF(AVCFPlayerCreatePeriodicTimeObserverForInterval(playerRef, CMTimeMake(veryLongInterval, 10), m_notificationQueue, &periodicTimeObserverCallback, callbackContext()));
+    m_timeObserver = adoptCF(AVCFPlayerCreatePeriodicTimeObserverForInterval(playerRef, CMTimeMake(veryLongInterval, 10), m_notificationQueue, &periodicTimeObserverCallback, callbackContext()));
 }
 
 void AVFWrapper::createPlayerItem()
@@ -1029,7 +1029,7 @@ void AVFWrapper::createPlayerItem()
 
     // Create the player item so we begin loading media data.
     AVCFPlayerItemRef itemRef = AVCFPlayerItemCreateWithAsset(kCFAllocatorDefault, avAsset(), m_notificationQueue);
-    m_avPlayerItem.adoptCF(itemRef);
+    m_avPlayerItem = adoptCF(itemRef);
 
     CFNotificationCenterRef center = CFNotificationCenterGetLocalCenter();
     ASSERT(center);
@@ -1178,7 +1178,7 @@ void AVFWrapper::setAsset(AVCFURLAssetRef asset)
         return;
 
     AVCFAssetCancelLoading(avAsset());
-    m_avAsset.adoptCF(asset);
+    m_avAsset = adoptCF(asset);
 }
 
 PlatformLayer* AVFWrapper::platformLayer()
@@ -1199,7 +1199,7 @@ PlatformLayer* AVFWrapper::platformLayer()
         return 0;
 
     CACFLayerRef layerRef = AVCFPlayerLayerCopyCACFLayer(m_avCFVideoLayer.get());
-    m_caVideoLayer.adoptCF(layerRef);
+    m_caVideoLayer = adoptCF(layerRef);
 
     CACFLayerInsertSublayer(m_videoLayerWrapper->platformLayer(), m_caVideoLayer.get(), 0);
     m_videoLayerWrapper->setAnchorPoint(FloatPoint3D());
@@ -1214,7 +1214,7 @@ void AVFWrapper::createAVCFVideoLayer()
         return;
 
     // The layer will get hooked up via RenderLayerBacking::updateGraphicsLayerConfiguration().
-    m_avCFVideoLayer.adoptCF(AVCFPlayerLayerCreateWithAVCFPlayer(kCFAllocatorDefault, avPlayer(), m_notificationQueue));
+    m_avCFVideoLayer = adoptCF(AVCFPlayerLayerCreateWithAVCFPlayer(kCFAllocatorDefault, avPlayer(), m_notificationQueue));
     LOG(Media, "AVFWrapper::createAVCFVideoLayer(%p) - returning %p", this, videoLayer());
 }
 
@@ -1248,7 +1248,7 @@ void AVFWrapper::createImageGenerator()
     if (!avAsset() || m_imageGenerator)
         return;
 
-    m_imageGenerator.adoptCF(AVCFAssetImageGeneratorCreateWithAsset(kCFAllocatorDefault, avAsset()));
+    m_imageGenerator = adoptCF(AVCFAssetImageGeneratorCreateWithAsset(kCFAllocatorDefault, avAsset()));
 
     AVCFAssetImageGeneratorSetApertureMode(m_imageGenerator.get(), AVCFAssetImageGeneratorApertureModeCleanAperture);
     AVCFAssetImageGeneratorSetRequestedTimeToleranceBefore(m_imageGenerator.get(), kCMTimeZero);
index edb3142..9baf396 100644 (file)
@@ -170,7 +170,7 @@ AtomicString InbandTextTrackPrivateLegacyAVFObjC::language() const
         return emptyAtom;
 
     NSString *languageCode = [[m_playerItemTrack assetTrack] languageCode];
-    RetainPtr<NSLocale> locale(AdoptNS, [[NSLocale alloc] initWithLocaleIdentifier:languageCode]);
+    RetainPtr<NSLocale> locale = adoptNS([[NSLocale alloc] initWithLocaleIdentifier:languageCode]);
     return [locale localeIdentifier];
 }
 
index 0be55a3..ce05440 100644 (file)
@@ -127,7 +127,7 @@ static RetainPtr<CACFTimingFunctionRef> toCACFTimingFunction(const TimingFunctio
     ASSERT(timingFunction);
     if (timingFunction->isCubicBezierTimingFunction()) {
         const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(timingFunction);
-        return RetainPtr<CACFTimingFunctionRef>(AdoptCF, CACFTimingFunctionCreate(static_cast<float>(ctf->x1()), static_cast<float>(ctf->y1()), static_cast<float>(ctf->x2()), static_cast<float>(ctf->y2())));
+        return adoptCF(CACFTimingFunctionCreate(static_cast<float>(ctf->x1()), static_cast<float>(ctf->y1()), static_cast<float>(ctf->x2()), static_cast<float>(ctf->y2())));
     }
     
     return CACFTimingFunctionGetFunctionWithName(kCACFTimingFunctionLinear);
@@ -147,9 +147,9 @@ PlatformCAAnimation::PlatformCAAnimation(AnimationType type, const String& keyPa
     : m_type(type)
 {
     if (type == Basic)
-        m_animation.adoptCF(CACFAnimationCreate(kCACFBasicAnimation));
+        m_animation = adoptCF(CACFAnimationCreate(kCACFBasicAnimation));
     else
-        m_animation.adoptCF(CACFAnimationCreate(kCACFKeyframeAnimation));
+        m_animation = adoptCF(CACFAnimationCreate(kCACFKeyframeAnimation));
     
     CACFAnimationSetKeyPath(m_animation.get(), keyPath.createCFString().get());
 }
@@ -337,7 +337,7 @@ void PlatformCAAnimation::setFromValue(float value)
     if (animationType() != Basic)
         return;
 
-    RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value));
+    RetainPtr<CFNumberRef> v = adoptCF(CFNumberCreate(0, kCFNumberFloatType, &value));
     CACFAnimationSetFromValue(m_animation.get(), v.get());
 }
 
@@ -346,7 +346,7 @@ void PlatformCAAnimation::setFromValue(const WebCore::TransformationMatrix& valu
     if (animationType() != Basic)
         return;
     
-    RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreateTransform(value));
+    RetainPtr<CACFVectorRef> v = adoptCF(CACFVectorCreateTransform(value));
     CACFAnimationSetFromValue(m_animation.get(), v.get());
 }
 
@@ -356,7 +356,7 @@ void PlatformCAAnimation::setFromValue(const FloatPoint3D& value)
         return;
 
     float a[3] = { value.x(), value.y(), value.z() };
-    RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(3, a));
+    RetainPtr<CACFVectorRef> v = adoptCF(CACFVectorCreate(3, a));
     CACFAnimationSetFromValue(m_animation.get(), v.get());
 }
 
@@ -366,7 +366,7 @@ void PlatformCAAnimation::setFromValue(const WebCore::Color& value)
         return;
 
     float a[4] = { value.red(), value.green(), value.blue(), value.alpha() };
-    RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(4, a));
+    RetainPtr<CACFVectorRef> v = adoptCF(CACFVectorCreate(4, a));
     CACFAnimationSetFromValue(m_animation.get(), v.get());
 }
 
@@ -390,7 +390,7 @@ void PlatformCAAnimation::setToValue(float value)
     if (animationType() != Basic)
         return;
 
-    RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value));
+    RetainPtr<CFNumberRef> v = adoptCF(CFNumberCreate(0, kCFNumberFloatType, &value));
     CACFAnimationSetToValue(m_animation.get(), v.get());
 }
 
@@ -399,7 +399,7 @@ void PlatformCAAnimation::setToValue(const WebCore::TransformationMatrix& value)
     if (animationType() != Basic)
         return;
 
-    RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreateTransform(value));
+    RetainPtr<CACFVectorRef> v = adoptCF(CACFVectorCreateTransform(value));
     CACFAnimationSetToValue(m_animation.get(), v.get());
 }
 
@@ -409,7 +409,7 @@ void PlatformCAAnimation::setToValue(const FloatPoint3D& value)
         return;
 
     float a[3] = { value.x(), value.y(), value.z() };
-    RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(3, a));
+    RetainPtr<CACFVectorRef> v = adoptCF(CACFVectorCreate(3, a));
     CACFAnimationSetToValue(m_animation.get(), v.get());
 }
 
@@ -419,7 +419,7 @@ void PlatformCAAnimation::setToValue(const WebCore::Color& value)
         return;
 
     float a[4] = { value.red(), value.green(), value.blue(), value.alpha() };
-    RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(4, a));
+    RetainPtr<CACFVectorRef> v = adoptCF(CACFVectorCreate(4, a));
     CACFAnimationSetToValue(m_animation.get(), v.get());
 }
 
@@ -445,9 +445,9 @@ void PlatformCAAnimation::setValues(const Vector<float>& value)
     if (animationType() != Keyframe)
         return;
 
-    RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
+    RetainPtr<CFMutableArrayRef> array = adoptCF(CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
     for (size_t i = 0; i < value.size(); ++i) {
-        RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value[i]));
+        RetainPtr<CFNumberRef> v = adoptCF(CFNumberCreate(0, kCFNumberFloatType, &value[i]));
         CFArrayAppendValue(array.get(), v.get());
     }
 
@@ -459,9 +459,9 @@ void PlatformCAAnimation::setValues(const Vector<WebCore::TransformationMatrix>&
     if (animationType() != Keyframe)
         return;
 
-    RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
+    RetainPtr<CFMutableArrayRef> array = adoptCF(CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
     for (size_t i = 0; i < value.size(); ++i) {
-        RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreateTransform(value[i]));
+        RetainPtr<CACFVectorRef> v = adoptCF(CACFVectorCreateTransform(value[i]));
         CFArrayAppendValue(array.get(), v.get());
     }
 
@@ -473,10 +473,10 @@ void PlatformCAAnimation::setValues(const Vector<FloatPoint3D>& value)
     if (animationType() != Keyframe)
         return;
         
-    RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
+    RetainPtr<CFMutableArrayRef> array = adoptCF(CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
     for (size_t i = 0; i < value.size(); ++i) {
         float a[3] = { value[i].x(), value[i].y(), value[i].z() };
-        RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(3, a));
+        RetainPtr<CACFVectorRef> v = adoptCF(CACFVectorCreate(3, a));
         CFArrayAppendValue(array.get(), v.get());
     }
 
@@ -488,10 +488,10 @@ void PlatformCAAnimation::setValues(const Vector<WebCore::Color>& value)
     if (animationType() != Keyframe)
         return;
         
-    RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
+    RetainPtr<CFMutableArrayRef> array = adoptCF(CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
     for (size_t i = 0; i < value.size(); ++i) {
         float a[4] = { value[i].red(), value[i].green(), value[i].blue(), value[i].alpha() };
-        RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(4, a));
+        RetainPtr<CACFVectorRef> v = adoptCF(CACFVectorCreate(4, a));
         CFArrayAppendValue(array.get(), v.get());
     }
 
@@ -518,9 +518,9 @@ void PlatformCAAnimation::setKeyTimes(const Vector<float>& value)
     if (animationType() != Keyframe)
         return;
         
-    RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
+    RetainPtr<CFMutableArrayRef> array = adoptCF(CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
     for (size_t i = 0; i < value.size(); ++i) {
-        RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value[i]));
+        RetainPtr<CFNumberRef> v = adoptCF(CFNumberCreate(0, kCFNumberFloatType, &value[i]));
         CFArrayAppendValue(array.get(), v.get());
     }
 
@@ -541,9 +541,9 @@ void PlatformCAAnimation::setTimingFunctions(const Vector<const TimingFunction*>
     if (animationType() != Keyframe)
         return;
 
-    RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
+    RetainPtr<CFMutableArrayRef> array = adoptCF(CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks));
     for (size_t i = 0; i < value.size(); ++i) {
-        RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value[i]));
+        RetainPtr<CFNumberRef> v = adoptCF(CFNumberCreate(0, kCFNumberFloatType, &value[i]));
         CFArrayAppendValue(array.get(), toCACFTimingFunction(value[i]).get());
     }
 
index 19cfdfa..688649e 100644 (file)
@@ -116,7 +116,7 @@ PlatformCALayer::PlatformCALayer(LayerType layerType, PlatformLayer* layer, Plat
         m_layer = layer;
     } else {
         m_layerType = layerType;
-        m_layer.adoptCF(CACFLayerCreate(toCACFLayerType(layerType)));
+        m_layer = adoptCF(CACFLayerCreate(toCACFLayerType(layerType)));
 
         // Create the PlatformCALayerWinInternal object and point to it in the userdata.
         PlatformCALayerWinInternal* intern = new PlatformCALayerWinInternal(this);
@@ -540,8 +540,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));
 
     CACFLayerSetBackgroundColor(m_layer.get(), color.get());
     setNeedsCommit();
@@ -568,8 +568,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));
 
     CACFLayerSetBorderColor(m_layer.get(), color.get());
     setNeedsCommit();
index 15275b3..6d21fa8 100644 (file)
@@ -51,7 +51,7 @@ PlatformCALayerWinInternal::PlatformCALayerWinInternal(PlatformCALayer* owner)
 {
     if (m_owner->layerType() == PlatformCALayer::LayerTypeWebTiledLayer) {
         // Tiled layers are placed in a child layer that is always the first child of the TiledLayer
-        m_tileParent.adoptCF(CACFLayerCreate(kCACFLayer));
+        m_tileParent = adoptCF(CACFLayerCreate(kCACFLayer));
         CACFLayerInsertSublayer(m_owner->platformLayer(), m_tileParent.get(), 0);
         updateTiles();
     }
@@ -384,7 +384,7 @@ void PlatformCALayerWinInternal::tileDisplayCallback(CACFLayerRef layer, CGConte
 
 void PlatformCALayerWinInternal::addTile()
 {
-    RetainPtr<CACFLayerRef> newLayer(AdoptCF, CACFLayerCreate(kCACFLayer));
+    RetainPtr<CACFLayerRef> newLayer = adoptCF(CACFLayerCreate(kCACFLayer));
     CACFLayerSetAnchorPoint(newLayer.get(), CGPointMake(0, 1));
     CACFLayerSetUserData(newLayer.get(), this);
     CACFLayerSetDisplayCallback(newLayer.get(), tileDisplayCallback);
index d945c3e..2f64ab1 100644 (file)
@@ -72,7 +72,7 @@ PassRefPtr<WKCACFViewLayerTreeHost> WKCACFViewLayerTreeHost::create()
 }
 
 WKCACFViewLayerTreeHost::WKCACFViewLayerTreeHost()
-    : m_view(AdoptCF, WKCACFViewCreate(kWKCACFViewDrawingDestinationWindow))
+    : m_view(adoptCF(WKCACFViewCreate(kWKCACFViewDrawingDestinationWindow)))
     , m_viewNeedsUpdate(true)
 {
 }
index 952fb7f..a34ab78 100644 (file)
@@ -28,7 +28,7 @@ using namespace WebCore;
 
 PlatformVideoWindow::PlatformVideoWindow()
 {
-    m_window.adoptNS([[NSView alloc] init]);
+    m_window = adoptNS([[NSView alloc] init]);
     m_videoWindowId = reinterpret_cast<unsigned long>(m_window.get());
 }
 
index ec426c1..246bb35 100644 (file)
@@ -64,7 +64,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, b
 
     HFONT hfont = CreateFontIndirect(&logFont);
 
-    RetainPtr<CGFontRef> cgFont(AdoptCF, CGFontCreateWithPlatformFont(&logFont));
+    RetainPtr<CGFontRef> cgFont = adoptCF(CGFontCreateWithPlatformFont(&logFont));
     return FontPlatformData(hfont, cgFont.get(), size, bold, italic, renderingMode == AlternateRenderingMode);
 }
 
index d8070eb..4d71f37 100644 (file)
@@ -88,14 +88,14 @@ static CFStringRef getPostScriptName(CFStringRef faceName, HDC dc)
             // Pass Big Endian as the encoding.
             if (bufferSize < stringsOffset + nameOffset + length)
                 return NULL;
-            result.adoptCF(CFStringCreateWithBytes(NULL, strings + nameOffset, length, kCFStringEncodingUTF16BE, false));
+            result = adoptCF(CFStringCreateWithBytes(NULL, strings + nameOffset, length, kCFStringEncodingUTF16BE, false));
             break;
         } else if (platformID == 1 && encodingID == 0 && languageID == 0 && nameID == 6) {
             // This is a Mac PostScript name and is therefore ASCII.
             // See http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html
             if (bufferSize < stringsOffset + nameOffset + length)
                 return NULL;
-            result.adoptCF(CFStringCreateWithBytes(NULL, strings + nameOffset, length, kCFStringEncodingASCII, false));
+            result = adoptCF(CFStringCreateWithBytes(NULL, strings + nameOffset, length, kCFStringEncodingASCII, false));
             break;
         }
 
@@ -111,7 +111,7 @@ void FontPlatformData::platformDataInit(HFONT font, float size, HDC hdc, WCHAR*
 {
     LOGFONT logfont;
     GetObject(font, sizeof(logfont), &logfont);
-    m_cgFont.adoptCF(CGFontCreateWithPlatformFont(&logfont));
+    m_cgFont = adoptCF(CGFontCreateWithPlatformFont(&logfont));
 }
 
 FontPlatformData::FontPlatformData(HFONT hfont, CGFontRef font, float size, bool bold, bool oblique, bool useGDI)
index 063f7cb..90b0cfc 100644 (file)
@@ -122,9 +122,9 @@ void GraphicsContext::drawWindowsBitmap(WindowsBitmap* image, const IntPoint& po
 {
     // FIXME: Creating CFData is non-optimal, but needed to avoid crashing when printing.  Ideally we should 
     // make a custom CGDataProvider that controls the WindowsBitmap lifetime.  see <rdar://6394455>
-    RetainPtr<CFDataRef> imageData(AdoptCF, CFDataCreate(kCFAllocatorDefault, image->buffer(), image->bufferLength()));
-    RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(imageData.get()));
-    RetainPtr<CGImageRef> cgImage(AdoptCF, CGImageCreate(image->size().width(), image->size().height(), 8, 32, image->bytesPerRow(), deviceRGBColorSpaceRef(),
+    RetainPtr<CFDataRef> imageData = adoptCF(CFDataCreate(kCFAllocatorDefault, image->buffer(), image->bufferLength()));
+    RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData(imageData.get()));
+    RetainPtr<CGImageRef> cgImage = adoptCF(CGImageCreate(image->size().width(), image->size().height(), 8, 32, image->bytesPerRow(), deviceRGBColorSpaceRef(),
                                                          kCGBitmapByteOrder32Little | kCGImageAlphaFirst, dataProvider.get(), 0, true, kCGRenderingIntentDefault));
     CGContextDrawImage(m_data->m_cgContext.get(), CGRectMake(point.x(), point.y(), image->size().width(), image->size().height()), cgImage.get());   
 }
index 8007511..7d0ef8e 100644 (file)
@@ -50,7 +50,7 @@ PassRefPtr<BitmapImage> BitmapImage::create(HBITMAP hBitmap)
     if (!dibSection.dsBm.bmBits)
         return 0;
 
-    RetainPtr<CGContextRef> bitmapContext(AdoptCF, CGBitmapContextCreate(dibSection.dsBm.bmBits, dibSection.dsBm.bmWidth, dibSection.dsBm.bmHeight, 8,
+    RetainPtr<CGContextRef> bitmapContext = adoptCF(CGBitmapContextCreate(dibSection.dsBm.bmBits, dibSection.dsBm.bmWidth, dibSection.dsBm.bmHeight, 8,
         dibSection.dsBm.bmWidthBytes, deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
 
     // The BitmapImage takes ownership of this.
index f6e6cbe..2d60d21 100644 (file)
@@ -120,7 +120,7 @@ void MediaPlayerPrivateFullscreenWindow::setRootChildLayer(PassRefPtr<PlatformCA
     m_rootChild->setFrame(rootBounds);
     m_rootChild->setBackgroundColor(CGColorGetConstantColor(kCGColorBlack));
 #ifndef NDEBUG
-    RetainPtr<CGColorRef> redColor(AdoptCF, CGColorCreateGenericRGB(1, 0, 0, 1));
+    RetainPtr<CGColorRef> redColor = adoptCF(CGColorCreateGenericRGB(1, 0, 0, 1));
     rootLayer->setBackgroundColor(redColor.get());
 #else
     rootLayer->setBackgroundColor(CGColorGetConstantColor(kCGColorBlack));
index dd9a310..3ff65c7 100644 (file)
@@ -235,7 +235,7 @@ String MediaPlayerPrivateQuickTimeVisualContext::rfc2616DateStringFromTime(CFAbs
     time = CFGregorianDateGetAbsoluteTime(dateValue, gmtTimeZone);
     SInt32 day = CFAbsoluteTimeGetDayOfWeek(time, 0);
 
-    RetainPtr<CFStringRef> dateCFString(AdoptCF, CFStringCreateWithFormat(0, 0, dateFormatString, dayStrings[day - 1], dateValue.day, 
+    RetainPtr<CFStringRef> dateCFString = adoptCF(CFStringCreateWithFormat(0, 0, dateFormatString, dayStrings[day - 1], dateValue.day, 
         monthStrings[dateValue.month - 1], dateValue.year, dateValue.hour, dateValue.minute, (int)dateValue.second));
     return dateCFString.get();
 }
@@ -799,7 +799,7 @@ void MediaPlayerPrivateQuickTimeVisualContext::visualContextTimerFired(Timer<Med
 
 static CFDictionaryRef QTCFDictionaryCreateWithDataCallback(CFAllocatorRef allocator, const UInt8* bytes, CFIndex length)
 {
-    RetainPtr<CFDataRef> data(AdoptCF, CFDataCreateWithBytesNoCopy(allocator, bytes, length, kCFAllocatorNull));
+    RetainPtr<CFDataRef> data = adoptCF(CFDataCreateWithBytesNoCopy(allocator, bytes, length, kCFAllocatorNull));
     if (!data)
         return 0;
 
@@ -890,7 +890,7 @@ void MediaPlayerPrivateQuickTimeVisualContext::retrieveCurrentImage()
                 // CAImageQueue without being converted to a non-Debug CFDictionary.  Additionally,
                 // old versions of QuickTime used a non-AAS CoreFoundation, so the types are not 
                 // interchangable even in the release case.
-                RetainPtr<CFDictionaryRef> attachments(AdoptCF, QTCFDictionaryCreateCopyWithDataCallback(kCFAllocatorDefault, buffer.attachments(), &QTCFDictionaryCreateWithDataCallback));
+                RetainPtr<CFDictionaryRef> attachments = adoptCF(QTCFDictionaryCreateCopyWithDataCallback(kCFAllocatorDefault, buffer.attachments(), &QTCFDictionaryCreateWithDataCallback));
                 CFTimeInterval imageTime = QTMovieVisualContext::currentHostTime();
 
                 m_imageQueue->collect();
index 2bf0259..ef8a1c5 100644 (file)
@@ -56,7 +56,7 @@ static void WKCAImageQueueRelease(CAImageQueueRef iq)
 WKCAImageQueue::WKCAImageQueue(uint32_t width, uint32_t height, uint32_t capacity)
     : m_private(adoptPtr(new WKCAImageQueuePrivate()))
 {
-    m_private->m_imageQueue.adoptCF(wkCAImageQueueCreate(width, height, capacity));
+    m_private->m_imageQueue = adoptCF(wkCAImageQueueCreate(width, height, capacity));
 }
 
 WKCAImageQueue::WKCAImageQueue(const WKCAImageQueue& o)
index a32f8c9..fc337af 100644 (file)
@@ -308,7 +308,7 @@ namespace WebCore {
                 qcmsInitialized = true;
                 // FIXME: Add optional ICCv4 support.
 #if OS(DARWIN)
-                RetainPtr<CGColorSpaceRef> monitorColorSpace(AdoptCF, CGDisplayCopyColorSpace(CGMainDisplayID()));
+                RetainPtr<CGColorSpaceRef> monitorColorSpace = adoptCF(CGDisplayCopyColorSpace(CGMainDisplayID()));
                 CFDataRef iccProfile(CGColorSpaceCopyICCProfile(monitorColorSpace.get()));
                 if (iccProfile) {
                     size_t length = CFDataGetLength(iccProfile);
index 9caa890..0300a40 100644 (file)
@@ -216,7 +216,7 @@ Credential core(CFURLCredentialRef cfCredential)
         return Credential(identity, CFURLCredentialGetCertificateArray(cfCredential), persistence);
 #endif
 
-    RetainPtr<CFStringRef> password(AdoptCF, CFURLCredentialCopyPassword(cfCredential));
+    RetainPtr<CFStringRef> password = adoptCF(CFURLCredentialCopyPassword(cfCredential));
     return Credential(CFURLCredentialGetUsername(cfCredential), password.get(), persistence);
 }
 
index 9a1980a..28472e7 100644 (file)
@@ -48,7 +48,7 @@ static const CFStringRef s_cookieCF = CFSTR("Cookie");
 
 static inline RetainPtr<CFStringRef> cookieDomain(CFHTTPCookieRef cookie)
 {
-    return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyDomain(cookie));
+    return adoptCF(CFHTTPCookieCopyDomain(cookie));
 }
 
 static inline CFAbsoluteTime cookieExpirationTime(CFHTTPCookieRef cookie)
@@ -58,23 +58,23 @@ static inline CFAbsoluteTime cookieExpirationTime(CFHTTPCookieRef cookie)
 
 static inline RetainPtr<CFStringRef> cookieName(CFHTTPCookieRef cookie)
 {
-    return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyName(cookie));
+    return adoptCF(CFHTTPCookieCopyName(cookie));
 }
 
 static inline RetainPtr<CFStringRef> cookiePath(CFHTTPCookieRef cookie)
 {
-    return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyPath(cookie));
+    return adoptCF(CFHTTPCookieCopyPath(cookie));
 }
 
 static inline RetainPtr<CFStringRef> cookieValue(CFHTTPCookieRef cookie)
 {
-    return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyValue(cookie));
+    return adoptCF(CFHTTPCookieCopyValue(cookie));
 }
 
 static RetainPtr<CFArrayRef> filterCookies(CFArrayRef unfilteredCookies)
 {
     CFIndex count = CFArrayGetCount(unfilteredCookies);
-    RetainPtr<CFMutableArrayRef> filteredCookies(AdoptCF, CFArrayCreateMutable(0, count, &kCFTypeArrayCallBacks));
+    RetainPtr<CFMutableArrayRef> filteredCookies = adoptCF(CFArrayCreateMutable(0, count, &kCFTypeArrayCallBacks));
     for (CFIndex i = 0; i < count; ++i) {
         CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(unfilteredCookies, i);
 
@@ -99,19 +99,19 @@ void setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstPa
     if (value.isEmpty())
         return;
 
-    RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
-    RetainPtr<CFURLRef> firstPartyForCookiesCF(AdoptCF, firstParty.createCFURL());
+    RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());
+    RetainPtr<CFURLRef> firstPartyForCookiesCF = adoptCF(firstParty.createCFURL());
 
     // <http://bugs.webkit.org/show_bug.cgi?id=6531>, <rdar://4409034>
     // cookiesWithResponseHeaderFields doesn't parse cookies without a value
     String cookieString = value.contains('=') ? value : value + "=";
 
     RetainPtr<CFStringRef> cookieStringCF = cookieString.createCFString();
-    RetainPtr<CFDictionaryRef> headerFieldsCF(AdoptCF, CFDictionaryCreate(kCFAllocatorDefault,
+    RetainPtr<CFDictionaryRef> headerFieldsCF = adoptCF(CFDictionaryCreate(kCFAllocatorDefault,
         (const void**)&s_setCookieKeyCF, (const void**)&cookieStringCF, 1,
         &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
-    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault,
+    RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieCreateWithResponseHeaderFields(kCFAllocatorDefault,
         headerFieldsCF.get(), urlCF.get()));
 
     CFHTTPCookieStorageSetCookies(session.cookieStorage().get(), filterCookies(cookiesCF.get()).get(), urlCF.get(), firstPartyForCookiesCF.get());
@@ -119,21 +119,21 @@ void setCookiesFromDOM(const NetworkStorageSession& session, const KURL& firstPa
 
 String cookiesForDOM(const NetworkStorageSession& session, const KURL&, const KURL& url)
 {
-    RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
+    RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());
 
     bool secure = url.protocolIs("https");
-    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure));
-    RetainPtr<CFDictionaryRef> headerCF(AdoptCF, CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, filterCookies(cookiesCF.get()).get()));
+    RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure));
+    RetainPtr<CFDictionaryRef> headerCF = adoptCF(CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, filterCookies(cookiesCF.get()).get()));
     return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
 }
 
 String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& url)
 {
-    RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
+    RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());
 
     bool secure = url.protocolIs("https");
-    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure));
-    RetainPtr<CFDictionaryRef> headerCF(AdoptCF, CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, cookiesCF.get()));
+    RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure));
+    RetainPtr<CFDictionaryRef> headerCF = adoptCF(CFHTTPCookieCopyRequestHeaderFields(kCFAllocatorDefault, cookiesCF.get()));
     return (CFStringRef)CFDictionaryGetValue(headerCF.get(), s_cookieCF);
 }
 
@@ -147,10 +147,10 @@ bool getRawCookies(const NetworkStorageSession& session, const KURL& /*firstPart
 {
     rawCookies.clear();
 
-    RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
+    RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());
 
     bool sendSecureCookies = url.protocolIs("https");
-    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), sendSecureCookies));
+    RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), sendSecureCookies));
 
     CFIndex count = CFArrayGetCount(cookiesCF.get());
     rawCookies.reserveCapacity(count);
@@ -178,10 +178,10 @@ void deleteCookie(const NetworkStorageSession& session, const KURL& url, const S
 {
     RetainPtr<CFHTTPCookieStorageRef> cookieStorage = session.cookieStorage();
 
-    RetainPtr<CFURLRef> urlCF(AdoptCF, url.createCFURL());
+    RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());
 
     bool sendSecureCookies = url.protocolIs("https");
-    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookiesForURL(cookieStorage.get(), urlCF.get(), sendSecureCookies));
+    RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(cookieStorage.get(), urlCF.get(), sendSecureCookies));
 
     CFIndex count = CFArrayGetCount(cookiesCF.get());
     for (CFIndex i = 0; i < count; i++) {
@@ -195,7 +195,7 @@ void deleteCookie(const NetworkStorageSession& session, const KURL& url, const S
 
 void getHostnamesWithCookies(const NetworkStorageSession& session, HashSet<String>& hostnames)
 {
-    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookies(session.cookieStorage().get()));
+    RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookies(session.cookieStorage().get()));
     if (!cookiesCF)
         return;
 
@@ -211,7 +211,7 @@ void deleteCookiesForHostname(const NetworkStorageSession& session, const String
 {
     RetainPtr<CFHTTPCookieStorageRef> cookieStorage = session.cookieStorage();
 
-    RetainPtr<CFArrayRef> cookiesCF(AdoptCF, CFHTTPCookieStorageCopyCookies(cookieStorage.get()));
+    RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookies(cookieStorage.get()));
     if (!cookiesCF)
         return;
 
index 86124eb..2b26677 100644 (file)
@@ -69,7 +69,7 @@ static CString certificatePath()
 #if USE(CF)
     CFBundleRef webKitBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit"));
     if (webKitBundle) {
-        RetainPtr<CFURLRef> certURLRef(AdoptCF, CFBundleCopyResourceURL(webKitBundle, CFSTR("cacert"), CFSTR("pem"), CFSTR("certificates")));
+        RetainPtr<CFURLRef> certURLRef = adoptCF(CFBundleCopyResourceURL(webKitBundle, CFSTR("cacert"), CFSTR("pem"), CFSTR("certificates")));
         if (certURLRef) {
             char path[MAX_PATH];
             CFURLGetFileSystemRepresentation(certURLRef.get(), false, reinterpret_cast<UInt8*>(path), MAX_PATH);
index b34c3fb..30d16e8 100644 (file)
@@ -60,7 +60,7 @@ static bool urlFromPath(CFStringRef path, String& url)
     if (!path)
         return false;
 
-    RetainPtr<CFURLRef> cfURL(AdoptCF, CFURLCreateWithFileSystemPath(0, path, kCFURLWindowsPathStyle, false));
+    RetainPtr<CFURLRef> cfURL = adoptCF(CFURLCreateWithFileSystemPath(0, path, kCFURLWindowsPathStyle, false));
     if (!cfURL)
         return false;
 
@@ -481,7 +481,7 @@ String getURL(IDataObject* dataObject, DragData::FilenameConversionPolicy filena
             // file using unicode
             wchar_t* data = static_cast<wchar_t*>(GlobalLock(store.hGlobal));
             if (data && data[0] && (PathFileExists(data) || PathIsUNC(data))) {
-                RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar*)data, wcslen(data)));
+                RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar*)data, wcslen(data)));
                 if (urlFromPath(pathAsCFString.get(), url) && title)
                     *title = url;
             }
@@ -491,7 +491,7 @@ String getURL(IDataObject* dataObject, DragData::FilenameConversionPolicy filena
             // filename using ascii
             char* data = static_cast<char*>(GlobalLock(store.hGlobal));
             if (data && data[0] && (PathFileExistsA(data) || PathIsUNCA(data))) {
-                RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, data, kCFStringEncodingASCII));
+                RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, data, kCFStringEncodingASCII));
                 if (urlFromPath(pathAsCFString.get(), url) && title)
                     *title = url;
             }
@@ -523,7 +523,7 @@ String getURL(const DragDataMap* data, DragData::FilenameConversionPolicy filena
 
     if (stringData.isEmpty() || (!PathFileExists(stringData.charactersWithNullTermination()) && !PathIsUNC(stringData.charactersWithNullTermination())))
         return url;
-    RetainPtr<CFStringRef> pathAsCFString(AdoptCF, CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar *)stringData.charactersWithNullTermination(), wcslen(stringData.charactersWithNullTermination())));
+    RetainPtr<CFStringRef> pathAsCFString = adoptCF(CFStringCreateWithCharacters(kCFAllocatorDefault, (const UniChar *)stringData.charactersWithNullTermination(), wcslen(stringData.charactersWithNullTermination())));
     if (urlFromPath(pathAsCFString.get(), url) && title)
         *title = url;
 #endif
index cc2f5c2..e6ea9b7 100644 (file)
@@ -54,10 +54,10 @@ static CFBundleRef createWebKitBundle()
     ASSERT(length);
     ASSERT(length < WTF_ARRAY_LENGTH(dllPathBuffer));
 
-    RetainPtr<CFStringRef> dllPath(AdoptCF, CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(dllPathBuffer), length, kCFAllocatorNull));
-    RetainPtr<CFURLRef> dllURL(AdoptCF, CFURLCreateWithFileSystemPath(0, dllPath.get(), kCFURLWindowsPathStyle, false));
-    RetainPtr<CFURLRef> dllDirectoryURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(0, dllURL.get()));
-    RetainPtr<CFURLRef> resourcesDirectoryURL(AdoptCF, CFURLCreateCopyAppendingPathComponent(0, dllDirectoryURL.get(), CFSTR("WebKit.resources"), true));
+    RetainPtr<CFStringRef> dllPath = adoptCF(CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(dllPathBuffer), length, kCFAllocatorNull));
+    RetainPtr<CFURLRef> dllURL = adoptCF(CFURLCreateWithFileSystemPath(0, dllPath.get(), kCFURLWindowsPathStyle, false));
+    RetainPtr<CFURLRef> dllDirectoryURL = adoptCF(CFURLCreateCopyDeletingLastPathComponent(0, dllURL.get()));
+    RetainPtr<CFURLRef> resourcesDirectoryURL = adoptCF(CFURLCreateCopyAppendingPathComponent(0, dllDirectoryURL.get(), CFSTR("WebKit.resources"), true));
 
     return CFBundleCreate(0, resourcesDirectoryURL.get());
 }
@@ -78,8 +78,8 @@ String localizedString(const char* key)
 #if USE(CF)
     static CFStringRef notFound = CFSTR("localized string not found");
 
-    RetainPtr<CFStringRef> keyString(AdoptCF, CFStringCreateWithCStringNoCopy(NULL, key, kCFStringEncodingUTF8, kCFAllocatorNull));
-    RetainPtr<CFStringRef> result(AdoptCF, CFCopyLocalizedStringWithDefaultValue(keyString.get(), 0, webKitBundle(), notFound, 0));
+    RetainPtr<CFStringRef> keyString = adoptCF(CFStringCreateWithCStringNoCopy(NULL, key, kCFStringEncodingUTF8, kCFAllocatorNull));
+    RetainPtr<CFStringRef> result = adoptCF(CFCopyLocalizedStringWithDefaultValue(keyString.get(), 0, webKitBundle(), notFound, 0));
     ASSERT_WITH_MESSAGE(result.get() != notFound, "could not find localizable string %s in bundle", key);
 
     return result.get();
index 0d251df..74c305a 100644 (file)
@@ -65,7 +65,7 @@ void SearchPopupMenuWin::saveRecentSearches(const AtomicString& name, const Vect
 
     size_t size = searchItems.size();
     if (size) {
-        items.adoptCF(CFArrayCreateMutable(0, size, &kCFTypeArrayCallBacks));
+        items = adoptCF(CFArrayCreateMutable(0, size, &kCFTypeArrayCallBacks));
         for (size_t i = 0; i < size; ++i)
             CFArrayAppendValue(items.get(), searchItems[i].createCFString().get());
     }
@@ -82,7 +82,7 @@ void SearchPopupMenuWin::loadRecentSearches(const AtomicString& name, Vector<Str
 
 #if USE(CF)
     searchItems.clear();
-    RetainPtr<CFArrayRef> items(AdoptCF, reinterpret_cast<CFArrayRef>(CFPreferencesCopyAppValue(autosaveKey(name).get(), kCFPreferencesCurrentApplication)));
+    RetainPtr<CFArrayRef> items = adoptCF(reinterpret_cast<CFArrayRef>(CFPreferencesCopyAppValue(autosaveKey(name).get(), kCFPreferencesCurrentApplication)));
 
     if (!items || CFGetTypeID(items.get()) != CFArrayGetTypeID())
         return;
index fead89b..6b6c417 100644 (file)
@@ -119,7 +119,7 @@ static Vector<String> stringListFromResourceId(SInt16 id)
 
     for (SInt16 i = 0; i < count; ++i) {
         unsigned char length = *p;
-        WTF::RetainPtr<CFStringRef> str(AdoptCF, CFStringCreateWithPascalString(0, p, encoding));
+        WTF::RetainPtr<CFStringRef> str = adoptCF(CFStringCreateWithPascalString(0, p, encoding));
         list.append(str.get());
         p += 1 + length;
     }
@@ -139,7 +139,7 @@ bool PluginPackage::fetchInfo()
 
         WTF::RetainPtr<CFStringRef> fileName = (CFStringRef)mimeTypesFileName.get();
         WTF::RetainPtr<CFStringRef> homeDir = adoptCF(homeDirectoryPath().createCFString());
-        WTF::RetainPtr<CFStringRef> path(AdoptCF, CFStringCreateWithFormat(0, 0, CFSTR("%@/Library/Preferences/%@"), homeDir.get(), fileName.get()));
+        WTF::RetainPtr<CFStringRef> path = adoptCF(CFStringCreateWithFormat(0, 0, CFSTR("%@/Library/Preferences/%@"), homeDir.get(), fileName.get()));
 
         WTF::RetainPtr<CFDictionaryRef> plist = readPListFile(path.get(), /*createFile*/ false, m_module);
         if (plist) {
@@ -255,8 +255,8 @@ bool PluginPackage::load()
         return true;
     }
 
-    WTF::RetainPtr<CFStringRef> path(AdoptCF, m_path.createCFString());
-    WTF::RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(),
+    WTF::RetainPtr<CFStringRef> path = adoptCF(m_path.createCFString());
+    WTF::RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(),
                                                                         kCFURLPOSIXPathStyle, false));
     m_module = CFBundleCreate(NULL, url.get());
     if (!m_module || !CFBundleLoadExecutable(m_module)) {
index bdc3854..42fa579 100644 (file)
@@ -853,7 +853,7 @@ void PluginView::handleKeyboardEvent(KeyboardEvent* event)
             return;
         }
         
-        WTF::RetainPtr<CFStringRef> cfText(WTF::AdoptCF, text.createCFString());
+        WTF::RetainPtr<CFStringRef> cfText = adoptCF(text.createCFString());
         
         LOG(Plugins, "PV::hKE(): PKE.text: %s, PKE.unmodifiedText: %s, PKE.keyIdentifier: %s",
             text.ascii().data(), platformEvent->unmodifiedText().ascii().data(),
index f301eac..8aaf9ab 100644 (file)
@@ -170,7 +170,7 @@ Color RenderThemeSafari::platformFocusRingColor() const
 
     if (!focusRingColor.isValid()) {
         if (STCopyThemeColorPtr()) {
-            RetainPtr<CGColorRef> color(AdoptCF, STCopyThemeColorPtr()(stFocusRingColorID, SafariTheme::ActiveState));
+            RetainPtr<CGColorRef> color = adoptCF(STCopyThemeColorPtr()(stFocusRingColorID, SafariTheme::ActiveState));
             focusRingColor = makeRGBAFromCGColor(color.get());
         }
         if (!focusRingColor.isValid())
@@ -760,21 +760,21 @@ void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const Pain
 
     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));
     paintInfo.context->save();
     CGContextClipToRect(context, bound.rect());
     paintInfo.context->clipRoundedRect(bound);
@@ -974,12 +974,12 @@ bool RenderThemeSafari::paintSliderTrack(RenderObject* o, const PaintInfo& paint
     CGContextClipToRect(context, bounds.rect());
 
     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.rect().x(),  bounds.rect().maxY()), CGPointMake(bounds.rect().maxX(), bounds.rect().maxY()), mainFunction.get(), false, false));
+        mainShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.rect().x(),  bounds.rect().maxY()), CGPointMake(bounds.rect().maxX(), bounds.rect().maxY()), mainFunction.get(), false, false));
     else
-        mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.rect().x(),  bounds.rect().y()), CGPointMake(bounds.rect().x(), bounds.rect().maxY()), mainFunction.get(), false, false));
+        mainShading = adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.rect().x(),  bounds.rect().y()), CGPointMake(bounds.rect().x(), bounds.rect().maxY()), mainFunction.get(), false, false));
 
     paintInfo.context->clipRoundedRect(bounds);
     CGContextDrawShading(context, mainShading.get());
index f4fb5b3..c22311f 100644 (file)
@@ -178,7 +178,7 @@ HRESULT STDMETHODCALLTYPE CFDictionaryPropertyBag::Write(LPCOLESTR pszPropName,
     if (!pszPropName || !pVar)
         return E_POINTER;
     if (!m_dictionary) {
-        m_dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+        m_dictionary = adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
     }
     void* cfObj;
     if (ConvertVariantToCFType(pVar, &cfObj)) {
index 32c28f8..364e877 100644 (file)
@@ -1,3 +1,66 @@
+2013-05-06  Darin Adler  <darin@apple.com>
+
+        Use adoptCF and adoptNS in more places
+        https://bugs.webkit.org/show_bug.cgi?id=115657
+
+        Reviewed by Sam Weinig.
+
+        This is similar to my last set of changes, but covers code that I missed with
+        global replace using the Safari Xcode workspace.
+
+        * CFDictionaryPropertyBag.cpp:
+        (CFDictionaryPropertyBag::Write):
+        * WebCache.cpp:
+        (WebCache::statistics):
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::dispatchDidFailToStartPlugin):
+        * WebCoreSupport/WebInspectorClient.cpp:
+        (WebInspectorClient::openInspectorFrontend):
+        (WebInspectorFrontendClient::localizedStringsURL):
+        * WebDatabaseManager.cpp:
+        (WebDatabaseManager::dispatchDidModifyDatabase):
+        * WebDownloadCFNet.cpp:
+        (WebDownload::init):
+        (WebDownload::initWithRequest):
+        (WebDownload::initToResumeWithBundle):
+        (WebDownload::cancelForResume):
+        (WebDownload::useCredential):
+        (WebDownload::didReceiveAuthenticationChallenge):
+        * WebError.cpp:
+        (WebError::sslPeerCertificate):
+        * WebHistory.cpp:
+        (createUserInfoFromArray):
+        (createUserInfoFromHistoryItem):
+        (WebHistory::WebHistory):
+        (WebHistory::loadFromURL):
+        (WebHistory::loadHistoryGutsFromURL):
+        (WebHistory::saveToURL):
+        (WebHistory::saveHistoryGuts):
+        (WebHistory::removeAllItems):
+        (WebHistory::removeItem):
+        (WebHistory::addItem):
+        (WebHistory::itemForURL):
+        (WebHistory::addItemToDateCaches):
+        (getDayBoundaries):
+        * WebIconDatabase.cpp:
+        (postDidAddIconNotification):
+        * WebLocalizableStrings.cpp:
+        (cfBundleForStringsBundle):
+        * WebMutableURLRequest.cpp:
+        (WebMutableURLRequest::mutableCopy):
+        * WebPreferences.cpp:
+        (cfNumber):
+        (WebPreferences::initializeDefaultSettings):
+        (WebPreferences::valueForKey):
+        (WebPreferences::setStringValue):
+        (WebPreferences::load):
+        (WebPreferences::migrateWebKitPreferencesToCFPreferences):
+        (WebPreferences::setPreferenceForTest):
+        * WebView.cpp:
+        (WebView::setCacheModel):
+        (WebView::notifyPreferencesChanged):
+        Use adoptCF and adoptNS.
+
 2013-05-06  Roger Fong  <roger_fong@apple.com>
 
         Unreviewed. AppleWin build fix.
index 6b9b317..3115ed8 100644 (file)
@@ -107,89 +107,88 @@ HRESULT STDMETHODCALLTYPE WebCache::statistics(
     const int zero = 0;
 #endif
 
-    RetainPtr<CFMutableDictionaryRef> dictionary(AdoptCF,
-        CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+    RetainPtr<CFMutableDictionaryRef> dictionary = adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
-    RetainPtr<CFNumberRef> value(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &stat.images.count));
+    RetainPtr<CFNumberRef> value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.images.count));
     CFDictionaryAddValue(dictionary.get(), imagesKey, value.get());
     
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.cssStyleSheets.count));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.cssStyleSheets.count));
     CFDictionaryAddValue(dictionary.get(), stylesheetsKey, value.get());
     
 #if ENABLE(XSLT)
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.xslStyleSheets.count));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.xslStyleSheets.count));
 #else
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &zero));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &zero));
 #endif
     CFDictionaryAddValue(dictionary.get(), xslKey, value.get());
 
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.count));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.count));
     CFDictionaryAddValue(dictionary.get(), scriptsKey, value.get());
 
     COMPtr<CFDictionaryPropertyBag> propBag = CFDictionaryPropertyBag::createInstance();
     propBag->setDictionary(dictionary.get());
     s[0] = propBag.leakRef();
 
-    dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+    dictionary = adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.images.size));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.images.size));
     CFDictionaryAddValue(dictionary.get(), imagesKey, value.get());
     
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.cssStyleSheets.size));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.cssStyleSheets.size));
     CFDictionaryAddValue(dictionary.get(), stylesheetsKey, value.get());
     
 #if ENABLE(XSLT)
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.xslStyleSheets.size));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.xslStyleSheets.size));
 #else
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &zero));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &zero));
 #endif
     CFDictionaryAddValue(dictionary.get(), xslKey, value.get());
 
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.size));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.size));
     CFDictionaryAddValue(dictionary.get(), scriptsKey, value.get());
 
     propBag = CFDictionaryPropertyBag::createInstance();
     propBag->setDictionary(dictionary.get());
     s[1] = propBag.leakRef();
 
-    dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+    dictionary = adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.images.liveSize));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.images.liveSize));
     CFDictionaryAddValue(dictionary.get(), imagesKey, value.get());
     
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.cssStyleSheets.liveSize));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.cssStyleSheets.liveSize));
     CFDictionaryAddValue(dictionary.get(), stylesheetsKey, value.get());
     
 #if ENABLE(XSLT)
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.xslStyleSheets.liveSize));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.xslStyleSheets.liveSize));
 #else
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &zero));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &zero));
 #endif
     CFDictionaryAddValue(dictionary.get(), xslKey, value.get());
 
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.liveSize));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.liveSize));
     CFDictionaryAddValue(dictionary.get(), scriptsKey, value.get());
 
     propBag = CFDictionaryPropertyBag::createInstance();
     propBag->setDictionary(dictionary.get());
     s[2] = propBag.leakRef();
 
-    dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+    dictionary = adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.images.decodedSize));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.images.decodedSize));
     CFDictionaryAddValue(dictionary.get(), imagesKey, value.get());
     
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.cssStyleSheets.decodedSize));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.cssStyleSheets.decodedSize));
     CFDictionaryAddValue(dictionary.get(), stylesheetsKey, value.get());
     
 #if ENABLE(XSLT)
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.xslStyleSheets.decodedSize));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.xslStyleSheets.decodedSize));
 #else
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &zero));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &zero));
 #endif
     CFDictionaryAddValue(dictionary.get(), xslKey, value.get());
 
-    value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.decodedSize));
+    value = adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.decodedSize));
     CFDictionaryAddValue(dictionary.get(), scriptsKey, value.get());
 
     propBag = CFDictionaryPropertyBag::createInstance();
index 1332e4e..5f52cf0 100644 (file)
@@ -784,7 +784,7 @@ void WebFrameLoaderClient::dispatchDidFailToStartPlugin(const PluginView* plugin
     if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate)))
         return;
 
-    RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+    RetainPtr<CFMutableDictionaryRef> userInfo = adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
     Frame* frame = core(m_webFrame);
     ASSERT(frame == pluginView->parentFrame());
index 5f6e828..44d642b 100644 (file)
@@ -162,7 +162,7 @@ WebCore::InspectorFrontendChannel* WebInspectorClient::openInspectorFrontend(Ins
 
     COMPtr<WebMutableURLRequest> request(AdoptCOM, WebMutableURLRequest::createInstance());
 
-    RetainPtr<CFURLRef> htmlURLRef(AdoptCF, CFBundleCopyResourceURL(getWebKitBundle(), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector")));
+    RetainPtr<CFURLRef> htmlURLRef = adoptCF(CFBundleCopyResourceURL(getWebKitBundle(), CFSTR("inspector"), CFSTR("html"), CFSTR("inspector")));
     if (!htmlURLRef)
         return 0;
 
@@ -262,7 +262,7 @@ void WebInspectorFrontendClient::frontendLoaded()
 
 String WebInspectorFrontendClient::localizedStringsURL()
 {
-    RetainPtr<CFURLRef> url(AdoptCF, CFBundleCopyResourceURL(getWebKitBundle(), CFSTR("localizedStrings"), CFSTR("js"), 0));
+    RetainPtr<CFURLRef> url = adoptCF(CFBundleCopyResourceURL(getWebKitBundle(), CFSTR("localizedStrings"), CFSTR("js"), 0));
     if (!url)
         return String();
 
index cfd124c..3427cfb 100644 (file)
@@ -398,7 +398,7 @@ void WebDatabaseManager::dispatchDidModifyDatabase(SecurityOrigin* origin, const
 
     COMPtr<WebSecurityOrigin> securityOrigin(AdoptCOM, WebSecurityOrigin::createInstance(origin));
 
-    RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+    RetainPtr<CFMutableDictionaryRef> userInfo = adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
     static CFStringRef databaseNameKey = MarshallingHelpers::LPCOLESTRToCFStringRef(WebDatabaseNameKey);
     CFDictionarySetValue(userInfo.get(), databaseNameKey, databaseName.createCFString().get());
index e9d7f02..7df9bf6 100644 (file)
@@ -84,7 +84,7 @@ void WebDownload::init(ResourceHandle* handle, const ResourceRequest& request, c
         decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback};
 
     m_request.adoptRef(WebMutableURLRequest::createInstance(request));
-    m_download.adoptCF(CFURLDownloadCreateAndStartWithLoadingConnection(0, connection, request.cfURLRequest(UpdateHTTPBody), response.cfURLResponse(), &client));
+    m_download = adoptCF(CFURLDownloadCreateAndStartWithLoadingConnection(0, connection, request.cfURLRequest(UpdateHTTPBody), response.cfURLResponse(), &client));
 
     // It is possible for CFURLDownloadCreateAndStartWithLoadingConnection() to fail if the passed in CFURLConnection is not in a "downloadable state"
     // However, we should never hit that case
@@ -113,7 +113,7 @@ void WebDownload::init(const KURL& url, IWebDownloadDelegate* delegate)
                                   didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, 
                                   decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback};
     m_request.adoptRef(WebMutableURLRequest::createInstance(request));
-    m_download.adoptCF(CFURLDownloadCreate(0, cfRequest, &client));
+    m_download = adoptCF(CFURLDownloadCreate(0, cfRequest, &client));
 
     CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get());
     CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), loaderRunLoop(), kCFRunLoopDefaultMode);
@@ -144,7 +144,7 @@ HRESULT STDMETHODCALLTYPE WebDownload::initWithRequest(
                                   didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, 
                                   decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback};
     m_request.adoptRef(WebMutableURLRequest::createInstance(webRequest.get()));
-    m_download.adoptCF(CFURLDownloadCreate(0, cfRequest.get(), &client));
+    m_download = adoptCF(CFURLDownloadCreate(0, cfRequest.get(), &client));
 
     // If for some reason the download failed to create, 
     // we have particular cleanup to do
@@ -166,7 +166,7 @@ HRESULT STDMETHODCALLTYPE WebDownload::initToResumeWithBundle(
 {
     LOG(Download, "Attempting resume of download bundle %s", String(bundlePath, SysStringLen(bundlePath)).ascii().data());
 
-    RetainPtr<CFDataRef> resumeData(AdoptCF, DownloadBundle::extractResumeData(String(bundlePath, SysStringLen(bundlePath))));
+    RetainPtr<CFDataRef> resumeData = adoptCF(DownloadBundle::extractResumeData(String(bundlePath, SysStringLen(bundlePath))));
 
     if (!resumeData)
         return E_FAIL;
@@ -180,10 +180,10 @@ HRESULT STDMETHODCALLTYPE WebDownload::initToResumeWithBundle(
                                   didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, 
                                   decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback};
     
-    RetainPtr<CFURLRef> pathURL(AdoptCF, MarshallingHelpers::PathStringToFileCFURLRef(String(bundlePath, SysStringLen(bundlePath))));
+    RetainPtr<CFURLRef> pathURL = adoptCF(MarshallingHelpers::PathStringToFileCFURLRef(String(bundlePath, SysStringLen(bundlePath))));
     ASSERT(pathURL);
 
-    m_download.adoptCF(CFURLDownloadCreateWithResumeData(0, resumeData.get(), pathURL.get(), &client));
+    m_download = adoptCF(CFURLDownloadCreateWithResumeData(0, resumeData.get(), pathURL.get(), &client));
 
     if (!m_download) {
         LOG(Download, "Failed to create CFURLDownloadRef for resume");    
@@ -248,7 +248,7 @@ HRESULT STDMETHODCALLTYPE WebDownload::cancelForResume()
     CFURLDownloadSetDeletesUponFailure(m_download.get(), false);
     CFURLDownloadCancel(m_download.get());
 
-    resumeData.adoptCF(CFURLDownloadCopyResumeData(m_download.get()));
+    resumeData = adoptCF(CFURLDownloadCopyResumeData(m_download.get()));
     if (!resumeData) {
         LOG(Download, "WebDownload - Unable to create resume data for download (%p)", this);
         goto exit;
@@ -340,7 +340,7 @@ HRESULT STDMETHODCALLTYPE WebDownload::useCredential(
     if (!webCredential)
         return E_NOINTERFACE;
 
-    RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(webCredential->credential()));
+    RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(webCredential->credential()));
 
     if (m_download)
         CFURLDownloadUseCredential(m_download.get(), cfCredential.get(), webChallenge->authenticationChallenge().cfURLAuthChallengeRef());
@@ -384,7 +384,7 @@ void WebDownload::didReceiveAuthenticationChallenge(CFURLAuthChallengeRef challe
     if (!CFURLAuthChallengeGetPreviousFailureCount(challenge)) {
         Credential credential = CredentialStorage::get(core(CFURLAuthChallengeGetProtectionSpace(challenge)));
         if (!credential.isEmpty()) {
-            RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(credential));
+            RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(credential));
             CFURLDownloadUseCredential(m_download.get(), cfCredential.get(), challenge);
             return;
         }
index 16006ff..6e2b1da 100644 (file)
@@ -219,7 +219,7 @@ HRESULT STDMETHODCALLTYPE WebError::sslPeerCertificate(
     if (!m_cfErrorUserInfoDict) {
         // copy userinfo from CFErrorRef
         CFErrorRef cfError = m_error;
-        m_cfErrorUserInfoDict.adoptCF(CFErrorCopyUserInfo(cfError));
+        m_cfErrorUserInfoDict = adoptCF(CFErrorCopyUserInfo(cfError));
     }
 
     if (!m_cfErrorUserInfoDict)
index 939e648..79e7a53 100644 (file)
@@ -97,10 +97,10 @@ static bool areEqualOrClose(double d1, double d2)
 
 static COMPtr<CFDictionaryPropertyBag> createUserInfoFromArray(BSTR notificationStr, CFArrayRef arrayItem)
 {
-    RetainPtr<CFMutableDictionaryRef> dictionary(AdoptCF, 
+    RetainPtr<CFMutableDictionaryRef> dictionary = adoptCF(
         CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
-    RetainPtr<CFStringRef> key(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(notificationStr));
+    RetainPtr<CFStringRef> key = adoptCF(MarshallingHelpers::BSTRToCFStringRef(notificationStr));
     CFDictionaryAddValue(dictionary.get(), key.get(), arrayItem);
 
     COMPtr<CFDictionaryPropertyBag> result = CFDictionaryPropertyBag::createInstance();
@@ -111,7 +111,7 @@ static COMPtr<CFDictionaryPropertyBag> createUserInfoFromArray(BSTR notification
 static COMPtr<CFDictionaryPropertyBag> createUserInfoFromHistoryItem(BSTR notificationStr, IWebHistoryItem* item)
 {
     // reference counting of item added to the array is managed by the CFArray value callbacks
-    RetainPtr<CFArrayRef> itemList(AdoptCF, CFArrayCreate(0, (const void**) &item, 1, &MarshallingHelpers::kIUnknownArrayCallBacks));
+    RetainPtr<CFArrayRef> itemList = adoptCF(CFArrayCreate(0, (const void**) &item, 1, &MarshallingHelpers::kIUnknownArrayCallBacks));
     COMPtr<CFDictionaryPropertyBag> info = createUserInfoFromArray(notificationStr, itemList.get());
     return info;
 }
@@ -125,7 +125,7 @@ WebHistory::WebHistory()
     gClassCount++;
     gClassNameCount.add("WebHistory");
 
-    m_entriesByURL.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &MarshallingHelpers::kIUnknownDictionaryValueCallBacks));
+    m_entriesByURL = adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &MarshallingHelpers::kIUnknownDictionaryValueCallBacks));
 
     m_preferences = WebPreferences::sharedStandardPreferences();
 }
@@ -240,10 +240,10 @@ HRESULT STDMETHODCALLTYPE WebHistory::loadFromURL(
     /* [retval][out] */ BOOL* succeeded)
 {
     HRESULT hr = S_OK;
-    RetainPtr<CFMutableArrayRef> discardedItems(AdoptCF, 
+    RetainPtr<CFMutableArrayRef> discardedItems = adoptCF(
         CFArrayCreateMutable(0, 0, &MarshallingHelpers::kIUnknownArrayCallBacks));
 
-    RetainPtr<CFURLRef> urlRef(AdoptCF, MarshallingHelpers::BSTRToCFURLRef(url));
+    RetainPtr<CFURLRef> urlRef = adoptCF(MarshallingHelpers::BSTRToCFURLRef(url));
 
     hr = loadHistoryGutsFromURL(urlRef.get(), discardedItems.get(), error);
     if (FAILED(hr))
@@ -277,14 +277,14 @@ HRESULT WebHistory::loadHistoryGutsFromURL(CFURLRef url, CFMutableArrayRef disca
     HRESULT hr = S_OK;
     int numberOfItemsLoaded = 0;
 
-    RetainPtr<CFReadStreamRef> stream(AdoptCF, CFReadStreamCreateWithFile(0, url));
+    RetainPtr<CFReadStreamRef> stream = adoptCF(CFReadStreamCreateWithFile(0, url));
     if (!stream) 
         return E_FAIL;
 
     if (!CFReadStreamOpen(stream.get())) 
         return E_FAIL;
 
-    RetainPtr<CFDictionaryRef> historyList(AdoptCF, createHistoryListFromStream(stream.get(), format));
+    RetainPtr<CFDictionaryRef> historyList = adoptCF(createHistoryListFromStream(stream.get(), format));
     CFReadStreamClose(stream.get());
 
     if (!historyList) 
@@ -359,7 +359,7 @@ HRESULT STDMETHODCALLTYPE WebHistory::saveToURL(
     /* [retval][out] */ BOOL* succeeded)
 {
     HRESULT hr = S_OK;
-    RetainPtr<CFURLRef> urlRef(AdoptCF, MarshallingHelpers::BSTRToCFURLRef(url));
+    RetainPtr<CFURLRef> urlRef = adoptCF(MarshallingHelpers::BSTRToCFURLRef(url));
 
     hr = saveHistoryGuts(urlRef.get(), error);
 
@@ -384,7 +384,7 @@ HRESULT WebHistory::saveHistoryGuts(CFURLRef url, IWebError** error)
     if (!data.get())
         return E_FAIL;
 
-    RetainPtr<CFWriteStreamRef> stream(AdoptCF, CFWriteStreamCreateWithFile(kCFAllocatorDefault, url));
+    RetainPtr<CFWriteStreamRef> stream = adoptCF(CFWriteStreamCreateWithFile(kCFAllocatorDefault, url));
     if (!stream) 
         return E_FAIL;
 
@@ -451,7 +451,7 @@ HRESULT STDMETHODCALLTYPE WebHistory::removeAllItems( void)
     CFIndex itemCount = CFDictionaryGetCount(m_entriesByURL.get());
     Vector<IWebHistoryItem*> itemsVector(itemCount);
     CFDictionaryGetKeysAndValues(m_entriesByURL.get(), 0, (const void**)itemsVector.data());
-    RetainPtr<CFArrayRef> allItems(AdoptCF, CFArrayCreate(kCFAllocatorDefault, (const void**)itemsVector.data(), itemCount, &MarshallingHelpers::kIUnknownArrayCallBacks));
+    RetainPtr<CFArrayRef> allItems = adoptCF(CFArrayCreate(kCFAllocatorDefault, (const void**)itemsVector.data(), itemCount, &MarshallingHelpers::kIUnknownArrayCallBacks));
 
     CFDictionaryRemoveAllValues(m_entriesByURL.get());
 
@@ -622,7 +622,7 @@ HRESULT WebHistory::removeItem(IWebHistoryItem* entry)
     if (FAILED(hr))
         return hr;
 
-    RetainPtr<CFStringRef> urlString(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(urlBStr));
+    RetainPtr<CFStringRef> urlString = adoptCF(MarshallingHelpers::BSTRToCFStringRef(urlBStr));
 
     // If this exact object isn't stored, then make no change.
     // FIXME: Is this the right behavior if this entry isn't present, but another entry for the same URL is?
@@ -654,7 +654,7 @@ HRESULT WebHistory::addItem(IWebHistoryItem* entry, bool discardDuplicate, bool*
     if (FAILED(hr))
         return hr;
 
-    RetainPtr<CFStringRef> urlString(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(urlBStr));
+    RetainPtr<CFStringRef> urlString = adoptCF(MarshallingHelpers::BSTRToCFStringRef(urlBStr));
 
     COMPtr<IWebHistoryItem> oldEntry((IWebHistoryItem*) CFDictionaryGetValue(
         m_entriesByURL.get(), urlString.get()));
@@ -768,7 +768,7 @@ HRESULT STDMETHODCALLTYPE WebHistory::itemForURL(
     /* [in] */ BSTR url,
     /* [retval][out] */ IWebHistoryItem** item)
 {
-    RetainPtr<CFStringRef> urlString(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(url));
+    RetainPtr<CFStringRef> urlString = adoptCF(MarshallingHelpers::BSTRToCFStringRef(url));
     return itemForURLString(urlString.get(), item);
 }
 
@@ -811,7 +811,7 @@ HRESULT WebHistory::addItemToDateCaches(IWebHistoryItem* entry)
     } else {
         ASSERT(!m_entriesByDate.contains(dateKey));
         // no other entries exist for this date
-        RetainPtr<CFMutableArrayRef> entryArray(AdoptCF, 
+        RetainPtr<CFMutableArrayRef> entryArray = adoptCF(
             CFArrayCreateMutable(0, 0, &MarshallingHelpers::kIUnknownArrayCallBacks));
         CFArrayAppendValue(entryArray.get(), entry);
         m_entriesByDate.set(dateKey, entryArray);
@@ -855,7 +855,7 @@ HRESULT WebHistory::removeItemFromDateCaches(IWebHistoryItem* entry)
 
 static void getDayBoundaries(CFAbsoluteTime day, CFAbsoluteTime& beginningOfDay, CFAbsoluteTime& beginningOfNextDay)
 {
-    RetainPtr<CFTimeZoneRef> timeZone(AdoptCF, CFTimeZoneCopyDefault());
+    RetainPtr<CFTimeZoneRef> timeZone = adoptCF(CFTimeZoneCopyDefault());
     CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(day, timeZone.get());
     date.hour = 0;
     date.minute = 0;
index 6dc78e8..316a358 100644 (file)
@@ -384,7 +384,7 @@ static void postDidRemoveAllIconsNotification(WebIconDatabase* iconDB)
 
 static void postDidAddIconNotification(const String& pageURL, WebIconDatabase* iconDB)
 {
-    RetainPtr<CFMutableDictionaryRef> dictionary(AdoptCF, 
+    RetainPtr<CFMutableDictionaryRef> dictionary = adoptCF(
     CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
     CFDictionaryAddValue(dictionary.get(), WebIconDatabase::iconDatabaseNotificationUserInfoURLKey(), pageURL.createCFString().get());
index dfb714b..43f9b70 100644 (file)
@@ -154,7 +154,7 @@ static CFBundleRef cfBundleForStringsBundle(WebLocalizableStringsBundle* strings
     createWebKitBundle();
 
     if (!stringsBundle->bundle)
-        stringsBundle->bundle = CFBundleGetBundleWithIdentifier(RetainPtr<CFStringRef>(AdoptCF, CFStringCreateWithCString(0, stringsBundle->identifier, kCFStringEncodingASCII)).get());
+        stringsBundle->bundle = CFBundleGetBundleWithIdentifier(adoptCF(CFStringCreateWithCString(0, stringsBundle->identifier, kCFStringEncodingASCII)).get());
     return stringsBundle->bundle;
 }
 
index fb90e9f..5fbcb08 100644 (file)
@@ -376,7 +376,7 @@ HRESULT STDMETHODCALLTYPE WebMutableURLRequest::mutableCopy(
         return E_POINTER;
 
 #if USE(CFNETWORK)
-    RetainPtr<CFMutableURLRequestRef> mutableRequest(AdoptCF, CFURLRequestCreateMutableCopy(kCFAllocatorDefault, m_request.cfURLRequest(UpdateHTTPBody)));
+    RetainPtr<CFMutableURLRequestRef> mutableRequest = adoptCF(CFURLRequestCreateMutableCopy(kCFAllocatorDefault, m_request.cfURLRequest(UpdateHTTPBody)));
     *result = createInstance(ResourceRequest(mutableRequest.get()));
     return S_OK;
 #else
index ff26b48..6844faf 100644 (file)
@@ -89,7 +89,7 @@ static NumberType numberValueForPreferencesValue(CFPropertyListRef value)
 template<typename NumberType>
 static RetainPtr<CFNumberRef> cfNumber(NumberType value)
 {
-    return RetainPtr<CFNumberRef>(AdoptCF, CFNumberCreate(0, CFNumberTraits<NumberType>::Type, &value));
+    return adoptCF(CFNumberCreate(0, CFNumberTraits<NumberType>::Type, &value));
 }
 
 static bool booleanValueForPreferencesValue(CFPropertyListRef value)
@@ -233,7 +233,7 @@ void WebPreferences::initializeDefaultSettings()
     CFDictionaryAddValue(defaults, CFSTR(WebKitShouldDisplayCaptionsPreferenceKey), kCFBooleanFalse);
     CFDictionaryAddValue(defaults, CFSTR(WebKitShouldDisplayTextDescriptionsPreferenceKey), kCFBooleanFalse);
 
-    RetainPtr<CFStringRef> linkBehaviorStringRef(AdoptCF, CFStringCreateWithFormat(0, 0, CFSTR("%d"), WebKitEditableLinkDefaultBehavior));
+    RetainPtr<CFStringRef> linkBehaviorStringRef = adoptCF(CFStringCreateWithFormat(0, 0, CFSTR("%d"), WebKitEditableLinkDefaultBehavior));
     CFDictionaryAddValue(defaults, CFSTR(WebKitEditableLinkBehaviorPreferenceKey), linkBehaviorStringRef.get());
 
     CFDictionaryAddValue(defaults, CFSTR(WebKitHistoryItemLimitKey), CFSTR("1000"));
@@ -249,7 +249,7 @@ void WebPreferences::initializeDefaultSettings()
     CFDictionaryAddValue(defaults, CFSTR(WebKitUsesPageCachePreferenceKey), kCFBooleanTrue);
     CFDictionaryAddValue(defaults, CFSTR(WebKitLocalStorageDatabasePathPreferenceKey), CFSTR(""));
 
-    RetainPtr<CFStringRef> cacheModelRef(AdoptCF, CFStringCreateWithFormat(0, 0, CFSTR("%d"), WebCacheModelDocumentViewer));
+    RetainPtr<CFStringRef> cacheModelRef = adoptCF(CFStringCreateWithFormat(0, 0, CFSTR("%d"), WebCacheModelDocumentViewer));
     CFDictionaryAddValue(defaults, CFSTR(WebKitCacheModelPreferenceKey), cacheModelRef.get());
 
     CFDictionaryAddValue(defaults, CFSTR(WebKitAuthorAndUserStylesEnabledPreferenceKey), kCFBooleanTrue);
@@ -284,7 +284,7 @@ RetainPtr<CFPropertyListRef> WebPreferences::valueForKey(CFStringRef key)
     if (value)
         return value;
 
-    value.adoptCF(CFPreferencesCopyAppValue(key, kCFPreferencesCurrentApplication));
+    value = adoptCF(CFPreferencesCopyAppValue(key, kCFPreferencesCurrentApplication));
     if (value)
         return value;
 
@@ -354,8 +354,7 @@ void WebPreferences::setStringValue(CFStringRef key, LPCTSTR value)
     if (val && !wcscmp(val, value))
         return;
     
-    RetainPtr<CFStringRef> valueRef(AdoptCF,
-        CFStringCreateWithCharactersNoCopy(0, (UniChar*)_wcsdup(value), (CFIndex)wcslen(value), kCFAllocatorMalloc));
+    RetainPtr<CFStringRef> valueRef = adoptCF(CFStringCreateWithCharactersNoCopy(0, (UniChar*)_wcsdup(value), (CFIndex)wcslen(value), kCFAllocatorMalloc));
     setValueForKey(key, valueRef.get());
 
     postPreferencesChangesNotification();
@@ -422,7 +421,7 @@ void WebPreferences::load()
 {
     initializeDefaultSettings();
 
-    m_privatePrefs.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+    m_privatePrefs = adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
     migrateWebKitPreferencesToCFPreferences();
 }
@@ -439,11 +438,11 @@ void WebPreferences::migrateWebKitPreferencesToCFPreferences()
 
     WTF::CString path = oldPreferencesPath().utf8();
 
-    RetainPtr<CFURLRef> urlRef(AdoptCF, CFURLCreateFromFileSystemRepresentation(0, reinterpret_cast<const UInt8*>(path.data()), path.length(), false));
+    RetainPtr<CFURLRef> urlRef = adoptCF(CFURLCreateFromFileSystemRepresentation(0, reinterpret_cast<const UInt8*>(path.data()), path.length(), false));
     if (!urlRef)
         return;
 
-    RetainPtr<CFReadStreamRef> stream(AdoptCF, CFReadStreamCreateWithFile(0, urlRef.get()));
+    RetainPtr<CFReadStreamRef> stream = adoptCF(CFReadStreamCreateWithFile(0, urlRef.get()));
     if (!stream)
         return;
 
@@ -451,7 +450,7 @@ void WebPreferences::migrateWebKitPreferencesToCFPreferences()
         return;
 
     CFPropertyListFormat format = kCFPropertyListBinaryFormat_v1_0 | kCFPropertyListXMLFormat_v1_0;
-    RetainPtr<CFPropertyListRef> plist(AdoptCF, CFPropertyListCreateFromStream(0, stream.get(), 0, kCFPropertyListMutableContainersAndLeaves, &format, 0));
+    RetainPtr<CFPropertyListRef> plist = adoptCF(CFPropertyListCreateFromStream(0, stream.get(), 0, kCFPropertyListMutableContainersAndLeaves, &format, 0));
     CFReadStreamClose(stream.get());
 
     if (!plist || CFGetTypeID(plist.get()) != CFDictionaryGetTypeID())
@@ -1520,8 +1519,8 @@ HRESULT WebPreferences::setPreferenceForTest(BSTR key, BSTR value)
 {
     if (!SysStringLen(key) || !SysStringLen(value))
         return E_FAIL;
-    RetainPtr<CFStringRef> keyString(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<UniChar*>(key), SysStringLen(key)));
-    RetainPtr<CFStringRef> valueString(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<UniChar*>(value), SysStringLen(value)));
+    RetainPtr<CFStringRef> keyString = adoptCF(CFStringCreateWithCharacters(0, reinterpret_cast<UniChar*>(key), SysStringLen(key)));
+    RetainPtr<CFStringRef> valueString = adoptCF(CFStringCreateWithCharacters(0, reinterpret_cast<UniChar*>(value), SysStringLen(value)));
     setValueForKey(keyString.get(), valueString.get());
     postPreferencesChangesNotification();
     return S_OK;
index 03c0a15..e4776fd 100644 (file)
@@ -469,8 +469,8 @@ void WebView::setCacheModel(WebCacheModel cacheModel)
     if (s_didSetCacheModel && cacheModel == s_cacheModel)
         return;
 
-    RetainPtr<CFURLCacheRef> cfurlCache(AdoptCF, CFURLCacheCopySharedURLCache());
-    RetainPtr<CFStringRef> cfurlCacheDirectory(AdoptCF, wkCopyFoundationCacheDirectory(0));
+    RetainPtr<CFURLCacheRef> cfurlCache = adoptCF(CFURLCacheCopySharedURLCache());
+    RetainPtr<CFStringRef> cfurlCacheDirectory = adoptCF(wkCopyFoundationCacheDirectory(0));
     if (!cfurlCacheDirectory)
         cfurlCacheDirectory = WebCore::localUserSpecificStorageDirectory().createCFString();
 
@@ -4726,7 +4726,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
         if (FAILED(hr))
             return hr;
 
-        RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithString(kCFAllocatorDefault, toString(str).createCFString().get(), 0));
+        RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithString(kCFAllocatorDefault, toString(str).createCFString().get(), 0));
 
         // Check if the passed in string is a path and convert it to a URL.
         // FIXME: This is a workaround for nightly builds until we can get Safari to pass 
@@ -4739,7 +4739,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
             if (!WideCharToMultiByte(CP_UTF8, 0, str, len, (LPSTR)utf8Path.data(), result, 0, 0))
                 return E_FAIL;
 
-            url.adoptCF(CFURLCreateFromFileSystemRepresentation(0, utf8Path.data(), result - 1, false));
+            url = adoptCF(CFURLCreateFromFileSystemRepresentation(0, utf8Path.data(), result - 1, false));
         }
 
         settings->setUserStyleSheetLocation(url.get());
index 164f822..cfe4638 100644 (file)
@@ -1,3 +1,18 @@
+2013-05-06  Darin Adler  <darin@apple.com>
+
+        Use adoptCF and adoptNS in more places
+        https://bugs.webkit.org/show_bug.cgi?id=115657
+
+        Reviewed by Sam Weinig.
+
+        * Shared/Downloads/cfnet/DownloadCFNet.cpp:
+        (WebKit::Download::useCredential):
+        (WebKit::Download::start):
+        (WebKit::Download::startWithHandle):
+        (WebKit::Download::cancel):
+        (WebKit::Download::didDecideDestination):
+        Use adoptCF and adoptNS.
+
 2013-05-06  Sam Weinig  <sam@webkit.org>
 
         Add SPI to get an array of all the installed plug-ins
index 49b3861..25ba61f 100644 (file)
@@ -61,7 +61,7 @@ void Download::useCredential(const WebCore::AuthenticationChallenge& challenge,
 {
     if (!m_download)
         return;
-    RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(credential));
+    RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(credential));
     CFURLDownloadUseCredential(m_download.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
 }
 
@@ -96,7 +96,7 @@ void Download::start()
     CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback, 
                                   didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, 
                                   decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback};
-    m_download.adoptCF(CFURLDownloadCreate(0, cfRequest, &client));
+    m_download = adoptCF(CFURLDownloadCreate(0, cfRequest, &client));
 
     // FIXME: Allow this to be changed by the client.
     CFURLDownloadSetDeletesUponFailure(m_download.get(), false);
@@ -121,7 +121,7 @@ void Download::startWithHandle(ResourceHandle* handle, const ResourceResponse& r
                                   didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback,
                                   decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback};
 
-    m_download.adoptCF(CFURLDownloadCreateAndStartWithLoadingConnection(0, connection, handle->firstRequest().cfURLRequest(), response.cfURLResponse(), &client));
+    m_download = adoptCF(CFURLDownloadCreateAndStartWithLoadingConnection(0, connection, handle->firstRequest().cfURLRequest(), response.cfURLResponse(), &client));
 
     // It is possible for CFURLDownloadCreateAndStartWithLoadingConnection() to fail if the passed in CFURLConnection is not in a "downloadable state"
     // However, we should never hit that case
@@ -144,7 +144,7 @@ void Download::cancel()
     CFURLDownloadSetDeletesUponFailure(m_download.get(), false);
     CFURLDownloadCancel(m_download.get());
 
-    RetainPtr<CFDataRef> resumeData(AdoptCF, CFURLDownloadCopyResumeData(m_download.get()));
+    RetainPtr<CFDataRef> resumeData = adoptCF(CFURLDownloadCopyResumeData(m_download.get()));
     if (resumeData)
         DownloadBundle::appendResumeData(resumeData.get(), m_bundlePath);
 
@@ -168,8 +168,8 @@ void Download::didDecideDestination(const String& destination, bool allowOverwri
     m_destination = destination;
     m_bundlePath = destination + DownloadBundle::fileExtension();
 
-    RetainPtr<CFStringRef> bundlePath(AdoptCF, CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(m_bundlePath.characters()), m_bundlePath.length(), kCFAllocatorNull));
-    RetainPtr<CFURLRef> bundlePathURL(AdoptCF, CFURLCreateWithFileSystemPath(0, bundlePath.get(), kCFURLWindowsPathStyle, false));
+    RetainPtr<CFStringRef> bundlePath = adoptCF(CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(m_bundlePath.characters()), m_bundlePath.length(), kCFAllocatorNull));
+    RetainPtr<CFURLRef> bundlePathURL = adoptCF(CFURLCreateWithFileSystemPath(0, bundlePath.get(), kCFURLWindowsPathStyle, false));
     CFURLDownloadSetDestination(m_download.get(), bundlePathURL.get(), allowOverwrite);
 }
 
index 2927563..1a25e31 100644 (file)
@@ -1,3 +1,160 @@
+2013-05-06  Darin Adler  <darin@apple.com>
+
+        Use adoptCF and adoptNS in more places, test code and code not compiled on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=115657
+
+        Reviewed by Sam Weinig.
+
+        This is similar to my last set of changes, but covers code that I missed with
+        global replace using the Safari Xcode workspace.
+
+        * DumpRenderTree/cf/WebArchiveDumpSupport.cpp:
+        (convertWebResourceDataToString):
+        (convertWebResourceResponseToDictionary):
+        (createXMLStringFromWebArchiveData):
+        * DumpRenderTree/cg/ImageDiffCG.cpp:
+        (createImageFromStdin):
+        (createDifferenceImage):
+        (main):
+        * DumpRenderTree/cg/PixelDumpSupportCG.cpp:
+        (printPNG):
+        (dumpBitmap):
+        * DumpRenderTree/cg/PixelDumpSupportCG.h:
+        (BitmapContext::BitmapContext):
+        * DumpRenderTree/mac/MockWebNotificationProvider.mm:
+        (-[MockWebNotificationProvider init]):
+        * DumpRenderTree/mac/PixelDumpSupportMac.mm:
+        (createBitmapContext):
+        * DumpRenderTree/mac/TestRunnerMac.mm:
+        (TestRunner::addDisallowedURL):
+        (TestRunner::applicationCacheDiskUsageForOrigin):
+        (TestRunner::localStorageDiskUsageForOrigin):
+        (TestRunner::clearApplicationCacheForOrigin):
+        (TestRunner::deleteLocalStorageForOrigin):
+        (TestRunner::copyDecodedHostName):
+        (TestRunner::copyEncodedHostName):
+        (TestRunner::queueLoad):
+        (TestRunner::setDomainRelaxationForbiddenForURLScheme):
+        (TestRunner::setMockGeolocationPositionUnavailableError):
+        (TestRunner::setUserStyleSheetLocation):
+        (TestRunner::setValueForUser):
+        (TestRunner::overridePreference):
+        (TestRunner::setPersistentUserStyleSheetLocation):
+        (TestRunner::execCommand):
+        (TestRunner::findString):
+        (TestRunner::isCommandEnabled):
+        (TestRunner::addOriginAccessWhitelistEntry):
+        (TestRunner::removeOriginAccessWhitelistEntry):
+        (TestRunner::addUserScript):
+        (TestRunner::addUserStyleSheet):
+        (TestRunner::evaluateInWebInspector):
+        (TestRunner::evaluateScriptInIsolatedWorld):
+        (TestRunner::apiTestNewWindowDataLoadBaseURL):
+        (-[SynchronousLoader connection:didReceiveAuthenticationChallenge:]):
+        (TestRunner::authenticateSession):
+        (TestRunner::grantWebNotificationPermission):
+        (TestRunner::denyWebNotificationPermission):
+        * DumpRenderTree/mac/WebArchiveDumpSupportMac.mm:
+        (createCFURLResponseFromResponseData):
+        * DumpRenderTree/mac/WorkQueueItemMac.mm:
+        (LoadItem::invoke):
+        (LoadHTMLStringItem::invoke):
+        (ScriptItem::invoke):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (substringFromIndex):
+        (urlSuitableForTestResult):
+        (lastPathComponent):
+        (sharedCFURLCache):
+        * DumpRenderTree/win/ImageDiffCairo.cpp:
+        (createImageFromStdin):
+        (main):
+        * DumpRenderTree/win/PixelDumpSupportWin.cpp:
+        (createBitmapContextFromWebView):
+        * DumpRenderTree/win/TestRunnerWin.cpp:
+        (TestRunner::setUserStyleSheetLocation):
+        (TestRunner::setPersistentUserStyleSheetLocation):
+        * TestWebKitAPI/Tests/CustomProtocolsSyncXHRTest.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/TestWebKitAPI/mac/InstanceMethodSwizzler.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WTF/cf/RetainPtrHashing.cpp:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKit2/FindMatches.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKit2/WebArchive.cpp:
+        (TestWebKitAPI::didReceiveMessageFromInjectedBundle):
+        * TestWebKitAPI/Tests/WebKit2/mac/GetBackingScaleFactor.mm:
+        (TestWebKitAPI::createWindow):
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKit2/win/DoNotCopyANullCFURLResponse.cpp:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/AcceptsFirstMouse.mm:
+        (TestWebKitAPI::AcceptsFirstMouse::runTest):
+        * TestWebKitAPI/Tests/mac/AttributedString.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/BackForwardList.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/CancelLoadFromResourceLoadDelegate.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/ContextMenuCanCopyURL.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/DOMHTMLTableCellCellAbove.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/DOMRangeOfString.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/DeviceScaleFactorInDashboardRegions.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/DeviceScaleFactorOnBack.mm:
+        (TestWebKitAPI::DeviceScaleFactorOnBack::createWindow):
+        * TestWebKitAPI/Tests/mac/DynamicDeviceScaleFactor.mm:
+        (TestWebKitAPI::DynamicDeviceScaleFactor::createWindow):
+        * TestWebKitAPI/Tests/mac/HTMLCollectionNamedItem.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/HTMLFormCollectionNamedItem.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/InspectorBar.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/MemoryCacheDisableWithinResourceLoadDelegate.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/MemoryCachePruneWithinResourceLoadDelegate.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:
+        (TestWebKitAPI::PageVisibilityStateWithWindowChanges::runTest):
+        * TestWebKitAPI/Tests/mac/RenderedImageFromDOMRange.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/SetAndUpdateCacheModel.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/SetDocumentURI.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/SimplifyMarkup.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/StringByEvaluatingJavaScriptFromString.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/WillSendSubmitEvent.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/WindowlessWebViewWithMedia.mm:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/mac/PlatformUtilitiesMac.mm:
+        (TestWebKitAPI::Util::MIMETypeForWKURLResponse):
+        * TestWebKitAPI/mac/WebKitAgnosticTest.mm:
+        (TestWebKitAPI::WebKitAgnosticTest::runWebKit1Test):
+        (TestWebKitAPI::WebKitAgnosticTest::runWebKit2Test):
+        * WebKitTestRunner/InjectedBundle/mac/InjectedBundlePageMac.mm:
+        (WTR::testPathFromURL):
+        * WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:
+        (WTR::TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded):
+        * WebKitTestRunner/cg/TestInvocationCG.cpp:
+        (WTR::createCGContextFromImage):
+        (WTR::dumpBitmap):
+        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
+        * WebKitTestRunner/mac/EventSenderProxy.mm:
+        (WTR::EventSenderProxy::mouseScrollBy):
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::windowSnapshotImage):
+        * WebKitTestRunner/win/TestControllerWin.cpp:
+        (WTR::TestController::initializeTestPluginDirectory):
+        Use adoptCF and adoptNS.
+
 2013-05-07  Alex Christensen  <achristensen@apple.com>
 
         Fix a memory leak introduced in r149692
index afb3671..1918431 100644 (file)
@@ -70,7 +70,7 @@ static void convertWebResourceDataToString(CFMutableDictionaryRef resource)
             stringEncoding = kCFStringEncodingUTF8;
 
         CFDataRef data = static_cast<CFDataRef>(CFDictionaryGetValue(resource, CFSTR("WebResourceData")));
-        RetainPtr<CFStringRef> dataAsString(AdoptCF, CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, data, stringEncoding));
+        RetainPtr<CFStringRef> dataAsString = adoptCF(CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, data, stringEncoding));
         if (dataAsString)
             CFDictionarySetValue(resource, CFSTR("WebResourceData"), dataAsString.get());
     }
@@ -109,17 +109,17 @@ static void convertWebResourceResponseToDictionary(CFMutableDictionaryRef proper
     if (CFGetTypeID(responseData) != CFDataGetTypeID())
         return;
 
-    RetainPtr<CFURLResponseRef> response(AdoptCF, createCFURLResponseFromResponseData(responseData));
+    RetainPtr<CFURLResponseRef> response = adoptCF(createCFURLResponseFromResponseData(responseData));
     if (!response)
         return;
 
-    RetainPtr<CFMutableDictionaryRef> responseDictionary(AdoptCF, CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+    RetainPtr<CFMutableDictionaryRef> responseDictionary = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
-    RetainPtr<CFMutableStringRef> urlString(AdoptCF, CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLGetString(CFURLResponseGetURL(response.get()))));
+    RetainPtr<CFMutableStringRef> urlString = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLGetString(CFURLResponseGetURL(response.get()))));
     normalizeWebResourceURL(urlString.get());
     CFDictionarySetValue(responseDictionary.get(), CFSTR("URL"), urlString.get());
 
-    RetainPtr<CFMutableStringRef> mimeTypeString(AdoptCF, CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLResponseGetMIMEType(response.get())));
+    RetainPtr<CFMutableStringRef> mimeTypeString = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, CFURLResponseGetMIMEType(response.get())));
     convertMIMEType(mimeTypeString.get());
     CFDictionarySetValue(responseDictionary.get(), CFSTR("MIMEType"), mimeTypeString.get());
 
@@ -128,17 +128,17 @@ static void convertWebResourceResponseToDictionary(CFMutableDictionaryRef proper
         CFDictionarySetValue(responseDictionary.get(), CFSTR("textEncodingName"), textEncodingName);
 
     SInt64 expectedContentLength = CFURLResponseGetExpectedContentLength(response.get());
-    RetainPtr<CFNumberRef> expectedContentLengthNumber(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &expectedContentLength));
+    RetainPtr<CFNumberRef> expectedContentLengthNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &expectedContentLength));
     CFDictionarySetValue(responseDictionary.get(), CFSTR("expectedContentLength"), expectedContentLengthNumber.get());
 
     if (CFHTTPMessageRef httpMessage = CFURLResponseGetHTTPResponse(response.get())) {
-        RetainPtr<CFDictionaryRef> allHeaders(AdoptCF, CFHTTPMessageCopyAllHeaderFields(httpMessage));
-        RetainPtr<CFMutableDictionaryRef> allHeaderFields(AdoptCF, CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, allHeaders.get()));
+        RetainPtr<CFDictionaryRef> allHeaders = adoptCF(CFHTTPMessageCopyAllHeaderFields(httpMessage));
+        RetainPtr<CFMutableDictionaryRef> allHeaderFields = adoptCF(CFDictionaryCreateMutableCopy(kCFAllocatorDefault, 0, allHeaders.get()));
         normalizeHTTPResponseHeaderFields(allHeaderFields.get());
         CFDictionarySetValue(responseDictionary.get(), CFSTR("allHeaderFields"), allHeaderFields.get());
 
         CFIndex statusCode = CFHTTPMessageGetResponseStatusCode(httpMessage);
-        RetainPtr<CFNumberRef> statusCodeNumber(AdoptCF, CFNumberCreate(kCFAllocatorDefault, kCFNumberCFIndexType, &statusCode));
+        RetainPtr<CFNumberRef> statusCodeNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberCFIndexType, &statusCode));
         CFDictionarySetValue(responseDictionary.get(), CFSTR("statusCode"), statusCodeNumber.get());
     }
 
@@ -160,12 +160,12 @@ CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData)
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
     CFIndex bytesCount = CFDataGetLength(webArchiveData);
-    RetainPtr<CFReadStreamRef> readStream(AdoptCF, CFReadStreamCreateWithBytesNoCopy(kCFAllocatorDefault, CFDataGetBytePtr(webArchiveData), bytesCount, kCFAllocatorNull));
+    RetainPtr<CFReadStreamRef> readStream = adoptCF(CFReadStreamCreateWithBytesNoCopy(kCFAllocatorDefault, CFDataGetBytePtr(webArchiveData), bytesCount, kCFAllocatorNull));
     CFReadStreamOpen(readStream.get());
-    RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, (CFMutableDictionaryRef)CFPropertyListCreateFromStream(kCFAllocatorDefault, readStream.get(), bytesCount, kCFPropertyListMutableContainersAndLeaves, &format, 0));
+    RetainPtr<CFMutableDictionaryRef> propertyList = adoptCF((CFMutableDictionaryRef)CFPropertyListCreateFromStream(kCFAllocatorDefault, readStream.get(), bytesCount, kCFPropertyListMutableContainersAndLeaves, &format, 0));
     CFReadStreamClose(readStream.get());
 #else
-    RetainPtr<CFMutableDictionaryRef> propertyList(AdoptCF, (CFMutableDictionaryRef)CFPropertyListCreateWithData(kCFAllocatorDefault, webArchiveData, kCFPropertyListMutableContainersAndLeaves, &format, &error));
+    RetainPtr<CFMutableDictionaryRef> propertyList = adoptCF((CFMutableDictionaryRef)CFPropertyListCreateWithData(kCFAllocatorDefault, webArchiveData, kCFPropertyListMutableContainersAndLeaves, &format, &error));
 #endif
 
     if (!propertyList) {
@@ -174,7 +174,7 @@ CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData)
         return static_cast<CFStringRef>(CFRetain(CFSTR("An unknown error occurred converting data to property list.")));
     }
 
-    RetainPtr<CFMutableArrayRef> resources(AdoptCF, CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks));
+    RetainPtr<CFMutableArrayRef> resources = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks));
     CFArrayAppendValue(resources.get(), propertyList.get());
 
     while (CFArrayGetCount(resources.get())) {
@@ -209,9 +209,9 @@ CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData)
     error = 0;
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050
-    RetainPtr<CFDataRef> xmlData(AdoptCF, CFPropertyListCreateXMLData(kCFAllocatorDefault, propertyList.get()));
+    RetainPtr<CFDataRef> xmlData = adoptCF(CFPropertyListCreateXMLData(kCFAllocatorDefault, propertyList.get()));
 #else
-    RetainPtr<CFDataRef> xmlData(AdoptCF, CFPropertyListCreateData(kCFAllocatorDefault, propertyList.get(), kCFPropertyListXMLFormat_v1_0, 0, &error));
+    RetainPtr<CFDataRef> xmlData = adoptCF(CFPropertyListCreateData(kCFAllocatorDefault, propertyList.get(), kCFPropertyListXMLFormat_v1_0, 0, &error));
 #endif
 
     if (!xmlData) {
@@ -220,8 +220,8 @@ CFStringRef createXMLStringFromWebArchiveData(CFDataRef webArchiveData)
         return static_cast<CFStringRef>(CFRetain(CFSTR("An unknown error occurred converting property list to data.")));
     }
 
-    RetainPtr<CFStringRef> xmlString(AdoptCF, CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, xmlData.get(), kCFStringEncodingUTF8));
-    RetainPtr<CFMutableStringRef> string(AdoptCF, CFStringCreateMutableCopy(kCFAllocatorDefault, 0, xmlString.get()));
+    RetainPtr<CFStringRef> xmlString = adoptCF(CFStringCreateFromExternalRepresentation(kCFAllocatorDefault, xmlData.get(), kCFStringEncodingUTF8));
+    RetainPtr<CFMutableStringRef> string = adoptCF(CFStringCreateMutableCopy(kCFAllocatorDefault, 0, xmlString.get()));
 
     // Replace "Apple Computer" with "Apple" in the DTD declaration.
     CFStringFindAndReplace(string.get(), CFSTR("-//Apple Computer//"), CFSTR("-//Apple//"), CFRangeMake(0, CFStringGetLength(string.get())), 0);
index 7fa5110..900f1ba 100644 (file)
@@ -75,7 +75,7 @@ static const CFStringRef kUTTypePNG = CFSTR("public.png");
 static RetainPtr<CGImageRef> createImageFromStdin(int bytesRemaining)
 {
     unsigned char buffer[2048];
-    RetainPtr<CFMutableDataRef> data(AdoptCF, CFDataCreateMutable(0, bytesRemaining));
+    RetainPtr<CFMutableDataRef> data = adoptCF(CFDataCreateMutable(0, bytesRemaining));
 
     while (bytesRemaining > 0) {
         size_t bytesToRead = min(bytesRemaining, 2048);
@@ -83,8 +83,8 @@ static RetainPtr<CGImageRef> createImageFromStdin(int bytesRemaining)
         CFDataAppendBytes(data.get(), buffer, static_cast<CFIndex>(bytesRead));
         bytesRemaining -= static_cast<int>(bytesRead);
     }
-    RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(data.get()));
-    return RetainPtr<CGImageRef>(AdoptCF, CGImageCreateWithPNGDataProvider(dataProvider.get(), 0, false, kCGRenderingIntentDefault));
+    RetainPtr<CGDataProviderRef> dataProvider = adoptCF(CGDataProviderCreateWithCFData(data.get()));
+    return adoptCF(CGImageCreateWithPNGDataProvider(dataProvider.get(), 0, false, kCGRenderingIntentDefault));
 }
 
 static void releaseMallocBuffer(void* info, const void* data, size_t size)
@@ -100,12 +100,12 @@ static RetainPtr<CGImageRef> createDifferenceImage(CGImageRef baseImage, CGImage
 
     // Draw base image in bitmap context
     void* baseBuffer = calloc(height, rowBytes);
-    RetainPtr<CGContextRef> baseContext(AdoptCF, CGBitmapContextCreate(baseBuffer, width, height, 8, rowBytes, CGImageGetColorSpace(baseImage), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
+    RetainPtr<CGContextRef> baseContext = adoptCF(CGBitmapContextCreate(baseBuffer, width, height, 8, rowBytes, CGImageGetColorSpace(baseImage), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
     CGContextDrawImage(baseContext.get(), CGRectMake(0, 0, width, height), baseImage);
 
     // Draw test image in bitmap context
     void* buffer = calloc(height, rowBytes);
-    RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(buffer, width, height, 8, rowBytes, CGImageGetColorSpace(testImage), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
+    RetainPtr<CGContextRef> context = adoptCF(CGBitmapContextCreate(buffer, width, height, 8, rowBytes, CGImageGetColorSpace(testImage), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
     CGContextDrawImage(context.get(), CGRectMake(0, 0, width, height), testImage);
 
     // Compare the content of the 2 bitmaps
@@ -154,8 +154,8 @@ static RetainPtr<CGImageRef> createDifferenceImage(CGImageRef baseImage, CGImage
         }
         
         static CGColorSpaceRef diffColorspace = CGColorSpaceCreateDeviceGray();
-        RetainPtr<CGDataProviderRef> provider(AdoptCF, CGDataProviderCreateWithData(0, diffBuffer, width * height, releaseMallocBuffer));
-        diffImage.adoptCF(CGImageCreate(width, height, 8, 8, width, diffColorspace, 0, provider.get(), 0, false, kCGRenderingIntentDefault));
+        RetainPtr<CGDataProviderRef> provider = adoptCF(CGDataProviderCreateWithData(0, diffBuffer, width * height, releaseMallocBuffer));
+        diffImage = adoptCF(CGImageCreate(width, height, 8, 8, width, diffColorspace, 0, provider.get(), 0, false, kCGRenderingIntentDefault));
     }
     else
         free(diffBuffer);
@@ -242,8 +242,8 @@ int main(int argc, const char* argv[])
             
             if (difference > 0.0f) {
                 if (diffImage) {
-                    RetainPtr<CFMutableDataRef> imageData(AdoptCF, CFDataCreateMutable(0, 0));
-                    RetainPtr<CGImageDestinationRef> imageDest(AdoptCF, CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0));
+                    RetainPtr<CFMutableDataRef> imageData = adoptCF(CFDataCreateMutable(0, 0));
+                    RetainPtr<CGImageDestinationRef> imageDest = adoptCF(CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0));
                     CGImageDestinationAddImage(imageDest.get(), diffImage.get(), 0);
                     CGImageDestinationFinalize(imageDest.get());
                     printf("Content-Length: %lu\n", CFDataGetLength(imageData.get()));
index bf59b03..3168d20 100644 (file)
@@ -57,8 +57,8 @@ static const CFStringRef kUTTypePNG = CFSTR("public.png");
 
 static void printPNG(CGImageRef image, const char* checksum)
 {
-    RetainPtr<CFMutableDataRef> imageData(AdoptCF, CFDataCreateMutable(0, 0));
-    RetainPtr<CGImageDestinationRef> imageDest(AdoptCF, CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0));
+    RetainPtr<CFMutableDataRef> imageData = adoptCF(CFDataCreateMutable(0, 0));
+    RetainPtr<CGImageDestinationRef> imageDest = adoptCF(CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0));
     CGImageDestinationAddImage(imageDest.get(), image, 0);
     CGImageDestinationFinalize(imageDest.get());
 
@@ -108,6 +108,6 @@ void computeMD5HashStringForBitmapContext(BitmapContext* context, char hashStrin
 
 void dumpBitmap(BitmapContext* context, const char* checksum)
 {
-    RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(context->cgContext()));
+    RetainPtr<CGImageRef> image = adoptCF(CGBitmapContextCreateImage(context->cgContext()));
     printPNG(image.get(), checksum);
 }
index f0c9746..353a6b6 100644 (file)
@@ -70,7 +70,7 @@ private:
 
     BitmapContext(PlatformBitmapBuffer buffer, CGContextRef context)
         : m_buffer(buffer)
-        , m_context(AdoptCF, context)
+        , m_context(adoptCF(context))
     {
     }
 
index d80f6ba..adf5d9e 100644 (file)
@@ -43,7 +43,7 @@
 {
     if (!(self = [super init]))
         return nil;
-    _permissions.adoptNS([[NSMutableDictionary alloc] init]);
+    _permissions = adoptNS([[NSMutableDictionary alloc] init]);
     return self;
 }
 
index f4cc7c1..c2d43da 100644 (file)
@@ -53,7 +53,7 @@ static PassRefPtr<BitmapContext> createBitmapContext(size_t pixelsWide, size_t p
         return 0;
     
     // Creating this bitmap in the device color space prevents any color conversion when the image of the web view is drawn into it.
-    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
+    RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
     CGContextRef context = CGBitmapContextCreate(buffer, pixelsWide, pixelsHigh, 8, rowBytes, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host); // Use ARGB8 on PPC or BGRA8 on X86 to improve CG performance
     if (!context) {
         free(buffer);
index f410c75..98b6e47 100644 (file)
@@ -119,7 +119,7 @@ TestRunner::~TestRunner()
 
 void TestRunner::addDisallowedURL(JSStringRef url)
 {
-    RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url));
+    RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url));
 
     if (!disallowedURLs)
         disallowedURLs = CFSetCreateMutable(kCFAllocatorDefault, 0, NULL);
@@ -143,7 +143,7 @@ void TestRunner::clearAllApplicationCaches()
 
 long long TestRunner::applicationCacheDiskUsageForOrigin(JSStringRef url)
 {
-    RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url));
+    RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url));
     WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]];
     long long usage = [WebApplicationCache diskUsageForOrigin:origin];
     [origin release];
@@ -157,7 +157,7 @@ void TestRunner::syncLocalStorage()
 
 long long TestRunner::localStorageDiskUsageForOrigin(JSStringRef url)
 {
-    RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url));
+    RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url));
     WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]];
     long long usage = [[WebStorageManager sharedWebStorageManager] diskUsageForOrigin:origin];
     [origin release];
@@ -171,7 +171,7 @@ void TestRunner::observeStorageTrackerNotifications(unsigned number)
 
 void TestRunner::clearApplicationCacheForOrigin(JSStringRef url)
 {
-    RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url));
+    RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url));
 
     WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]];
     [WebApplicationCache deleteCacheForOrigin:origin];
@@ -224,7 +224,7 @@ JSValueRef TestRunner::originsWithLocalStorage(JSContextRef context)
 
 void TestRunner::deleteLocalStorageForOrigin(JSStringRef URL)
 {
-    RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, URL));
+    RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, URL));
     
     WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:(NSString *)urlCF.get()]];
     [[WebStorageManager sharedWebStorageManager] deleteOrigin:origin];
@@ -248,14 +248,14 @@ void TestRunner::clearBackForwardList()
 
 JSStringRef TestRunner::copyDecodedHostName(JSStringRef name)
 {
-    RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, name));
+    RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name));
     NSString *nameNS = (NSString *)nameCF.get();
     return JSStringCreateWithCFString((CFStringRef)[nameNS _web_decodeHostName]);
 }
 
 JSStringRef TestRunner::copyEncodedHostName(JSStringRef name)
 {
-    RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, name));
+    RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name));
     NSString *nameNS = (NSString *)nameCF.get();
     return JSStringCreateWithCFString((CFStringRef)[nameNS _web_encodeHostName]);
 }
@@ -363,7 +363,7 @@ JSStringRef TestRunner::pathToLocalResource(JSContextRef context, JSStringRef lo
 
 void TestRunner::queueLoad(JSStringRef url, JSStringRef target)
 {
-    RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url));
+    RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url));
     NSString *urlNS = (NSString *)urlCF.get();
 
     NSURL *nsurl = [NSURL URLWithString:urlNS relativeToURL:[[[mainFrame dataSource] response] URL]];
@@ -433,7 +433,7 @@ void TestRunner::setDefersLoading(bool defers)
 
 void TestRunner::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme)
 {
-    RetainPtr<CFStringRef> schemeCFString(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, scheme));
+    RetainPtr<CFStringRef> schemeCFString = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, scheme));
     [WebView _setDomainRelaxationForbidden:forbidden forURLScheme:(NSString *)schemeCFString.get()];
 }
 
@@ -463,7 +463,7 @@ void TestRunner::setMockGeolocationPosition(double latitude, double longitude, d
 
 void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message)
 {
-    RetainPtr<CFStringRef> messageCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, message));
+    RetainPtr<CFStringRef> messageCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, message));
     NSString *messageNS = (NSString *)messageCF.get();
     [[MockGeolocationProvider shared] setPositionUnavailableErrorWithMessage:messageNS];
 }
@@ -576,7 +576,7 @@ void TestRunner::setUserStyleSheetEnabled(bool flag)
 
 void TestRunner::setUserStyleSheetLocation(JSStringRef path)
 {
-    RetainPtr<CFStringRef> pathCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, path));
+    RetainPtr<CFStringRef> pathCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, path));
     NSURL *url = [NSURL URLWithString:(NSString *)pathCF.get()];
     [[WebPreferences standardPreferences] setUserStyleSheetLocation:url];
 }
@@ -587,7 +587,7 @@ void TestRunner::setValueForUser(JSContextRef context, JSValueRef nodeObject, JS
     if (!element || ![element isKindOfClass:[DOMHTMLInputElement class]])
         return;
 
-    RetainPtr<CFStringRef> valueCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, value));
+    RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value));
     [(DOMHTMLInputElement *)element setValueForUser:(NSString *)valueCF.get()];
 }
 
@@ -603,10 +603,10 @@ void TestRunner::dispatchPendingLoadRequests()
 
 void TestRunner::overridePreference(JSStringRef key, JSStringRef value)
 {
-    RetainPtr<CFStringRef> keyCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, key));
+    RetainPtr<CFStringRef> keyCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, key));
     NSString *keyNS = (NSString *)keyCF.get();
 
-    RetainPtr<CFStringRef> valueCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, value));
+    RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value));
     NSString *valueNS = (NSString *)valueCF.get();
 
     [[WebPreferences standardPreferences] _setPreferenceForTestWithValue:valueNS forKey:keyNS];
@@ -619,7 +619,7 @@ void TestRunner::removeAllVisitedLinks()
 
 void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef jsURL)
 {
-    RetainPtr<CFStringRef> urlString(AdoptCF, JSStringCopyCFString(0, jsURL));
+    RetainPtr<CFStringRef> urlString = adoptCF(JSStringCopyCFString(0, jsURL));
     ::setPersistentUserStyleSheetLocation(urlString.get());
 }
 
@@ -655,10 +655,10 @@ int TestRunner::windowCount()
 
 void TestRunner::execCommand(JSStringRef name, JSStringRef value)
 {
-    RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, name));
+    RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name));
     NSString *nameNS = (NSString *)nameCF.get();
 
-    RetainPtr<CFStringRef> valueCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, value));
+    RetainPtr<CFStringRef> valueCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, value));
     NSString *valueNS = (NSString *)valueCF.get();
 
     [[mainFrame webView] _executeCoreCommandByName:nameNS value:valueNS];
@@ -673,7 +673,7 @@ bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRe
     if (!JSValueIsNumber(context, lengthValue))
         return false;
 
-    RetainPtr<CFStringRef> targetCFString(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, target));
+    RetainPtr<CFStringRef> targetCFString = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, target));
 
     size_t length = static_cast<size_t>(JSValueToNumber(context, lengthValue, 0));
     for (size_t i = 0; i < length; ++i) {
@@ -707,7 +707,7 @@ void TestRunner::setCacheModel(int cacheModel)
 
 bool TestRunner::isCommandEnabled(JSStringRef name)
 {
-    RetainPtr<CFStringRef> nameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, name));
+    RetainPtr<CFStringRef> nameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, name));
     NSString *nameNS = (NSString *)nameCF.get();
 
     // Accept command strings with capital letters for first letter without trailing colon.
@@ -718,7 +718,7 @@ bool TestRunner::isCommandEnabled(JSStringRef name)
     }
 
     SEL selector = NSSelectorFromString(nameNS);
-    RetainPtr<CommandValidationTarget> target(AdoptNS, [[CommandValidationTarget alloc] initWithAction:selector]);
+    RetainPtr<CommandValidationTarget> target = adoptNS([[CommandValidationTarget alloc] initWithAction:selector]);
     id validator = [NSApp targetForAction:selector to:[mainFrame webView] from:target.get()];
     if (!validator)
         return false;
@@ -738,22 +738,22 @@ void TestRunner::waitForPolicyDelegate()
 
 void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
 {
-    RetainPtr<CFStringRef> sourceOriginCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, sourceOrigin));
+    RetainPtr<CFStringRef> sourceOriginCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, sourceOrigin));
     NSString *sourceOriginNS = (NSString *)sourceOriginCF.get();
-    RetainPtr<CFStringRef> protocolCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol));
+    RetainPtr<CFStringRef> protocolCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol));
     NSString *destinationProtocolNS = (NSString *)protocolCF.get();
-    RetainPtr<CFStringRef> hostCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, destinationHost));
+    RetainPtr<CFStringRef> hostCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationHost));
     NSString *destinationHostNS = (NSString *)hostCF.get();
     [WebView _addOriginAccessWhitelistEntryWithSourceOrigin:sourceOriginNS destinationProtocol:destinationProtocolNS destinationHost:destinationHostNS allowDestinationSubdomains:allowDestinationSubdomains];
 }
 
 void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
 {
-    RetainPtr<CFStringRef> sourceOriginCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, sourceOrigin));
+    RetainPtr<CFStringRef> sourceOriginCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, sourceOrigin));
     NSString *sourceOriginNS = (NSString *)sourceOriginCF.get();
-    RetainPtr<CFStringRef> protocolCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol));
+    RetainPtr<CFStringRef> protocolCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationProtocol));
     NSString *destinationProtocolNS = (NSString *)protocolCF.get();
-    RetainPtr<CFStringRef> hostCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, destinationHost));
+    RetainPtr<CFStringRef> hostCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, destinationHost));
     NSString *destinationHostNS = (NSString *)hostCF.get();
     [WebView _removeOriginAccessWhitelistEntryWithSourceOrigin:sourceOriginNS destinationProtocol:destinationProtocolNS destinationHost:destinationHostNS allowDestinationSubdomains:allowDestinationSubdomains];
 }
@@ -765,14 +765,14 @@ void TestRunner::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy)
 
 void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
 {
-    RetainPtr<CFStringRef> sourceCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, source));
+    RetainPtr<CFStringRef> sourceCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, source));
     NSString *sourceNS = (NSString *)sourceCF.get();
     [WebView _addUserScriptToGroup:@"org.webkit.DumpRenderTree" world:[WebScriptWorld world] source:sourceNS url:nil whitelist:nil blacklist:nil injectionTime:(runAtStart ? WebInjectAtDocumentStart : WebInjectAtDocumentEnd) injectedFrames:(allFrames ? WebInjectInAllFrames : WebInjectInTopFrameOnly)];
 }
 
 void TestRunner::addUserStyleSheet(JSStringRef source, bool allFrames)
 {
-    RetainPtr<CFStringRef> sourceCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, source));
+    RetainPtr<CFStringRef> sourceCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, source));
     NSString *sourceNS = (NSString *)sourceCF.get();
     [WebView _addUserStyleSheetToGroup:@"org.webkit.DumpRenderTree" world:[WebScriptWorld world] source:sourceNS url:nil whitelist:nil blacklist:nil injectedFrames:(allFrames ? WebInjectInAllFrames : WebInjectInTopFrameOnly)];
 }
@@ -794,7 +794,7 @@ void TestRunner::closeWebInspector()
 
 void TestRunner::evaluateInWebInspector(long callId, JSStringRef script)
 {
-    RetainPtr<CFStringRef> scriptCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, script));
+    RetainPtr<CFStringRef> scriptCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, script));
     NSString *scriptNS = (NSString *)scriptCF.get();
     [[[mainFrame webView] inspector] evaluateInFrontend:nil callId:callId script:scriptNS];
 }
@@ -824,7 +824,7 @@ void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, J
 
 void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
 {
-    RetainPtr<CFStringRef> scriptCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, script));
+    RetainPtr<CFStringRef> scriptCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, script));
     NSString *scriptNS = (NSString *)scriptCF.get();
 
     // A worldID of 0 always corresponds to a new world. Any other worldID corresponds to a world
@@ -835,7 +835,7 @@ void TestRunner::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef glo
     else {
         RetainPtr<WebScriptWorld>& worldSlot = worldMap().add(worldID, 0).iterator->value;
         if (!worldSlot)
-            worldSlot.adoptNS([[WebScriptWorld alloc] init]);
+            worldSlot = adoptNS([[WebScriptWorld alloc] init]);
         world = worldSlot.get();
     }
 
@@ -883,8 +883,8 @@ void TestRunner::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringR
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-    RetainPtr<CFStringRef> utf8DataCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, utf8Data));
-    RetainPtr<CFStringRef> baseURLCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, baseURL));
+    RetainPtr<CFStringRef> utf8DataCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, utf8Data));
+    RetainPtr<CFStringRef> baseURLCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, baseURL));
     
     WebView *webView = [[WebView alloc] initWithFrame:NSZeroRect frameName:@"" groupName:@""];
 
@@ -951,7 +951,7 @@ static NSString *SynchronousLoaderRunLoopMode = @"DumpRenderTreeSynchronousLoade
 - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
 {
     if ([challenge previousFailureCount] == 0) {
-        RetainPtr<NSURLCredential> credential(AdoptNS, [[NSURLCredential alloc]  initWithUser:m_username password:m_password persistence:NSURLCredentialPersistenceForSession]);
+        RetainPtr<NSURLCredential> credential = adoptNS([[NSURLCredential alloc]  initWithUser:m_username password:m_password persistence:NSURLCredentialPersistenceForSession]);
         [[challenge sender] useCredential:credential.get() forAuthenticationChallenge:challenge];
         return;
     }
@@ -997,11 +997,11 @@ void TestRunner::authenticateSession(JSStringRef url, JSStringRef username, JSSt
 {
     // See <rdar://problem/7880699>.
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
-    RetainPtr<CFStringRef> urlStringCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, url));
-    RetainPtr<CFStringRef> usernameCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, username));
-    RetainPtr<CFStringRef> passwordCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, password));
+    RetainPtr<CFStringRef> urlStringCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, url));
+    RetainPtr<CFStringRef> usernameCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, username));
+    RetainPtr<CFStringRef> passwordCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, password));
 
-    RetainPtr<NSURLRequest> request(AdoptNS, [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:(NSString *)urlStringCF.get()]]);
+    RetainPtr<NSURLRequest> request = adoptNS([[NSURLRequest alloc] initWithURL:[NSURL URLWithString:(NSString *)urlStringCF.get()]]);
 
     [SynchronousLoader makeRequest:request.get() withUsername:(NSString *)usernameCF.get() password:(NSString *)passwordCF.get()];
 #endif
@@ -1084,14 +1084,14 @@ void TestRunner::setPageVisibility(const char* newVisibility)
 
 void TestRunner::grantWebNotificationPermission(JSStringRef jsOrigin)
 {
-    RetainPtr<CFStringRef> cfOrigin(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, jsOrigin));
+    RetainPtr<CFStringRef> cfOrigin = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, jsOrigin));
     ASSERT([[mainFrame webView] _notificationProvider] == [MockWebNotificationProvider shared]);
     [[MockWebNotificationProvider shared] setWebNotificationOrigin:(NSString *)cfOrigin.get() permission:TRUE];
 }
 
 void TestRunner::denyWebNotificationPermission(JSStringRef jsOrigin)
 {
-    RetainPtr<CFStringRef> cfOrigin(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, jsOrigin));
+    RetainPtr<CFStringRef> cfOrigin = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, jsOrigin));
     ASSERT([[mainFrame webView] _notificationProvider] == [MockWebNotificationProvider shared]);
     [[MockWebNotificationProvider shared] setWebNotificationOrigin:(NSString *)cfOrigin.get() permission:FALSE];
 }
index 9f94ecb..e06e797 100644 (file)
@@ -52,7 +52,7 @@ void CFURLResponseSetMIMEType(CFURLResponseRef response, CFStringRef mimeType);
 CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData)
 {
     // Decode NSURLResponse
-    RetainPtr<NSKeyedUnarchiver> unarchiver(AdoptNS, [[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]);
+    RetainPtr<NSKeyedUnarchiver> unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)responseData]);
     NSURLResponse *response = [unarchiver.get() decodeObjectForKey:@"WebResourceResponse"]; // WebResourceResponseKey in WebResource.m
     [unarchiver.get() finishDecoding];
 
@@ -62,7 +62,7 @@ CFURLResponseRef createCFURLResponseFromResponseData(CFDataRef responseData)
     NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
 
     // NSURLResponse is not toll-free bridged to CFURLResponse.
-    RetainPtr<CFHTTPMessageRef> httpMessage(AdoptCF, CFHTTPMessageCreateResponse(kCFAllocatorDefault, [httpResponse statusCode], 0, kCFHTTPVersion1_1));
+    RetainPtr<CFHTTPMessageRef> httpMessage = adoptCF(CFHTTPMessageCreateResponse(kCFAllocatorDefault, [httpResponse statusCode], 0, kCFHTTPVersion1_1));
 
     NSDictionary *headerFields = [httpResponse allHeaderFields];
     for (NSString *headerField in [headerFields keyEnumerator])
index c28e991..f0b6c33 100644 (file)
@@ -40,9 +40,9 @@
 
 bool LoadItem::invoke() const
 {
-    RetainPtr<CFStringRef> urlCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_url.get()));
+    RetainPtr<CFStringRef> urlCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_url.get()));
     NSString *urlNS = (NSString *)urlCF.get();
-    RetainPtr<CFStringRef> targetCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_target.get()));
+    RetainPtr<CFStringRef> targetCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_target.get()));
     NSString *targetNS = (NSString *)targetCF.get();
 
     WebFrame *targetFrame;
@@ -56,11 +56,11 @@ bool LoadItem::invoke() const
 
 bool LoadHTMLStringItem::invoke() const
 {
-    RetainPtr<CFStringRef> contentCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_content.get()));
-    RetainPtr<CFStringRef> baseURLCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_baseURL.get()));
+    RetainPtr<CFStringRef> contentCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_content.get()));
+    RetainPtr<CFStringRef> baseURLCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_baseURL.get()));
 
     if (m_unreachableURL) {
-        RetainPtr<CFStringRef> unreachableURLCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_unreachableURL.get()));
+        RetainPtr<CFStringRef> unreachableURLCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_unreachableURL.get()));
         [mainFrame loadAlternateHTMLString:(NSString *)contentCF.get() baseURL:[NSURL URLWithString:(NSString *)baseURLCF.get()] forUnreachableURL:[NSURL URLWithString:(NSString *)unreachableURLCF.get()]];
         return true;
     }
@@ -77,7 +77,7 @@ bool ReloadItem::invoke() const
 
 bool ScriptItem::invoke() const
 {
-    RetainPtr<CFStringRef> scriptCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, m_script.get()));
+    RetainPtr<CFStringRef> scriptCF = adoptCF(JSStringCopyCFString(kCFAllocatorDefault, m_script.get()));
     NSString *scriptNS = (NSString *)scriptCF.get();
     [[mainFrame webView] stringByEvaluatingJavaScriptFromString:scriptNS];
     return true;
index c0fcb00..65a0f34 100644 (file)
@@ -136,14 +136,14 @@ bool setAlwaysAcceptCookies(bool alwaysAcceptCookies)
 
 static RetainPtr<CFStringRef> substringFromIndex(CFStringRef string, CFIndex index)
 {
-    return RetainPtr<CFStringRef>(AdoptCF, CFStringCreateWithSubstring(kCFAllocatorDefault, string, CFRangeMake(index, CFStringGetLength(string) - index)));
+    return adoptCF(CFStringCreateWithSubstring(kCFAllocatorDefault, string, CFRangeMake(index, CFStringGetLength(string) - index)));
 }
 
 wstring urlSuitableForTestResult(const wstring& urlString)
 {
-    RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0));
+    RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0));
 
-    RetainPtr<CFStringRef> scheme(AdoptCF, CFURLCopyScheme(url.get()));
+    RetainPtr<CFStringRef> scheme = adoptCF(CFURLCopyScheme(url.get()));
     if (scheme && CFStringCompare(scheme.get(), CFSTR("file"), kCFCompareCaseInsensitive) != kCFCompareEqualTo)
         return urlString;
 
@@ -161,11 +161,11 @@ wstring urlSuitableForTestResult(const wstring& urlString)
     if (FAILED(request->URL(requestURLString.GetAddress())))
         return urlString;
 
-    RetainPtr<CFURLRef> requestURL(AdoptCF, CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(requestURLString.GetBSTR()), requestURLString.length() * sizeof(OLECHAR), kCFStringEncodingUTF16, 0));
-    RetainPtr<CFURLRef> baseURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, requestURL.get()));
+    RetainPtr<CFURLRef> requestURL = adoptCF(CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(requestURLString.GetBSTR()), requestURLString.length() * sizeof(OLECHAR), kCFStringEncodingUTF16, 0));
+    RetainPtr<CFURLRef> baseURL = adoptCF(CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, requestURL.get()));
 
-    RetainPtr<CFStringRef> basePath(AdoptCF, CFURLCopyPath(baseURL.get()));
-    RetainPtr<CFStringRef> path(AdoptCF, CFURLCopyPath(url.get()));
+    RetainPtr<CFStringRef> basePath = adoptCF(CFURLCopyPath(baseURL.get()));
+    RetainPtr<CFStringRef> path = adoptCF(CFURLCopyPath(url.get()));
 
     return cfStringRefToWString(substringFromIndex(path.get(), CFStringGetLength(basePath.get())).get());
 }
@@ -175,7 +175,7 @@ wstring lastPathComponent(const wstring& urlString)
     if (urlString.empty())
         return urlString;
 
-    RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0));
+    RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0));
     RetainPtr<CFStringRef> lastPathComponent = adoptCF(CFURLCopyLastPathComponent(url.get()));
 
     return cfStringRefToWString(lastPathComponent.get());
@@ -1278,7 +1278,7 @@ RetainPtr<CFURLCacheRef> sharedCFURLCache()
 
     typedef CFURLCacheRef (*CFURLCacheCopySharedURLCacheProcPtr)(void);
     if (CFURLCacheCopySharedURLCacheProcPtr copyCache = reinterpret_cast<CFURLCacheCopySharedURLCacheProcPtr>(GetProcAddress(module, "CFURLCacheCopySharedURLCache")))
-        return RetainPtr<CFURLCacheRef>(AdoptCF, copyCache());
+        return adoptCF(copyCache());
 
     typedef CFURLCacheRef (*CFURLCacheSharedURLCacheProcPtr)(void);
     if (CFURLCacheSharedURLCacheProcPtr sharedCache = reinterpret_cast<CFURLCacheSharedURLCacheProcPtr>(GetProcAddress(module, "CFURLCacheSharedURLCache")))
index d10cc14..d5a81b4 100644 (file)
@@ -73,7 +73,7 @@ static cairo_status_t readFromData(void* closure, unsigned char* data, unsigned
 static cairo_surface_t* createImageFromStdin(int bytesRemaining)
 {
     unsigned char buffer[s_bufferSize];
-    RetainPtr<CFMutableDataRef> data(AdoptCF, CFDataCreateMutable(0, bytesRemaining));
+    RetainPtr<CFMutableDataRef> data = adoptCF(CFDataCreateMutable(0, bytesRemaining));
 
     while (bytesRemaining > 0) {
         size_t bytesToRead = min(bytesRemaining, s_bufferSize);
@@ -235,7 +235,7 @@ int main(int argc, const char* argv[])
                 
             if (difference > 0.0) {
                 if (diffImage) {
-                    RetainPtr<CFMutableDataRef> imageData(AdoptCF, CFDataCreateMutable(0, 0));
+                    RetainPtr<CFMutableDataRef> imageData = adoptCF(CFDataCreateMutable(0, 0));
                     cairo_surface_write_to_png_stream(diffImage, (cairo_write_func_t)writeToData, imageData.get());
                     printf("Content-Length: %lu\n", CFDataGetLength(imageData.get()));
                     fwrite(CFDataGetBytePtr(imageData.get()), 1, CFDataGetLength(imageData.get()), stdout);
index 10ca516..f2025c6 100644 (file)
@@ -85,7 +85,7 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool inc
     makeAlphaChannelOpaque(info.bmBits, info.bmWidth, info.bmHeight);
 
 #if USE(CG)
-    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
+    RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
     CGContextRef context = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8,
                                                 info.bmWidthBytes, colorSpace.get(), kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst);
 #elif USE(CAIRO) 
index d5b9810..f1a2b2b 100644 (file)
@@ -633,13 +633,13 @@ void TestRunner::setUserStyleSheetLocation(JSStringRef jsURL)
     if (FAILED(webView->preferences(&preferences)))
         return;
 
-    RetainPtr<CFStringRef> urlString(AdoptCF, JSStringCopyCFString(0, jsURL));
-    RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithString(0, urlString.get(), 0));
+    RetainPtr<CFStringRef> urlString = adoptCF(JSStringCopyCFString(0, jsURL));
+    RetainPtr<CFURLRef> url = adoptCF(CFURLCreateWithString(0, urlString.get(), 0));
     if (!url)
         return;
 
     // Now copy the file system path, POSIX style.
-    RetainPtr<CFStringRef> pathCF(AdoptCF, CFURLCopyFileSystemPath(url.get(), kCFURLPOSIXPathStyle));
+    RetainPtr<CFStringRef> pathCF = adoptCF(CFURLCopyFileSystemPath(url.get(), kCFURLPOSIXPathStyle));
     if (!pathCF)
         return;
 
@@ -697,7 +697,7 @@ void TestRunner::setViewModeMediaFeature(JSStringRef mode)
 
 void TestRunner::setPersistentUserStyleSheetLocation(JSStringRef jsURL)
 {
-    RetainPtr<CFStringRef> urlString(AdoptCF, JSStringCopyCFString(0, jsURL));
+    RetainPtr<CFStringRef> urlString = adoptCF(JSStringCopyCFString(0, jsURL));
     ::setPersistentUserStyleSheetLocation(urlString.get());
 }
 
index 20be9d9..461cd75 100644 (file)
@@ -46,16 +46,16 @@ TEST(WebKit2CustomProtocolsTest, SyncXHR)
     [NSURLProtocol registerClass:[TestProtocol class]];
     [WKBrowsingContextController registerSchemeForCustomProtocol:[TestProtocol scheme]];
 
-    RetainPtr<WKProcessGroup> processGroup(AdoptNS, [[WKProcessGroup alloc] init]);
-    RetainPtr<WKBrowsingContextGroup> browsingContextGroup(AdoptNS, [[WKBrowsingContextGroup alloc] initWithIdentifier:@"TestIdentifier"]);
+    RetainPtr<WKProcessGroup> processGroup = adoptNS([[WKProcessGroup alloc] init]);
+    RetainPtr<WKBrowsingContextGroup> browsingContextGroup = adoptNS([[WKBrowsingContextGroup alloc] initWithIdentifier:@"TestIdentifier"]);
 
     // Allow file URLs to load non-file resources
     WKRetainPtr<WKPreferencesRef> preferences(AdoptWK, WKPreferencesCreate());
     WKPreferencesSetUniversalAccessFromFileURLsAllowed(preferences.get(), true);
     WKPageGroupSetPreferences(browsingContextGroup.get()._pageGroupRef, preferences.get());
 
-    RetainPtr<WKView> wkView(AdoptNS, [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup.get() browsingContextGroup:browsingContextGroup.get()]);
-     RetainPtr<TestBrowsingContextLoadDelegate> delegate(AdoptNS, [[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {
+    RetainPtr<WKView> wkView = adoptNS([[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup.get() browsingContextGroup:browsingContextGroup.get()]);
+     RetainPtr<TestBrowsingContextLoadDelegate> delegate = adoptNS([[TestBrowsingContextLoadDelegate alloc] initWithBlockToRunOnLoad:^(WKBrowsingContextController *sender) {
          EXPECT_JS_EQ(wkView.get().pageRef, "window._testResult", "PASS");
          testFinished = true;
     }]);
index f869272..94bb7ef 100644 (file)
@@ -53,7 +53,7 @@ static void setValue3(id self, SEL _cmd, int* value)
 
 TEST(TestWebKitAPI, InstanceMethodSwizzler)
 {
-    RetainPtr<SimpleObject> object(AdoptNS, [[SimpleObject alloc] init]);
+    RetainPtr<SimpleObject> object = adoptNS([[SimpleObject alloc] init]);
 
     int value = 0;
 
index 0cd28c9..6dd7b6a 100644 (file)
@@ -38,13 +38,13 @@ TEST(RetainPtrHashing, HashSet)
 {
     HashSet<RetainPtr<CFStringRef> > set;
 
-    RetainPtr<CFStringRef> foo(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
+    RetainPtr<CFStringRef> foo = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
 
     EXPECT_FALSE(set.contains(foo));
     set.add(foo);
     EXPECT_TRUE(set.contains(foo));
 
-    RetainPtr<CFStringRef> foo2(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
+    RetainPtr<CFStringRef> foo2 = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
     EXPECT_FALSE(set.contains(foo2));
     set.add(foo2);
     EXPECT_TRUE(set.contains(foo2));
@@ -57,13 +57,13 @@ TEST(RetainPtrHashing, HashMapKey)
 {
     HashMap<RetainPtr<CFStringRef>, int> map;
 
-    RetainPtr<CFStringRef> foo(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
+    RetainPtr<CFStringRef> foo = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
 
     EXPECT_FALSE(map.contains(foo));
     map.add(foo, 1);
     EXPECT_EQ(1, map.get(foo));
 
-    RetainPtr<CFStringRef> foo2(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
+    RetainPtr<CFStringRef> foo2 = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
     EXPECT_FALSE(map.contains(foo2));
     map.add(foo2, 2);
     EXPECT_EQ(2, map.get(foo2));
@@ -76,13 +76,13 @@ TEST(RetainPtrHashing, HashMapValue)
 {
     HashMap<int, RetainPtr<CFStringRef> > map;
 
-    RetainPtr<CFStringRef> foo(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
+    RetainPtr<CFStringRef> foo = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
 
     EXPECT_FALSE(map.contains(1));
     map.add(1, foo);
     EXPECT_EQ(foo, map.get(1));
 
-    RetainPtr<CFStringRef> foo2(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
+    RetainPtr<CFStringRef> foo2 = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
     EXPECT_FALSE(map.contains(2));
     map.add(2, foo2);
     EXPECT_EQ(foo2, map.get(2));
index 4b08972..e5755d8 100644 (file)
@@ -127,8 +127,8 @@ TEST(WebKit2, FindMatches)
     WKPageFindStringMatches(webView.page(), findString.get(), true, 100);
     Util::run(&didCallFindStringMatches);
 
-    webkit1View.adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<FindMatchesWK1FrameLoadDelegate> frameLoadDelegate(AdoptNS, [FindMatchesWK1FrameLoadDelegate new]);
+    webkit1View = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<FindMatchesWK1FrameLoadDelegate> frameLoadDelegate = adoptNS([FindMatchesWK1FrameLoadDelegate new]);
 
     webkit1View.get().frameLoadDelegate = frameLoadDelegate.get();
     [webkit1View.get().mainFrame loadHTMLString:@"Test search. Hello <span id=\"target\">Hello</span> Hello!" baseURL:[NSURL URLWithString:@"about:blank"]];
index 7dea315..0e6b985 100644 (file)
@@ -48,8 +48,8 @@ static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messag
     // Do basic sanity checks on the returned webarchive. We have more thorough checks in LayoutTests.
     size_t size = WKDataGetSize(receivedData);
     const unsigned char* bytes = WKDataGetBytes(receivedData);
-    RetainPtr<CFDataRef> data(AdoptCF, CFDataCreate(0, bytes, size));
-    RetainPtr<CFPropertyListRef> propertyList(AdoptCF, CFPropertyListCreateWithData(0, data.get(), kCFPropertyListImmutable, 0, 0));
+    RetainPtr<CFDataRef> data = adoptCF(CFDataCreate(0, bytes, size));
+    RetainPtr<CFPropertyListRef> propertyList = adoptCF(CFPropertyListCreateWithData(0, data.get(), kCFPropertyListImmutable, 0, 0));
     EXPECT_TRUE(propertyList);
     
     // It should be a dictionary.
@@ -78,7 +78,7 @@ static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messag
     EXPECT_TRUE(resourceData);
     EXPECT_EQ(CFDataGetTypeID(), CFGetTypeID(resourceData));
     
-    RetainPtr<CFStringRef> stringData(AdoptCF, CFStringCreateFromExternalRepresentation(0, (CFDataRef)resourceData, kCFStringEncodingUTF8));
+    RetainPtr<CFStringRef> stringData = adoptCF(CFStringCreateFromExternalRepresentation(0, (CFDataRef)resourceData, kCFStringEncodingUTF8));
     EXPECT_TRUE(stringData);
     
     // It should contain the string "Simple HTML file." in it.
index 4afd72f..ea77051 100644 (file)
@@ -55,7 +55,7 @@ static void setInjectedBundleClient(WKContextRef context)
 
 static RetainPtr<SyntheticBackingScaleFactorWindow> createWindow()
 {
-    RetainPtr<SyntheticBackingScaleFactorWindow> window(AdoptNS, [[SyntheticBackingScaleFactorWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+    RetainPtr<SyntheticBackingScaleFactorWindow> window = adoptNS([[SyntheticBackingScaleFactorWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
     [window.get() setReleasedWhenClosed:NO];
     return window;
 }
@@ -64,7 +64,7 @@ TEST(WebKit2, GetBackingScaleFactor)
 {
     WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("GetBackingScaleFactorTest"));
     setInjectedBundleClient(context.get());
-    RetainPtr<WKView> view(AdoptNS, [[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) contextRef:context.get() pageGroupRef:0]);
+    RetainPtr<WKView> view = adoptNS([[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) contextRef:context.get() pageGroupRef:0]);
 
     RetainPtr<SyntheticBackingScaleFactorWindow> window1 = createWindow();
     [window1.get() setBackingScaleFactor:1];
index 8bd0c56..44a5b30 100644 (file)
@@ -34,7 +34,7 @@ TEST(WebKit2, DoNotCopyANullCFURLResponse)
 {
     // Neither of these calls should cause a crash.
     WKRetainPtr<WKURLResponseRef> nullWKResponse(AdoptWK, WKURLResponseCreateWithCFURLResponse(0));
-    RetainPtr<CFURLResponseRef> nullCFResponse(AdoptCF, WKURLResponseCopyCFURLResponse(kCFAllocatorDefault, nullWKResponse.get()));
+    RetainPtr<CFURLResponseRef> nullCFResponse = adoptCF(WKURLResponseCopyCFURLResponse(kCFAllocatorDefault, nullWKResponse.get()));
 }
 
 } // namespace TestWebKitAPI
index bc2f786..dec7888 100644 (file)
@@ -47,7 +47,7 @@ public:
 template <typename View>
 void AcceptsFirstMouse::runTest(View view)
 {
-    RetainPtr<NSWindow> window(AdoptNS, [[NSWindow alloc] initWithContentRect:view.frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+    RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:view.frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
     [[window.get() contentView] addSubview:view];
 
     CGFloat viewHeight = view.bounds.size.height;
index 18cce9c..6386cad 100644 (file)
@@ -52,8 +52,8 @@ static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
 
 TEST(WebKit1, AttributedStringTest)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<AttributedStringTest> testController(AdoptNS, [AttributedStringTest new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<AttributedStringTest> testController = adoptNS([AttributedStringTest new]);
     
     webView.get().frameLoadDelegate = testController.get();
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"attributedStringCustomFont" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
index 098453d..82ddb38 100644 (file)
@@ -54,8 +54,8 @@ namespace TestWebKitAPI {
 
 TEST(WebKit1, ReloadBackForward)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<BackForwardListTest> testController(AdoptNS, [BackForwardListTest new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<BackForwardListTest> testController = adoptNS([BackForwardListTest new]);
     webView.get().frameLoadDelegate = testController.get();
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://does-not-exist.example"]]];
     Util::run(&didFinishLoad);
index 3729eb5..9a19f93 100644 (file)
@@ -64,11 +64,11 @@ TEST(WebKit1, CancelLoadFromResourceLoadDelegate)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
 
-    RetainPtr<CancelLoadFromResourceLoadDelegate> resourceLoadDelegate(AdoptNS, [[CancelLoadFromResourceLoadDelegate alloc] init]);
+    RetainPtr<CancelLoadFromResourceLoadDelegate> resourceLoadDelegate = adoptNS([[CancelLoadFromResourceLoadDelegate alloc] init]);
     webView.get().resourceLoadDelegate = resourceLoadDelegate.get();
-    RetainPtr<CancelLoadFromResourceLoadDelegateFrameLoadDelegate> frameLoadDelegate(AdoptNS, [[CancelLoadFromResourceLoadDelegateFrameLoadDelegate alloc] init]);
+    RetainPtr<CancelLoadFromResourceLoadDelegateFrameLoadDelegate> frameLoadDelegate = adoptNS([[CancelLoadFromResourceLoadDelegateFrameLoadDelegate alloc] init]);
     webView.get().frameLoadDelegate = frameLoadDelegate.get();
 
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"CancelLoadFromResourceLoadDelegate" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
index 40ac377..f79535f 100644 (file)
@@ -88,9 +88,9 @@ static void contextMenuCopyLink(WebView* webView, int itemIndex)
 
 TEST(WebKit1, ContextMenuCanCopyURL)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0,0,800,600) frameName:nil groupName:nil]);
-    RetainPtr<NSWindow> window(AdoptNS, [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 800, 600) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
-    RetainPtr<ContextMenuCanCopyURLDelegate> delegate(AdoptNS, [[ContextMenuCanCopyURLDelegate alloc] init]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0,0,800,600) frameName:nil groupName:nil]);
+    RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 800, 600) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+    RetainPtr<ContextMenuCanCopyURLDelegate> delegate = adoptNS([[ContextMenuCanCopyURLDelegate alloc] init]);
 
     [window.get().contentView addSubview:webView.get()];
     webView.get().frameLoadDelegate = delegate.get();
index d9c24a7..2c8ca39 100644 (file)
@@ -56,8 +56,8 @@ static void expectCellAboveCell(DOMDocument *document, NSString *cellID, NSStrin
 
 TEST(WebKit1, HTMLTableCellElementCellAbove)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<HTMLTableCellElementCellAboveTest> testController(AdoptNS, [HTMLTableCellElementCellAboveTest new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<HTMLTableCellElementCellAboveTest> testController = adoptNS([HTMLTableCellElementCellAboveTest new]);
 
     webView.get().frameLoadDelegate = testController.get();
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle]
index 1e80805..a448517 100644 (file)
@@ -48,8 +48,8 @@ namespace TestWebKitAPI {
 
 TEST(WebKit1, DOMRangeOfString)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSZeroRect frameName:nil groupName:nil]);
-    RetainPtr<DOMRangeOfStringFrameLoadDelegate> frameLoadDelegate(AdoptNS, [DOMRangeOfStringFrameLoadDelegate new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSZeroRect frameName:nil groupName:nil]);
+    RetainPtr<DOMRangeOfStringFrameLoadDelegate> frameLoadDelegate = adoptNS([DOMRangeOfStringFrameLoadDelegate new]);
 
     webView.get().frameLoadDelegate = frameLoadDelegate.get();
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"DOMRangeOfString" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
@@ -74,7 +74,7 @@ TEST(WebKit1, DOMRangeOfString)
     resultRange = [webView.get() DOMRangeOfString:@"n" relativeTo:needleRange options:WebFindOptionsStartInSelection];
     EXPECT_EQ(28, resultRange.startOffset);
 
-    RetainPtr<WebView> otherWebView(AdoptNS, [[WebView alloc] initWithFrame:NSZeroRect frameName:nil groupName:nil]);
+    RetainPtr<WebView> otherWebView = adoptNS([[WebView alloc] initWithFrame:NSZeroRect frameName:nil groupName:nil]);
     DOMRange *foreignRange = [[[otherWebView.get() mainFrame] DOMDocument] createRange];
     resultRange = [webView.get() DOMRangeOfString:@"needle" relativeTo:foreignRange options:0];
     EXPECT_EQ(nil, resultRange);
index f203564..68ecbf8 100644 (file)
@@ -53,12 +53,12 @@ namespace TestWebKitAPI {
 TEST(WebKit1, DeviceScaleFactorInDashboardRegions)
 {
     NSRect viewFrame = NSMakeRect(0, 0, 800, 600);
-    RetainPtr<SyntheticBackingScaleFactorWindow> window(AdoptNS, [[SyntheticBackingScaleFactorWindow alloc] initWithContentRect:viewFrame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+    RetainPtr<SyntheticBackingScaleFactorWindow> window = adoptNS([[SyntheticBackingScaleFactorWindow alloc] initWithContentRect:viewFrame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
     [window.get() setReleasedWhenClosed:NO];
     [window.get() setBackingScaleFactor:2];
 
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:viewFrame frameName:nil groupName:nil]);
-    RetainPtr<DeviceScaleFactorInDashboardRegionsUIDelegate> uiDelegate(AdoptNS, [DeviceScaleFactorInDashboardRegionsUIDelegate new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:viewFrame frameName:nil groupName:nil]);
+    RetainPtr<DeviceScaleFactorInDashboardRegionsUIDelegate> uiDelegate = adoptNS([DeviceScaleFactorInDashboardRegionsUIDelegate new]);
     webView.get().UIDelegate = uiDelegate.get();
     [window.get().contentView addSubview:webView.get()];
 
index 154b8c3..8c45428 100644 (file)
@@ -50,7 +50,7 @@ public:
 
 RetainPtr<SyntheticBackingScaleFactorWindow> DeviceScaleFactorOnBack::createWindow()
 {
-    RetainPtr<SyntheticBackingScaleFactorWindow> window(AdoptNS, [[SyntheticBackingScaleFactorWindow alloc] initWithContentRect:viewFrame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+    RetainPtr<SyntheticBackingScaleFactorWindow> window = adoptNS([[SyntheticBackingScaleFactorWindow alloc] initWithContentRect:viewFrame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
     [window.get() setReleasedWhenClosed:NO];
     return window;
 }
index d0ebd51..61a1efe 100644 (file)
@@ -47,7 +47,7 @@ public:
 
 RetainPtr<SyntheticBackingScaleFactorWindow> DynamicDeviceScaleFactor::createWindow()
 {
-    RetainPtr<SyntheticBackingScaleFactorWindow> window(AdoptNS, [[SyntheticBackingScaleFactorWindow alloc] initWithContentRect:viewFrame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
+    RetainPtr<SyntheticBackingScaleFactorWindow> window = adoptNS([[SyntheticBackingScaleFactorWindow alloc] initWithContentRect:viewFrame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]);
     [window.get() setReleasedWhenClosed:NO];
     return window;
 }
index 50aafee..62cb797 100644 (file)
@@ -50,8 +50,8 @@ namespace TestWebKitAPI {
 
 TEST(WebKit1, HTMLCollectionNamedItemTest)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<HTMLCollectionNamedItemTest> testController(AdoptNS, [HTMLCollectionNamedItemTest new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<HTMLCollectionNamedItemTest> testController = adoptNS([HTMLCollectionNamedItemTest new]);
 
     webView.get().frameLoadDelegate = testController.get();
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle]
index cf2da2d..a716ab9 100644 (file)
@@ -50,8 +50,8 @@ namespace TestWebKitAPI {
 
 TEST(WebKit1, HTMLFormCollectionNamedItemTest)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<HTMLFormCollectionNamedItemTest> testController(AdoptNS, [HTMLFormCollectionNamedItemTest new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<HTMLFormCollectionNamedItemTest> testController = adoptNS([HTMLFormCollectionNamedItemTest new]);
 
     webView.get().frameLoadDelegate = testController.get();
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle]
index 0a51e2f..5f2205b 100644 (file)
@@ -52,8 +52,8 @@ namespace TestWebKitAPI {
 
 TEST(WebKit1, InspectorBarTest)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<InspectorBarController> inspectorBarController(AdoptNS, [InspectorBarController new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<InspectorBarController> inspectorBarController = adoptNS([InspectorBarController new]);
 
     webView.get().frameLoadDelegate = inspectorBarController.get();
     [webView.get().mainFrame loadHTMLString:@"<body contenteditable style=\"color: green\"><u>Lorem ipsum sit amet</u></body>" baseURL:[NSURL URLWithString:@"about:blank"]];
index aeb9555..e2ecdea 100644 (file)
@@ -74,9 +74,9 @@ TEST(WebKit1, MemoryCacheDisableWithinResourceLoadDelegate)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
 
-    RetainPtr<MemoryCacheDisableTestResourceLoadDelegate> resourceLoadDelegate(AdoptNS, [[MemoryCacheDisableTestResourceLoadDelegate alloc] init]);
+    RetainPtr<MemoryCacheDisableTestResourceLoadDelegate> resourceLoadDelegate = adoptNS([[MemoryCacheDisableTestResourceLoadDelegate alloc] init]);
     webView.get().resourceLoadDelegate = resourceLoadDelegate.get();
 
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"MemoryCacheDisableWithinResourceLoadDelegate" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
index cf3d311..212820e 100644 (file)
@@ -79,13 +79,13 @@ TEST(WebKit1, DISABLED_MemoryCachePruneWithinResourceLoadDelegate)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-    RetainPtr<WebView> webView1(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<WebView> webView2(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<WebView> webView1 = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<WebView> webView2 = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
 
     NSWindow* window = [[NSWindow alloc] initWithContentRect:webView2.get().frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
     [window.contentView addSubview:webView2.get()];
 
-    RetainPtr<MemoryCachePruneTestResourceLoadDelegate> resourceLoadDelegate(AdoptNS, [[MemoryCachePruneTestResourceLoadDelegate alloc] init]);
+    RetainPtr<MemoryCachePruneTestResourceLoadDelegate> resourceLoadDelegate = adoptNS([[MemoryCachePruneTestResourceLoadDelegate alloc] init]);
     resourceLoadDelegate.get()->_window = window;
     webView1.get().resourceLoadDelegate = resourceLoadDelegate.get();
 
index cec138c..f08d3b7 100644 (file)
@@ -111,7 +111,7 @@ void PageVisibilityStateWithWindowChanges::runTest(View view)
     EXPECT_JS_EQ(view, "document.webkitVisibilityState", "hidden");
 
     // Add it to a non-visible window. PageVisibility should still be "hidden".
-    RetainPtr<NSWindow> window(AdoptNS, [[NSWindow alloc] initWithContentRect:view.frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
+    RetainPtr<NSWindow> window = adoptNS([[NSWindow alloc] initWithContentRect:view.frame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
     [window.get().contentView addSubview:view];
     EXPECT_NOT_NULL([view window]);
     EXPECT_NOT_NULL([view superview]);
index 5ad43bd..bc3a11d 100644 (file)
@@ -48,8 +48,8 @@ namespace TestWebKitAPI {
 
 TEST(WebKit1, RenderedImageFromDOMRange)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<RenderedImageFromDOMRangeFrameLoadDelegate> frameLoadDelegate(AdoptNS, [RenderedImageFromDOMRangeFrameLoadDelegate new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<RenderedImageFromDOMRangeFrameLoadDelegate> frameLoadDelegate = adoptNS([RenderedImageFromDOMRangeFrameLoadDelegate new]);
 
     webView.get().frameLoadDelegate = frameLoadDelegate.get();
     [webView.get().mainFrame loadHTMLString:@"<div style=\"width: 100px;\">Lorem <span id=\"target\">ipsum dolor</span> sit amet</div>" baseURL:[NSURL URLWithString:@"about:blank"]];
index eed1f81..0037552 100644 (file)
@@ -39,7 +39,7 @@ TEST(WebKit1, SetAndUpdateCacheModelInitialModel)
 {
     EXPECT_EQ((int)WebCacheModelDocumentViewer, (int)[WebView _cacheModel]);
 
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
 
     EXPECT_EQ((int)WebCacheModelDocumentBrowser, (int)[WebView _cacheModel]);
 }
@@ -64,7 +64,7 @@ TEST(WebKit1, SetAndUpdateCacheModelPreferencesChangeMix)
     EXPECT_EQ((int)WebCacheModelDocumentViewer, (int)[WebView _cacheModel]);
 
     WebPreferences *standardPreferences = [WebPreferences standardPreferences];
-    RetainPtr<WebPreferences> customPreferences(AdoptNS, [[WebPreferences alloc] initWithIdentifier:@"SetAndUpdateCacheModelPreferencesChangeMix"]);
+    RetainPtr<WebPreferences> customPreferences = adoptNS([[WebPreferences alloc] initWithIdentifier:@"SetAndUpdateCacheModelPreferencesChangeMix"]);
 
     // 1) The customPreferences is not set on a view.
     EXPECT_EQ((int)WebCacheModelDocumentBrowser, (int)[WebView _cacheModel]);
@@ -79,7 +79,7 @@ TEST(WebKit1, SetAndUpdateCacheModelPreferencesChangeMix)
 
 
     // 2) The cache model should follow the highest value of cache model between the two preferences.
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
     [webView.get() setPreferences:customPreferences.get()];
     EXPECT_EQ((int)WebCacheModelPrimaryWebBrowser, (int)[WebView _cacheModel]);
 
index f077ed9..44ecc3e 100644 (file)
@@ -49,8 +49,8 @@ namespace TestWebKitAPI {
 
 TEST(WebKit1, SetDocumentURITestFile)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<SetDocumentURITest> testController(AdoptNS, [SetDocumentURITest new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<SetDocumentURITest> testController = adoptNS([SetDocumentURITest new]);
     webView.get().frameLoadDelegate = testController.get();
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"SetDocumentURI" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
     Util::run(&didFinishLoad);
@@ -66,8 +66,8 @@ TEST(WebKit1, SetDocumentURITestFile)
 
 TEST(WebKit1, SetDocumentURITestURL)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<SetDocumentURITest> testController(AdoptNS, [SetDocumentURITest new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<SetDocumentURITest> testController = adoptNS([SetDocumentURITest new]);
     webView.get().frameLoadDelegate = testController.get();
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"SetDocumentURI" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
     Util::run(&didFinishLoad);
@@ -86,8 +86,8 @@ TEST(WebKit1, SetDocumentURITestURL)
 
 TEST(WebKit1, SetDocumentURITestString)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<SetDocumentURITest> testController(AdoptNS, [SetDocumentURITest new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<SetDocumentURITest> testController = adoptNS([SetDocumentURITest new]);
     webView.get().frameLoadDelegate = testController.get();
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"SetDocumentURI" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
     Util::run(&didFinishLoad);
@@ -103,8 +103,8 @@ TEST(WebKit1, SetDocumentURITestString)
 
 TEST(WebKit1, SetDocumentURITestNull)
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<SetDocumentURITest> testController(AdoptNS, [SetDocumentURITest new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<SetDocumentURITest> testController = adoptNS([SetDocumentURITest new]);
     webView.get().frameLoadDelegate = testController.get();
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"SetDocumentURI" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
     Util::run(&didFinishLoad);
index 70ec47d..9d443ad 100644 (file)
@@ -49,9 +49,9 @@ namespace TestWebKitAPI {
 
 TEST(WebKit1, SimplifyMarkupTest)
 {
-    RetainPtr<WebView> webView1(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<WebView> webView2(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<SimplifyMarkupTest> testController(AdoptNS, [SimplifyMarkupTest new]);
+    RetainPtr<WebView> webView1 = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<WebView> webView2 = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<SimplifyMarkupTest> testController = adoptNS([SimplifyMarkupTest new]);
     
     webView1.get().frameLoadDelegate = testController.get();
     [[webView1.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"verboseMarkup" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
index 4e3e3ec..260a5a5 100644 (file)
@@ -32,7 +32,7 @@ namespace TestWebKitAPI {
 TEST(WebKit1, StringByEvaluatingJavaScriptFromString)
 {
     // maps expected result <= JavaScript expression
-    RetainPtr<NSDictionary> expressions(AdoptNS, [[NSDictionary alloc] initWithObjectsAndKeys:
+    RetainPtr<NSDictionary> expressions = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:
         @"0", @"0",
         @"0", @"'0'",
         @"", @"",
@@ -53,7 +53,7 @@ TEST(WebKit1, StringByEvaluatingJavaScriptFromString)
         nil
     ]);
 
-    RetainPtr<WebView> webView (AdoptNS, [[WebView alloc] initWithFrame:NSZeroRect frameName:@"" groupName:@""]);
+    RetainPtr<WebView> webView  = adoptNS([[WebView alloc] initWithFrame:NSZeroRect frameName:@"" groupName:@""]);
 
     // Test a nil string
     NSString *result = [webView.get() stringByEvaluatingJavaScriptFromString:nil];
index 7545941..1654f9c 100644 (file)
@@ -60,7 +60,7 @@ namespace TestWebKitAPI {
 TEST(WebKit1, WillSendSubmitEvent)
 {
     @autoreleasepool {
-        RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+        RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
 
         RetainPtr<FormDelegate> formDelegate = [[FormDelegate alloc] init];
         [webView _setFormDelegate:formDelegate.get()];
index bf593e6..9225783 100644 (file)
@@ -65,8 +65,8 @@ TEST(WebKit1, WindowlessWebViewWithMedia)
 {
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
-    RetainPtr<WindowlessWebViewWithMediaFrameLoadDelegate> testController(AdoptNS, [WindowlessWebViewWithMediaFrameLoadDelegate new]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
+    RetainPtr<WindowlessWebViewWithMediaFrameLoadDelegate> testController = adoptNS([WindowlessWebViewWithMediaFrameLoadDelegate new]);
     webView.get().frameLoadDelegate = testController.get();
     [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"WindowlessWebViewWithMedia" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
 
index 979f4cd..1e73adb 100644 (file)
@@ -67,7 +67,7 @@ WKURLRef URLForNonExistentResource()
 
 WKRetainPtr<WKStringRef> MIMETypeForWKURLResponse(WKURLResponseRef wkResponse)
 {
-    RetainPtr<NSURLResponse> response(AdoptNS, WKURLResponseCopyNSURLResponse(wkResponse));
+    RetainPtr<NSURLResponse> response = adoptNS(WKURLResponseCopyNSURLResponse(wkResponse));
     return adoptWK(WKStringCreateWithCFString((CFStringRef)[response.get() MIMEType]));
 }
 
index ce25a84..03552b3 100644 (file)
@@ -83,8 +83,8 @@ WebKitAgnosticTest::WebKitAgnosticTest()
 
 void WebKitAgnosticTest::runWebKit1Test()
 {
-    RetainPtr<WebView> webView(AdoptNS, [[WebView alloc] initWithFrame:viewFrame]);
-    RetainPtr<FrameLoadDelegate> delegate(AdoptNS, [[FrameLoadDelegate alloc] initWithDidFinishLoadBoolean:&didFinishLoad]);
+    RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:viewFrame]);
+    RetainPtr<FrameLoadDelegate> delegate = adoptNS([[FrameLoadDelegate alloc] initWithDidFinishLoadBoolean:&didFinishLoad]);
     [webView.get() setFrameLoadDelegate:delegate.get()];
     initializeView(webView.get());
 
@@ -98,7 +98,7 @@ void WebKitAgnosticTest::runWebKit2Test()
 {
     WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreate());
     WKRetainPtr<WKPageGroupRef> pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(Util::toWK("WebKitAgnosticTest").get()));
-    RetainPtr<WKView> view(AdoptNS, [[WKView alloc] initWithFrame:viewFrame contextRef:context.get() pageGroupRef:pageGroup.get()]);
+    RetainPtr<WKView> view = adoptNS([[WKView alloc] initWithFrame:viewFrame contextRef:context.get() pageGroupRef:pageGroup.get()]);
     setPageLoaderClient([view.get() pageRef], &didFinishLoad);
     initializeView(view.get());
 
index b0cb4e0..418d513 100644 (file)
@@ -41,12 +41,12 @@ using namespace WTF;
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
 static String testPathFromURL(WKURLRef url)
 {
-    RetainPtr<CFURLRef> cfURL(AdoptCF, WKURLCopyCFURL(kCFAllocatorDefault, url));
+    RetainPtr<CFURLRef> cfURL = adoptCF(WKURLCopyCFURL(kCFAllocatorDefault, url));
     if (!cfURL)
         return String();
 
-    RetainPtr<CFStringRef> schemeCFString(AdoptCF, CFURLCopyScheme(cfURL.get()));
-    RetainPtr<CFStringRef> pathCFString(AdoptCF, CFURLCopyPath(cfURL.get()));
+    RetainPtr<CFStringRef> schemeCFString = adoptCF(CFURLCopyScheme(cfURL.get()));
+    RetainPtr<CFStringRef> pathCFString = adoptCF(CFURLCopyPath(cfURL.get()));
 
     String schemeString(schemeCFString.get());
     String pathString(pathCFString.get());
@@ -63,7 +63,7 @@ static String testPathFromURL(WKURLRef url)
     if (!equalIgnoringCase(schemeString, "http") && !equalIgnoringCase(schemeString, "https"))
         return String();
 
-    RetainPtr<CFStringRef> hostCFString(AdoptCF, CFURLCopyHostName(cfURL.get()));
+    RetainPtr<CFStringRef> hostCFString = adoptCF(CFURLCopyHostName(cfURL.get()));
     String hostString(hostCFString.get());
     if (hostString == "127.0.0.1"  && (CFURLGetPortNumber(cfURL.get()) == 8000 || CFURLGetPortNumber(cfURL.get()) == 8443))
         return pathString;
index dca27e6..c9bf3ca 100644 (file)
@@ -52,7 +52,7 @@ void TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded()
     if (m_waitToDumpWatchdogTimer)
         return;
 
-    m_waitToDumpWatchdogTimer.adoptCF(CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + waitToDumpWatchdogTimerInterval, 0, 0, 0, WTR::waitUntilDoneWatchdogTimerFired, NULL));
+    m_waitToDumpWatchdogTimer = adoptCF(CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + waitToDumpWatchdogTimerInterval, 0, 0, 0, WTR::waitUntilDoneWatchdogTimerFired, NULL));
     CFRunLoopAddTimer(CFRunLoopGetCurrent(), m_waitToDumpWatchdogTimer.get(), kCFRunLoopCommonModes);
 }
 
index 99355f0..4e60aeb 100644 (file)
@@ -52,14 +52,14 @@ enum FlipGraphicsContextOrNot {
 
 static CGContextRef createCGContextFromImage(WKImageRef wkImage, FlipGraphicsContextOrNot flip = DontFlipGraphicsContext)
 {
-    RetainPtr<CGImageRef> image(AdoptCF, WKImageCreateCGImage(wkImage));
+    RetainPtr<CGImageRef> image = adoptCF(WKImageCreateCGImage(wkImage));
 
     size_t pixelsWide = CGImageGetWidth(image.get());
     size_t pixelsHigh = CGImageGetHeight(image.get());
     size_t rowBytes = (4 * pixelsWide + 63) & ~63;
 
     // Creating this bitmap in the device color space should prevent any color conversion when the image of the web view is drawn into it.
-    RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
+    RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
     CGContextRef context = CGBitmapContextCreate(0, pixelsWide, pixelsHigh, 8, rowBytes, colorSpace.get(), kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
     
     if (flip == FlipGraphicsContext) {
@@ -113,9 +113,9 @@ void computeMD5HashStringForContext(CGContextRef bitmapContext, char hashString[
 
 static void dumpBitmap(CGContextRef bitmapContext, const char* checksum)
 {
-    RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(bitmapContext));
-    RetainPtr<CFMutableDataRef> imageData(AdoptCF, CFDataCreateMutable(0, 0));
-    RetainPtr<CGImageDestinationRef> imageDest(AdoptCF, CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0));
+    RetainPtr<CGImageRef> image = adoptCF(CGBitmapContextCreateImage(bitmapContext));
+    RetainPtr<CFMutableDataRef> imageData = adoptCF(CFDataCreateMutable(0, 0));
+    RetainPtr<CGImageDestinationRef> imageDest = adoptCF(CGImageDestinationCreateWithData(imageData.get(), kUTTypePNG, 1, 0));
     CGImageDestinationAddImage(imageDest.get(), image.get(), 0);
     CGImageDestinationFinalize(imageDest.get());
 
@@ -165,9 +165,9 @@ void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayR
 
     RetainPtr<CGContextRef> context;
     if (windowSnapshot)
-        context.adoptCF(createCGContextFromImage(windowSnapshot.get(), DontFlipGraphicsContext));
+        context = adoptCF(createCGContextFromImage(windowSnapshot.get(), DontFlipGraphicsContext));
     else
-        context.adoptCF(createCGContextFromImage(image));
+        context = adoptCF(createCGContextFromImage(image));
 
     // A non-null repaintRects array means we're doing a repaint test.
     if (repaintRects)
index 87c1cf7..6723f9a 100644 (file)
@@ -417,7 +417,7 @@ void EventSenderProxy::keyDown(WKStringRef key, WKEventModifiers modifiers, unsi
 
 void EventSenderProxy::mouseScrollBy(int x, int y)
 {
-    RetainPtr<CGEventRef> cgScrollEvent(AdoptCF, CGEventCreateScrollWheelEvent(0, kCGScrollEventUnitLine, 2, y, x));
+    RetainPtr<CGEventRef> cgScrollEvent = adoptCF(CGEventCreateScrollWheelEvent(0, kCGScrollEventUnitLine, 2, y, x));
 
     // CGEvent locations are in global display coordinates.
     CGPoint lastGlobalMousePosition = CGPointMake(m_position.x, [[NSScreen mainScreen] frame].size.height - m_position.y);
index 877de76..60b8872 100644 (file)
@@ -220,7 +220,7 @@ void PlatformWebView::makeWebViewFirstResponder()
 WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
 {
     [m_view display];
-    RetainPtr<CGImageRef> windowSnapshotImage(AdoptCF, CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [m_window windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque));
+    RetainPtr<CGImageRef> windowSnapshotImage = adoptCF(CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [m_window windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque));
 
     // windowSnapshotImage will be in GenericRGB, as we've set the main display's color space to GenericRGB.
     return adoptWK(WKImageCreateFromCGImage(windowSnapshotImage.get(), 0));
index 8f2eaaf..6e80f56 100644 (file)
@@ -135,11 +135,11 @@ void TestController::initializeInjectedBundlePath()
 
 void TestController::initializeTestPluginDirectory()
 {
-    RetainPtr<CFURLRef> bundleURL(AdoptCF, CFBundleCopyExecutableURL(CFBundleGetMainBundle()));
-    RetainPtr<CFURLRef> bundleDirectoryURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(0, bundleURL.get()));
-    RetainPtr<CFStringRef> testPluginDirectoryNameString(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(testPluginDirectoryName), wcslen(testPluginDirectoryName)));
-    RetainPtr<CFURLRef> testPluginDirectoryURL(AdoptCF, CFURLCreateCopyAppendingPathComponent(0, bundleDirectoryURL.get(), testPluginDirectoryNameString.get(), true));
-    RetainPtr<CFStringRef> testPluginDirectoryPath(AdoptCF, CFURLCopyFileSystemPath(testPluginDirectoryURL.get(), kCFURLWindowsPathStyle));
+    RetainPtr<CFURLRef> bundleURL = adoptCF(CFBundleCopyExecutableURL(CFBundleGetMainBundle()));
+    RetainPtr<CFURLRef> bundleDirectoryURL = adoptCF(CFURLCreateCopyDeletingLastPathComponent(0, bundleURL.get()));
+    RetainPtr<CFStringRef> testPluginDirectoryNameString = adoptCF(CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(testPluginDirectoryName), wcslen(testPluginDirectoryName)));
+    RetainPtr<CFURLRef> testPluginDirectoryURL = adoptCF(CFURLCreateCopyAppendingPathComponent(0, bundleDirectoryURL.get(), testPluginDirectoryNameString.get(), true));
+    RetainPtr<CFStringRef> testPluginDirectoryPath = adoptCF(CFURLCopyFileSystemPath(testPluginDirectoryURL.get(), kCFURLWindowsPathStyle));
     m_testPluginDirectory.adopt(WKStringCreateWithCFString(testPluginDirectoryPath.get()));
 }