https://bugs.webkit.org/show_bug.cgi?id=100419
Reviewed by Andreas Kling.
Source/WebCore:
Update callers of String::createCFString.
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::callObjCFallbackObject):
* html/HTMLMediaElement.cpp:
(WebCore::createFileURLForApplicationCacheResource):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::createPropertyListRepresentation):
* platform/LocalizedStrings.cpp:
(WebCore::formatLocalizedString):
(WebCore::contextMenuItemTagLookUpInDictionary):
(WebCore::keygenKeychainItemName):
(WebCore::imageTitle):
* platform/RuntimeApplicationChecks.cpp:
(WebCore::mainBundleIsEqualTo):
* platform/cf/FileSystemCF.cpp:
(WebCore::fileSystemRepresentation):
(WebCore::pathAsURL):
* platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
(PlatformCAAnimation::PlatformCAAnimation):
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(resubmitAllAnimations):
(PlatformCALayer::addAnimationForKey):
(PlatformCALayer::removeAnimationForKey):
(PlatformCALayer::setName):
* platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
(PlatformCALayerWinInternal::updateTiles):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::utiFromMIMEType):
* platform/graphics/cg/ImageSourceCGMac.mm:
(WebCore::MIMETypeForImageSourceType):
(WebCore::preferredExtensionForImageSourceType):
* platform/mac/ClipboardMac.mm:
(WebCore::cocoaTypeFromHTMLClipboardType):
(WebCore::utiTypeFromCocoaType):
* platform/mac/SSLKeyGeneratorMac.cpp:
(WebCore::signedPublicKeyAndChallengeString):
* platform/network/cf/AuthenticationCF.cpp:
(WebCore::createCF):
* platform/network/cf/CookieJarCFNet.cpp:
(WebCore::setCookies):
* platform/network/cf/DNSCFNet.cpp:
(WebCore::DNSResolveQueue::platformResolve):
* platform/network/cf/ResourceErrorCF.cpp:
(WebCore::ResourceError::cfError):
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::setDefaultMIMEType):
(WebCore::willSendRequest):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::setPrivateBrowsingEnabled):
* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::setHeaderFields):
(WebCore::ResourceRequest::doUpdatePlatformRequest):
* platform/network/cf/ResourceResponseCFNet.cpp:
(WebCore::ResourceResponse::cfURLResponse):
* platform/network/cf/SocketStreamHandleCFNet.cpp:
(WebCore::SocketStreamHandle::createStreams):
(WebCore::SocketStreamHandle::addCONNECTCredentials):
(WebCore::SocketStreamHandle::copyCFStreamDescription):
* platform/network/mac/ResourceRequestMac.mm:
(WebCore::ResourceRequest::doUpdatePlatformRequest):
* platform/network/mac/WebCoreURLResponse.mm:
(WebCore::adjustMIMETypeIfNecessary):
* platform/text/cf/HyphenationCF.cpp:
(WebCore::::createValueForKey):
* platform/text/cf/StringCF.cpp:
(WTF::String::createCFString):
* platform/text/cf/StringImplCF.cpp:
(WTF::StringImpl::createCFString):
* platform/text/mac/StringImplMac.mm:
(WTF::StringImpl::operator NSString *):
* platform/text/mac/TextCodecMac.cpp:
(WebCore::TextCodecMac::encode):
* platform/win/SearchPopupMenuWin.cpp:
(WebCore::autosaveKey):
(WebCore::SearchPopupMenuWin::saveRecentSearches):
Source/WebKit/cf:
Update callers of String::createCFString.
* WebCoreSupport/WebInspectorClientCF.cpp:
(createKeyForPreferences):
(populateSetting):
(storeSetting):
Source/WebKit/win:
Update callers of String::createCFString.
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::dispatchDidFailToStartPlugin):
* WebDatabaseManager.cpp:
(WebDatabaseManager::dispatchDidModifyDatabase):
* WebHistory.cpp:
(WebHistory::visitedURL):
(WebHistory::itemForURLString):
* WebHistoryItem.cpp:
(WebHistoryItem::dictionaryRepresentation):
* WebIconDatabase.cpp:
(WebIconDatabase::iconDatabaseNotificationUserInfoURLKey):
(postDidAddIconNotification):
* WebLocalizableStrings.cpp:
(createWebKitBundle):
(copyLocalizedStringFromBundle):
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings):
* WebView.cpp:
(WebView::setCacheModel):
(WebView::notifyPreferencesChanged):
Source/WebKit2:
Update callers of String::createCFString.
* Platform/mac/ModuleMac.mm:
(WebKit::Module::load):
* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::initializeSandbox):
* Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
(WebKit::NetscapePluginModule::getPluginInfo):
(WebKit::NetscapePluginModule::createPluginMIMETypesPreferences):
* UIProcess/cf/WebBackForwardListCF.cpp:
(WebKit::WebBackForwardList::createCFDictionaryRepresentation):
* UIProcess/cf/WebPageProxyCF.cpp:
(WebKit::WebPageProxy::sessionStateData):
(WebKit::autosaveKey):
(WebKit::WebPageProxy::saveRecentSearches):
* WebProcess/ResourceCache/WebResourceCacheManager.cpp:
(WebKit::WebResourceCacheManager::clearCacheForOrigin):
* WebProcess/WebPage/win/WebPageWin.cpp:
(WebKit::cachedResponseForURL):
* WebProcess/win/WebProcessWin.cpp:
(WebKit::WebProcess::platformSetCacheModel):
(WebKit::WebProcess::platformInitializeWebProcess):
Source/WTF:
Make String::createCFString and StringImpl::createCFString return RetainPtrs.
* wtf/text/AtomicString.h:
* wtf/text/StringImpl.h:
* wtf/text/WTFString.h:
Tools:
Update callers of String::createCFString.
* WebKitTestRunner/InjectedBundle/mac/InjectedBundlePageMac.mm:
(WTR::InjectedBundlePage::platformDidStartProvisionalLoadForFrame):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@132916
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-10-29 Anders Carlsson <andersca@apple.com>
+
+ String::createCFString should return a RetainPtr
+ https://bugs.webkit.org/show_bug.cgi?id=100419
+
+ Reviewed by Andreas Kling.
+
+ Make String::createCFString and StringImpl::createCFString return RetainPtrs.
+
+ * wtf/text/AtomicString.h:
+ * wtf/text/StringImpl.h:
+ * wtf/text/WTFString.h:
+
2012-10-30 Mark Rowe <mrowe@apple.com>
Fix WTF to not install a few header files in bogus locations.
class MemoryObjectInfo;
struct SubstringTranslator;
struct UCharBufferTranslator;
+template<typename> class RetainPtr;
enum TextCaseSensitivity { TextCaseSensitive, TextCaseInsensitive };
WTF_EXPORT_STRING_API WTF::Unicode::Direction defaultWritingDirection(bool* hasStrongDirectionality = 0);
#if USE(CF)
- CFStringRef createCFString();
+ RetainPtr<CFStringRef> createCFString();
#endif
#ifdef __OBJC__
operator NSString*();
#include <objc/objc.h>
#endif
-#if USE(CF)
-typedef const struct __CFString * CFStringRef;
-#endif
-
#if PLATFORM(QT)
QT_BEGIN_NAMESPACE
class QString;
#if USE(CF)
String(CFStringRef);
- CFStringRef createCFString() const;
+ RetainPtr<CFStringRef> createCFString() const;
#endif
#ifdef __OBJC__
+2012-10-29 Anders Carlsson <andersca@apple.com>
+
+ String::createCFString should return a RetainPtr
+ https://bugs.webkit.org/show_bug.cgi?id=100419
+
+ Reviewed by Andreas Kling.
+
+ Update callers of String::createCFString.
+
+ * bridge/objc/objc_runtime.mm:
+ (JSC::Bindings::callObjCFallbackObject):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::createFileURLForApplicationCacheResource):
+ * loader/archive/cf/LegacyWebArchive.cpp:
+ (WebCore::LegacyWebArchive::createPropertyListRepresentation):
+ * platform/LocalizedStrings.cpp:
+ (WebCore::formatLocalizedString):
+ (WebCore::contextMenuItemTagLookUpInDictionary):
+ (WebCore::keygenKeychainItemName):
+ (WebCore::imageTitle):
+ * platform/RuntimeApplicationChecks.cpp:
+ (WebCore::mainBundleIsEqualTo):
+ * platform/cf/FileSystemCF.cpp:
+ (WebCore::fileSystemRepresentation):
+ (WebCore::pathAsURL):
+ * platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
+ (PlatformCAAnimation::PlatformCAAnimation):
+ * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+ (resubmitAllAnimations):
+ (PlatformCALayer::addAnimationForKey):
+ (PlatformCALayer::removeAnimationForKey):
+ (PlatformCALayer::setName):
+ * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
+ (PlatformCALayerWinInternal::updateTiles):
+ * platform/graphics/cg/ImageBufferCG.cpp:
+ (WebCore::utiFromMIMEType):
+ * platform/graphics/cg/ImageSourceCGMac.mm:
+ (WebCore::MIMETypeForImageSourceType):
+ (WebCore::preferredExtensionForImageSourceType):
+ * platform/mac/ClipboardMac.mm:
+ (WebCore::cocoaTypeFromHTMLClipboardType):
+ (WebCore::utiTypeFromCocoaType):
+ * platform/mac/SSLKeyGeneratorMac.cpp:
+ (WebCore::signedPublicKeyAndChallengeString):
+ * platform/network/cf/AuthenticationCF.cpp:
+ (WebCore::createCF):
+ * platform/network/cf/CookieJarCFNet.cpp:
+ (WebCore::setCookies):
+ * platform/network/cf/DNSCFNet.cpp:
+ (WebCore::DNSResolveQueue::platformResolve):
+ * platform/network/cf/ResourceErrorCF.cpp:
+ (WebCore::ResourceError::cfError):
+ * platform/network/cf/ResourceHandleCFNet.cpp:
+ (WebCore::setDefaultMIMEType):
+ (WebCore::willSendRequest):
+ (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
+ (WebCore::ResourceHandle::setPrivateBrowsingEnabled):
+ * platform/network/cf/ResourceRequestCFNet.cpp:
+ (WebCore::setHeaderFields):
+ (WebCore::ResourceRequest::doUpdatePlatformRequest):
+ * platform/network/cf/ResourceResponseCFNet.cpp:
+ (WebCore::ResourceResponse::cfURLResponse):
+ * platform/network/cf/SocketStreamHandleCFNet.cpp:
+ (WebCore::SocketStreamHandle::createStreams):
+ (WebCore::SocketStreamHandle::addCONNECTCredentials):
+ (WebCore::SocketStreamHandle::copyCFStreamDescription):
+ * platform/network/mac/ResourceRequestMac.mm:
+ (WebCore::ResourceRequest::doUpdatePlatformRequest):
+ * platform/network/mac/WebCoreURLResponse.mm:
+ (WebCore::adjustMIMETypeIfNecessary):
+ * platform/text/cf/HyphenationCF.cpp:
+ (WebCore::::createValueForKey):
+ * platform/text/cf/StringCF.cpp:
+ (WTF::String::createCFString):
+ * platform/text/cf/StringImplCF.cpp:
+ (WTF::StringImpl::createCFString):
+ * platform/text/mac/StringImplMac.mm:
+ (WTF::StringImpl::operator NSString *):
+ * platform/text/mac/TextCodecMac.cpp:
+ (WebCore::TextCodecMac::encode):
+ * platform/win/SearchPopupMenuWin.cpp:
+ (WebCore::autosaveKey):
+ (WebCore::SearchPopupMenuWin::saveRecentSearches):
+
2012-10-30 Chris Fleizach <cfleizach@apple.com>
AX: Support embedded SVG objects in AX tree
ObjcClass* objcClass = static_cast<ObjcClass*>(objcInstance->getClass());
OwnPtr<ObjcMethod> fallbackMethod(adoptPtr(new ObjcMethod(objcClass->isa(), @selector(invokeUndefinedMethodFromWebScript:withArguments:))));
const String& nameIdentifier = static_cast<ObjcFallbackObjectImp*>(exec->callee())->propertyName();
- RetainPtr<CFStringRef> name(AdoptCF, nameIdentifier.createCFString());
- fallbackMethod->setJavaScriptName(name.get());
+ fallbackMethod->setJavaScriptName(nameIdentifier.createCFString().get());
result = objcInstance->invokeObjcMethod(exec, fallbackMethod.get());
}
// app cache media files are always created with encodeForFileName(createCanonicalUUIDString()).
#if USE(CF) && PLATFORM(WIN)
- RetainPtr<CFStringRef> cfPath(AdoptCF, path.createCFString());
- RetainPtr<CFURLRef> cfURL(AdoptCF, CFURLCreateWithFileSystemPath(0, cfPath.get(), kCFURLWindowsPathStyle, false));
+ RetainPtr<CFURLRef> cfURL(AdoptCF, CFURLCreateWithFileSystemPath(0, path.createCFString().get(), kCFURLWindowsPathStyle, false));
KURL url(cfURL.get());
#else
KURL url;
CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceDataKey, cfData.get());
// Resource URL cannot be null
- RetainPtr<CFStringRef> cfURL(AdoptCF, resource->url().string().createCFString());
- if (cfURL)
+ if (RetainPtr<CFStringRef> cfURL = resource->url().string().createCFString())
CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceURLKey, cfURL.get());
else {
LOG(Archives, "LegacyWebArchive - NULL resource URL is invalid - returning null property list");
// FrameName should be left out if empty for subresources, but always included for main resources
const String& frameName(resource->frameName());
- if (!frameName.isEmpty() || isMainResource) {
- RetainPtr<CFStringRef> cfFrameName(AdoptCF, frameName.createCFString());
- CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceFrameNameKey, cfFrameName.get());
- }
+ if (!frameName.isEmpty() || isMainResource)
+ CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceFrameNameKey, frameName.createCFString().get());
// Set MIMEType, TextEncodingName, and ResourceResponse only if they actually exist
const String& mimeType(resource->mimeType());
- if (!mimeType.isEmpty()) {
- RetainPtr<CFStringRef> cfMIMEType(AdoptCF, mimeType.createCFString());
- CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceMIMETypeKey, cfMIMEType.get());
- }
+ if (!mimeType.isEmpty())
+ CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceMIMETypeKey, mimeType.createCFString().get());
const String& textEncoding(resource->textEncoding());
- if (!textEncoding.isEmpty()) {
- RetainPtr<CFStringRef> cfTextEncoding(AdoptCF, textEncoding.createCFString());
- CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceTextEncodingNameKey, cfTextEncoding.get());
- }
+ if (!textEncoding.isEmpty())
+ CFDictionarySetValue(propertyList.get(), LegacyWebArchiveResourceTextEncodingNameKey, textEncoding.createCFString().get());
// Don't include the resource response for the main resource
if (!isMainResource) {
#if USE(CF)
va_list arguments;
va_start(arguments, format);
- RetainPtr<CFStringRef> formatCFString(AdoptCF, format.createCFString());
#if COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-nonliteral"
#endif
- RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormatAndArguments(0, 0, formatCFString.get(), arguments));
+ RetainPtr<CFStringRef> result = adoptCF(CFStringCreateWithFormatAndArguments(0, 0, format.createCFString().get(), arguments));
#if COMPILER(CLANG)
#pragma clang diagnostic pop
#endif
return WEB_UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item");
#else
#if USE(CF)
- RetainPtr<CFStringRef> selectedCFString(AdoptCF, truncatedStringForLookupMenuItem(selectedString).createCFString());
+ RetainPtr<CFStringRef> selectedCFString = truncatedStringForLookupMenuItem(selectedString).createCFString();
return formatLocalizedString(WEB_UI_STRING("Look Up “%@”", "Look Up context menu item with selected word"), selectedCFString.get());
#else
return WEB_UI_STRING("Look Up “<selection>”", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));
String keygenKeychainItemName(const String& host)
{
- RetainPtr<CFStringRef> hostCFString(AdoptCF, host.createCFString());
- return formatLocalizedString(WEB_UI_STRING("Key from %@", "Name of keychain key generated by the KEYGEN tag"), hostCFString.get());
+ return formatLocalizedString(WEB_UI_STRING("Key from %@", "Name of keychain key generated by the KEYGEN tag"), host.createCFString().get());
}
#endif
{
#if USE(CF)
#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
- RetainPtr<CFStringRef> filenameCFString(AdoptCF, filename.createCFString());
- RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCopyCurrent());
+ RetainPtr<CFLocaleRef> locale = adoptCF(CFLocaleCopyCurrent());
RetainPtr<CFNumberFormatterRef> formatter(AdoptCF, CFNumberFormatterCreate(0, locale.get(), kCFNumberFormatterDecimalStyle));
int widthInt = size.width();
RetainPtr<CFNumberRef> height(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &heightInt));
RetainPtr<CFStringRef> heightString(AdoptCF, CFNumberFormatterCreateStringWithNumber(0, formatter.get(), height.get()));
- return formatLocalizedString(WEB_UI_STRING("%@ %@×%@ pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filenameCFString.get(), widthString.get(), heightString.get());
+ return formatLocalizedString(WEB_UI_STRING("%@ %@×%@ pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename.createCFString().get(), widthString.get(), heightString.get());
#else
RetainPtr<CFStringRef> filenameCFString(AdoptCF, filename.createCFString());
return formatLocalizedString(WEB_UI_STRING("%@ %d×%d pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filenameCFString.get(), size.width(), size.height());
if (!bundleIdentifier)
return false;
- RetainPtr<CFStringRef> bundleIdentifierToCompare(AdoptCF, bundleIdentifierString.createCFString());
- return CFStringCompare(bundleIdentifier, bundleIdentifierToCompare.get(), 0) == kCFCompareEqualTo;
+ return CFStringCompare(bundleIdentifier, bundleIdentifierString.createCFString().get(), 0) == kCFCompareEqualTo;
#else
UNUSED_PARAM(bundleIdentifierString);
return false;
CString fileSystemRepresentation(const String& path)
{
- RetainPtr<CFStringRef> cfString(AdoptCF, path.createCFString());
+ RetainPtr<CFStringRef> cfString = path.createCFString();
if (!cfString)
return CString();
#else
pathStyle = kCFURLPOSIXPathStyle;
#endif
- return RetainPtr<CFURLRef>(AdoptCF, CFURLCreateWithFileSystemPath(0,
- RetainPtr<CFStringRef>(AdoptCF, path.createCFString()).get(), pathStyle, FALSE));
+ return adoptCF(CFURLCreateWithFileSystemPath(0, path.createCFString().get(), pathStyle, FALSE));
}
} // namespace WebCore
else
m_animation.adoptCF(CACFAnimationCreate(kCACFKeyframeAnimation));
- RetainPtr<CFStringRef> s(AdoptCF, keyPath.createCFString());
- CACFAnimationSetKeyPath(m_animation.get(), s.get());
+ CACFAnimationSetKeyPath(m_animation.get(), keyPath.createCFString().get());
}
PlatformCAAnimation::PlatformCAAnimation(PlatformAnimationRef animation)
static void resubmitAllAnimations(PlatformCALayer* layer)
{
HashMap<String, RefPtr<PlatformCAAnimation> >::const_iterator end = layer->animations().end();
- for (HashMap<String, RefPtr<PlatformCAAnimation> >::const_iterator it = layer->animations().begin(); it != end; ++it) {
- RetainPtr<CFStringRef> s(AdoptCF, it->key.createCFString());
- CACFLayerAddAnimation(layer->platformLayer(), s.get(), it->value->platformAnimation());
- }
+ for (HashMap<String, RefPtr<PlatformCAAnimation> >::const_iterator it = layer->animations().begin(); it != end; ++it)
+ CACFLayerAddAnimation(layer->platformLayer(), it->key.createCFString().get(), it->value->platformAnimation());
}
void PlatformCALayer::ensureAnimationsSubmitted()
// Add it to the animation list
m_animations.add(key, animation);
- RetainPtr<CFStringRef> s(AdoptCF, key.createCFString());
- CACFLayerAddAnimation(m_layer.get(), s.get(), animation->platformAnimation());
+ CACFLayerAddAnimation(m_layer.get(), key.createCFString().get(), animation->platformAnimation());
setNeedsCommit();
// Tell the host about it so we can fire the start animation event
// Remove it from the animation list
m_animations.remove(key);
- RetainPtr<CFStringRef> s(AdoptCF, key.createCFString());
- CACFLayerRemoveAnimation(m_layer.get(), s.get());
+ CACFLayerRemoveAnimation(m_layer.get(), key.createCFString().get());
// We don't "remove" a layer from AbstractCACFLayerTreeHost when it loses an animation.
// There may be other active animations on the layer and if an animation
void PlatformCALayer::setName(const String& value)
{
- RetainPtr<CFStringRef> s(AdoptCF, value.createCFString());
- CACFLayerSetName(m_layer.get(), s.get());
+ CACFLayerSetName(m_layer.get(), value.createCFString().get());
setNeedsCommit();
}
#ifndef NDEBUG
String name = "Tile (" + String::number(i) + "," + String::number(j) + ")";
- CACFLayerSetName(tile, RetainPtr<CFStringRef>(AdoptCF, name.createCFString()).get());
+ CACFLayerSetName(tile, name.createCFString().get());
#endif
}
}
static RetainPtr<CFStringRef> utiFromMIMEType(const String& mimeType)
{
#if PLATFORM(MAC)
- RetainPtr<CFStringRef> mimeTypeCFString(AdoptCF, mimeType.createCFString());
- return RetainPtr<CFStringRef>(AdoptCF, UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeTypeCFString.get(), 0));
+ return adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeType.createCFString().get(), 0));
#else
ASSERT(isMainThread()); // It is unclear if CFSTR is threadsafe.
String MIMETypeForImageSourceType(const String& uti)
{
- RetainPtr<CFStringRef> utiref(AdoptCF, uti.createCFString());
- RetainPtr<CFStringRef> mime(AdoptCF, UTTypeCopyPreferredTagWithClass(utiref.get(), kUTTagClassMIMEType));
- return mime.get();
+ return adoptCF(UTTypeCopyPreferredTagWithClass(uti.createCFString().get(), kUTTagClassMIMEType)).get();
}
String preferredExtensionForImageSourceType(const String& uti)
{
- RetainPtr<CFStringRef> type(AdoptCF, uti.createCFString());
- RetainPtr<CFStringRef> extension(AdoptCF, UTTypeCopyPreferredTagWithClass(type.get(), kUTTagClassFilenameExtension));
- return extension.get();
+ return adoptCF(UTTypeCopyPreferredTagWithClass(uti.createCFString().get(), kUTTagClassFilenameExtension)).get();
}
} // namespace WebCore
// Try UTI now
String mimeType = qType;
- RetainPtr<CFStringRef> utiType(AdoptCF, UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeType.createCFString(), NULL));
- if (utiType) {
- CFStringRef pbType = UTTypeCopyPreferredTagWithClass(utiType.get(), kUTTagClassNSPboardType);
+ if (RetainPtr<CFStringRef> utiType = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeType.createCFString().get(), NULL))) {
+ RetainPtr<CFStringRef> pbType = adoptCF(UTTypeCopyPreferredTagWithClass(utiType.get(), kUTTagClassNSPboardType));
if (pbType)
- return pbType;
+ return pbType.get();
}
// No mapping, just pass the whole string though
static String utiTypeFromCocoaType(const String& type)
{
- RetainPtr<CFStringRef> typeCF = adoptCF(type.createCFString());
- RetainPtr<CFStringRef> utiType(AdoptCF, UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, typeCF.get(), 0));
- if (utiType) {
- RetainPtr<CFStringRef> mimeType(AdoptCF, UTTypeCopyPreferredTagWithClass(utiType.get(), kUTTagClassMIMEType));
- if (mimeType)
+ if (RetainPtr<CFStringRef> utiType = adoptCF(UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, type.createCFString().get(), 0))) {
+ if (RetainPtr<CFStringRef> mimeType = adoptCF(UTTypeCopyPreferredTagWithClass(utiType.get(), kUTTagClassMIMEType)))
return String(mimeType.get());
}
return String();
return String();
}
- RetainPtr<CFStringRef> challengeStringCF(AdoptCF, challengeString.createCFString());
- RetainPtr<CFStringRef> keyDescription(AdoptCF, keygenKeychainItemName(url.host()).createCFString());
- RetainPtr<CFStringRef> result(AdoptCF, wkSignedPublicKeyAndChallengeString(keySize, challengeStringCF.get(), keyDescription.get()));
-
- return result.get();
+ return adoptCF(wkSignedPublicKeyAndChallengeString(keySize, challengeString.createCFString().get(), keygenKeychainItemName(url.host()).createCFString().get())).get();
}
}
return CFURLCredentialCreateWithIdentityAndCertificateArray(kCFAllocatorDefault, coreCredential.identity(), coreCredential.certificates(), persistence);
#endif
- CFStringRef user = coreCredential.user().createCFString();
- CFStringRef password = coreCredential.password().createCFString();
- CFURLCredentialRef result = CFURLCredentialCreate(0, user, password, 0, persistence);
- CFRelease(user);
- CFRelease(password);
-
- return result;
+ return CFURLCredentialCreate(0, coreCredential.user().createCFString().get(), coreCredential.password().createCFString().get(), 0, persistence);
}
CFURLProtectionSpaceRef createCF(const ProtectionSpace& coreSpace)
ASSERT_NOT_REACHED();
}
- CFStringRef host = coreSpace.host().createCFString();
- CFStringRef realm = coreSpace.realm().createCFString();
- CFURLProtectionSpaceRef result = CFURLProtectionSpaceCreate(0, host, coreSpace.port(), serverType, realm, scheme);
- CFRelease(host);
- CFRelease(realm);
-
- return result;
+ return CFURLProtectionSpaceCreate(0, coreSpace.host().createCFString().get(), coreSpace.port(), serverType, coreSpace.realm().createCFString().get(), scheme);
}
Credential core(CFURLCredentialRef cfCredential)
// cookiesWithResponseHeaderFields doesn't parse cookies without a value
String cookieString = value.contains('=') ? value : value + "=";
- RetainPtr<CFStringRef> cookieStringCF(AdoptCF, cookieString.createCFString());
+ RetainPtr<CFStringRef> cookieStringCF = cookieString.createCFString();
RetainPtr<CFDictionaryRef> headerFieldsCF(AdoptCF, CFDictionaryCreate(kCFAllocatorDefault,
(const void**)&s_setCookieKeyCF, (const void**)&cookieStringCF, 1,
&kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
{
ASSERT(isMainThread());
- RetainPtr<CFStringRef> hostnameCF(AdoptCF, hostname.createCFString());
- RetainPtr<CFHostRef> host(AdoptCF, CFHostCreateWithName(0, hostnameCF.get()));
+ RetainPtr<CFHostRef> host = adoptCF(CFHostCreateWithName(0, hostname.createCFString().get()));
if (!host) {
decrementRequestCount();
return;
}
+
CFHostClientContext context = { 0, 0, 0, 0, 0 };
CFHostRef leakedHost = host.leakRef(); // The host will be released from clientCallback().
Boolean result = CFHostSetClient(leakedHost, clientCallback, &context);
if (!m_platformError) {
RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
- if (!m_localizedDescription.isEmpty()) {
- RetainPtr<CFStringRef> localizedDescriptionString(AdoptCF, m_localizedDescription.createCFString());
- CFDictionarySetValue(userInfo.get(), kCFErrorLocalizedDescriptionKey, localizedDescriptionString.get());
- }
+ if (!m_localizedDescription.isEmpty())
+ CFDictionarySetValue(userInfo.get(), kCFErrorLocalizedDescriptionKey, m_localizedDescription.createCFString().get());
if (!m_failingURL.isEmpty()) {
- RetainPtr<CFStringRef> failingURLString(AdoptCF, m_failingURL.createCFString());
+ RetainPtr<CFStringRef> failingURLString = m_failingURL.createCFString();
CFDictionarySetValue(userInfo.get(), failingURLStringKey, failingURLString.get());
RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithString(0, failingURLString.get(), 0));
CFDictionarySetValue(userInfo.get(), failingURLKey, url.get());
wkSetSSLPeerCertificateData(userInfo.get(), m_certificate.get());
#endif
- RetainPtr<CFStringRef> domainString(AdoptCF, m_domain.createCFString());
- m_platformError.adoptCF(CFErrorCreate(0, domainString.get(), m_errorCode, userInfo.get()));
+ m_platformError = adoptCF(CFErrorCreate(0, m_domain.createCFString().get(), m_errorCode, userInfo.get()));
}
return m_platformError.get();
static void setDefaultMIMEType(CFURLResponseRef response)
{
- static CFStringRef defaultMIMETypeString = defaultMIMEType().createCFString();
+ static CFStringRef defaultMIMETypeString = defaultMIMEType().createCFString().leakRef();
CFURLResponseSetMIMEType(response, defaultMIMETypeString);
}
if (cfRedirectResponse) {
CFHTTPMessageRef httpMessage = CFURLResponseGetHTTPResponse(cfRedirectResponse);
if (httpMessage && CFHTTPMessageGetResponseStatusCode(httpMessage) == 307) {
- RetainPtr<CFStringRef> lastHTTPMethod(AdoptCF, handle->lastHTTPMethod().createCFString());
- RetainPtr<CFStringRef> newMethod(AdoptCF, CFURLRequestCopyHTTPRequestMethod(cfRequest));
+ RetainPtr<CFStringRef> lastHTTPMethod = handle->lastHTTPMethod().createCFString();
+ RetainPtr<CFStringRef> newMethod = adoptCF(CFURLRequestCopyHTTPRequestMethod(cfRequest));
if (CFStringCompareWithOptions(lastHTTPMethod.get(), newMethod.get(), CFRangeMake(0, CFStringGetLength(lastHTTPMethod.get())), kCFCompareCaseInsensitive)) {
RetainPtr<CFMutableURLRequestRef> mutableRequest(AdoptCF, CFURLRequestCreateMutableCopy(0, cfRequest));
#if USE(CFURLSTORAGESESSIONS)
WebCore::setHTTPBody(mutableRequest.get(), body);
String originalContentType = handle->firstRequest().httpContentType();
- RetainPtr<CFStringRef> originalContentTypeCF(AdoptCF, originalContentType.createCFString());
if (!originalContentType.isEmpty())
- CFURLRequestSetHTTPHeaderFieldValue(mutableRequest.get(), CFSTR("Content-Type"), originalContentTypeCF.get());
+ CFURLRequestSetHTTPHeaderFieldValue(mutableRequest.get(), CFSTR("Content-Type"), originalContentType.createCFString().get());
request = mutableRequest.get();
}
#endif
if (!d->m_user.isNull() && !d->m_pass.isNull()) {
- RetainPtr<CFStringRef> user(AdoptCF, d->m_user.createCFString());
- RetainPtr<CFStringRef> pass(AdoptCF, d->m_pass.createCFString());
- RetainPtr<CFURLCredentialRef> credential(AdoptCF,
- CFURLCredentialCreate(kCFAllocatorDefault, user.get(), pass.get(), 0, kCFURLCredentialPersistenceNone));
+ RetainPtr<CFURLCredentialRef> credential = adoptCF(CFURLCredentialCreate(kCFAllocatorDefault, d->m_user.createCFString().get(), d->m_pass.createCFString().get(), 0, kCFURLCredentialPersistenceNone));
KURL urlToStore;
if (challenge.failureResponse().httpStatusCode() == 401)
return;
String base = privateBrowsingStorageSessionIdentifierBase().isNull() ? privateBrowsingStorageSessionIdentifierDefaultBase() : privateBrowsingStorageSessionIdentifierBase();
- RetainPtr<CFStringRef> cfIdentifier(AdoptCF, String(base + ".PrivateBrowsing").createCFString());
+ RetainPtr<CFStringRef> cfIdentifier = String(base + ".PrivateBrowsing").createCFString();
privateStorageSession() = createPrivateBrowsingStorageSession(cfIdentifier.get());
}
CFURLRequestSetHTTPHeaderFieldValue(request, oldHeaderFieldNames[i], 0);
}
- HTTPHeaderMap::const_iterator end = requestHeaders.end();
- for (HTTPHeaderMap::const_iterator it = requestHeaders.begin(); it != end; ++it) {
- CFStringRef key = it->key.string().createCFString();
- CFStringRef value = it->value.createCFString();
- CFURLRequestSetHTTPHeaderFieldValue(request, key, value);
- CFRelease(key);
- CFRelease(value);
- }
+ for (HTTPHeaderMap::const_iterator it = requestHeaders.begin(), end = requestHeaders.end(); it != end; ++it)
+ CFURLRequestSetHTTPHeaderFieldValue(request, it->key.string().createCFString().get(), it->value.createCFString().get());
}
void ResourceRequest::doUpdatePlatformRequest()
wkSetRequestStorageSession(ResourceHandle::currentStorageSession(), cfRequest);
#endif
- RetainPtr<CFStringRef> requestMethod(AdoptCF, httpMethod().createCFString());
- CFURLRequestSetHTTPRequestMethod(cfRequest, requestMethod.get());
+ CFURLRequestSetHTTPRequestMethod(cfRequest, httpMethod().createCFString().get());
if (httpPipeliningEnabled())
wkSetHTTPPipeliningPriority(cfRequest, toHTTPPipeliningPriority(m_priority));
unsigned fallbackCount = m_responseContentDispositionEncodingFallbackArray.size();
RetainPtr<CFMutableArrayRef> encodingFallbacks(AdoptCF, CFArrayCreateMutable(kCFAllocatorDefault, fallbackCount, 0));
for (unsigned i = 0; i != fallbackCount; ++i) {
- RetainPtr<CFStringRef> encodingName(AdoptCF, m_responseContentDispositionEncodingFallbackArray[i].createCFString());
+ RetainPtr<CFStringRef> encodingName = m_responseContentDispositionEncodingFallbackArray[i].createCFString();
CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding(encodingName.get());
if (encoding != kCFStringEncodingInvalidId)
CFArrayAppendValue(encodingFallbacks.get(), reinterpret_cast<const void*>(encoding));
{
if (!m_cfResponse && !m_isNull) {
RetainPtr<CFURLRef> url(AdoptCF, m_url.createCFURL());
- RetainPtr<CFStringRef> mimeType(AdoptCF, m_mimeType.createCFString());
- RetainPtr<CFStringRef> textEncodingName(AdoptCF, m_textEncodingName.createCFString());
- m_cfResponse.adoptCF(CFURLResponseCreate(0, url.get(), mimeType.get(), m_expectedContentLength, textEncodingName.get(), kCFURLCacheStorageAllowed));
+ m_cfResponse.adoptCF(CFURLResponseCreate(0, url.get(), m_mimeType.createCFString().get(), m_expectedContentLength, m_textEncodingName.createCFString().get(), kCFURLCacheStorageAllowed));
}
return m_cfResponse.get();
if (m_connectionType == Unknown)
return;
- RetainPtr<CFStringRef> host(AdoptCF, m_url.host().createCFString());
+ RetainPtr<CFStringRef> host = m_url.host().createCFString();
// Creating streams to final destination, not to proxy.
CFReadStreamRef readStream = 0;
String password;
if (!m_sentStoredCredentials && getStoredCONNECTProxyCredentials(protectionSpace, login, password)) {
// Try to apply stored credentials, if we haven't tried those already.
- RetainPtr<CFStringRef> loginCF(AdoptCF, login.createCFString());
- RetainPtr<CFStringRef> passwordCF(AdoptCF, password.createCFString());
- // Creating a temporary request to make CFNetwork apply credentials to it. Unfortunately, this cannot work with NTLM authentication.
+ // Create a temporary request to make CFNetwork apply credentials to it. Unfortunately, this cannot work with NTLM authentication.
RetainPtr<CFHTTPMessageRef> dummyRequest(AdoptCF, CFHTTPMessageCreateRequest(0, CFSTR("GET"), m_httpsURL.get(), kCFHTTPVersion1_1));
- Boolean appliedCredentials = CFHTTPMessageApplyCredentials(dummyRequest.get(), authentication.get(), loginCF.get(), passwordCF.get(), 0);
+ Boolean appliedCredentials = CFHTTPMessageApplyCredentials(dummyRequest.get(), authentication.get(), login.createCFString().get(), password.createCFString().get(), 0);
ASSERT_UNUSED(appliedCredentials, appliedCredentials);
RetainPtr<CFStringRef> proxyAuthorizationString(AdoptCF, CFHTTPMessageCopyHeaderFieldValue(dummyRequest.get(), CFSTR("Proxy-Authorization")));
CFStringRef SocketStreamHandle::copyCFStreamDescription(void* info)
{
SocketStreamHandle* handle = static_cast<SocketStreamHandle*>(info);
- return String("WebKit socket stream, " + handle->m_url.string()).createCFString();
+ return String("WebKit socket stream, " + handle->m_url.string()).createCFString().leakRef();
}
struct MainThreadEventCallbackInfo {
NSMutableArray *encodingFallbacks = [NSMutableArray array];
unsigned count = m_responseContentDispositionEncodingFallbackArray.size();
for (unsigned i = 0; i != count; ++i) {
- CFStringRef encodingName = m_responseContentDispositionEncodingFallbackArray[i].createCFString();
- unsigned long nsEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding(encodingName));
- CFRelease(encodingName);
+ RetainPtr<CFStringRef> encodingName = m_responseContentDispositionEncodingFallbackArray[i].createCFString();
+ unsigned long nsEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding(encodingName.get()));
+
if (nsEncoding != kCFStringEncodingInvalidId)
[encodingFallbacks addObject:[NSNumber numberWithUnsignedLong:nsEncoding]];
}
}
if (!result) {
- static CFStringRef defaultMIMETypeString = WebCore::defaultMIMEType().createCFString();
+ static CFStringRef defaultMIMETypeString = WebCore::defaultMIMEType().createCFString().leakRef();
result = defaultMIMETypeString;
}
template<>
RetainPtr<CFLocaleRef> AtomicStringKeyedMRUCache<RetainPtr<CFLocaleRef> >::createValueForKey(const AtomicString& localeIdentifier)
{
- RetainPtr<CFStringRef> cfLocaleIdentifier(AdoptCF, localeIdentifier.string().createCFString());
- RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCreate(kCFAllocatorDefault, cfLocaleIdentifier.get()));
+ RetainPtr<CFLocaleRef> locale = adoptCF(CFLocaleCreate(kCFAllocatorDefault, localeIdentifier.string().createCFString().get()));
return CFStringIsHyphenationAvailableForLocale(locale.get()) ? locale : 0;
}
#include <wtf/text/WTFString.h>
#if USE(CF)
-
#include <CoreFoundation/CoreFoundation.h>
+#include <wtf/RetainPtr.h>
namespace WTF {
}
}
-CFStringRef String::createCFString() const
+RetainPtr<CFStringRef> String::createCFString() const
{
if (!m_impl)
return CFSTR("");
#include <CoreFoundation/CoreFoundation.h>
#include <wtf/MainThread.h>
#include <wtf/PassRefPtr.h>
+#include <wtf/RetainPtr.h>
#include <wtf/Threading.h>
#if PLATFORM(MAC)
}
-CFStringRef StringImpl::createCFString()
+RetainPtr<CFStringRef> StringImpl::createCFString()
{
if (!m_length || !isMainThread()) {
if (is8Bit())
// CoreFoundation might not have to allocate anything, we clear currentString in case we did not execute allocate().
StringWrapperCFAllocator::currentString = 0;
- return string;
+ return adoptCF(string);
}
// On StringImpl creation we could check if the allocator is the StringWrapperCFAllocator.
#include <wtf/text/StringImpl.h>
#include "FoundationExtras.h"
+#include <wtf/RetainPtr.h>
namespace WTF {
StringImpl::operator NSString *()
{
- return HardAutorelease(createCFString());
+ return HardAutorelease(createCFString().leakRef());
}
}
// Encoding will change the yen sign back into a backslash.
String copy(characters, length);
copy.replace('\\', m_backslashAsCurrencySymbol);
- RetainPtr<CFStringRef> cfs(AdoptCF, copy.createCFString());
+ RetainPtr<CFStringRef> cfs = copy.createCFString();
CFIndex startPos = 0;
CFIndex charactersLeft = CFStringGetLength(cfs.get());
#if USE(CF)
static RetainPtr<CFStringRef> autosaveKey(const String& name)
{
- String key = "com.apple.WebKit.searchField:" + name;
- return RetainPtr<CFStringRef>(AdoptCF, key.createCFString());
+ return String("com.apple.WebKit.searchField:" + name).createCFString();
}
#endif
size_t size = searchItems.size();
if (size) {
items.adoptCF(CFArrayCreateMutable(0, size, &kCFTypeArrayCallBacks));
- for (size_t i = 0; i < size; ++i) {
- RetainPtr<CFStringRef> item(AdoptCF, searchItems[i].createCFString());
- CFArrayAppendValue(items.get(), item.get());
- }
+ for (size_t i = 0; i < size; ++i)
+ CFArrayAppendValue(items.get(), searchItems[i].createCFString().get());
}
CFPreferencesSetAppValue(autosaveKey(name).get(), items.get(), kCFPreferencesCurrentApplication);
+2012-10-29 Anders Carlsson <andersca@apple.com>
+
+ String::createCFString should return a RetainPtr
+ https://bugs.webkit.org/show_bug.cgi?id=100419
+
+ Reviewed by Andreas Kling.
+
+ Update callers of String::createCFString.
+
+ * WebCoreSupport/WebInspectorClientCF.cpp:
+ (createKeyForPreferences):
+ (populateSetting):
+ (storeSetting):
+
2012-09-05 Sam Weinig <sam@webkit.org>
Part 2 of removing PlatformString.h, remove PlatformString.h
static const char* inspectorStartsAttachedSetting = "inspectorStartsAttached";
-static inline CFStringRef createKeyForPreferences(const String& key)
+static inline RetainPtr<CFStringRef> createKeyForPreferences(const String& key)
{
- RetainPtr<CFStringRef> keyCFString(AdoptCF, key.createCFString());
- return CFStringCreateWithFormat(0, 0, CFSTR("WebKit Web Inspector Setting - %@"), keyCFString.get());
+ return adoptCF(CFStringCreateWithFormat(0, 0, CFSTR("WebKit Web Inspector Setting - %@"), key.createCFString().get()));
}
static void populateSetting(const String& key, String* setting)
{
- RetainPtr<CFStringRef> preferencesKey(AdoptCF, createKeyForPreferences(key));
+ RetainPtr<CFStringRef> preferencesKey = createKeyForPreferences(key);
RetainPtr<CFPropertyListRef> value(AdoptCF, CFPreferencesCopyAppValue(preferencesKey.get(), kCFPreferencesCurrentApplication));
if (!value)
static void storeSetting(const String& key, const String& setting)
{
- RetainPtr<CFPropertyListRef> objectToStore;
- objectToStore.adoptCF(setting.createCFString());
- ASSERT(objectToStore);
-
- RetainPtr<CFStringRef> preferencesKey(AdoptCF, createKeyForPreferences(key));
- CFPreferencesSetAppValue(preferencesKey.get(), objectToStore.get(), kCFPreferencesCurrentApplication);
+ CFPreferencesSetAppValue(createKeyForPreferences(key).get(), setting.createCFString().get(), kCFPreferencesCurrentApplication);
}
bool WebInspectorClient::sendMessageToFrontend(const String& message)
+2012-10-29 Anders Carlsson <andersca@apple.com>
+
+ String::createCFString should return a RetainPtr
+ https://bugs.webkit.org/show_bug.cgi?id=100419
+
+ Reviewed by Andreas Kling.
+
+ Update callers of String::createCFString.
+
+ * WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebFrameLoaderClient::dispatchDidFailToStartPlugin):
+ * WebDatabaseManager.cpp:
+ (WebDatabaseManager::dispatchDidModifyDatabase):
+ * WebHistory.cpp:
+ (WebHistory::visitedURL):
+ (WebHistory::itemForURLString):
+ * WebHistoryItem.cpp:
+ (WebHistoryItem::dictionaryRepresentation):
+ * WebIconDatabase.cpp:
+ (WebIconDatabase::iconDatabaseNotificationUserInfoURLKey):
+ (postDidAddIconNotification):
+ * WebLocalizableStrings.cpp:
+ (createWebKitBundle):
+ (copyLocalizedStringFromBundle):
+ * WebPreferences.cpp:
+ (WebPreferences::initializeDefaultSettings):
+ * WebView.cpp:
+ (WebView::setCacheModel):
+ (WebView::notifyPreferencesChanged):
+
2012-10-24 Brady Eidson <beidson@apple.com>
Add a strategy for loader customization.
KURL pluginPageURL = frame->document()->completeURL(stripLeadingAndTrailingHTMLSpaces(pluginView->pluginsPage()));
if (pluginPageURL.protocolIsInHTTPFamily()) {
static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorPlugInPageURLStringKey);
- RetainPtr<CFStringRef> str(AdoptCF, pluginPageURL.string().createCFString());
- CFDictionarySetValue(userInfo.get(), key, str.get());
+ CFDictionarySetValue(userInfo.get(), key, pluginPageURL.string().createCFString().get());
}
}
if (!pluginView->mimeType().isNull()) {
static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorMIMETypeKey);
-
- RetainPtr<CFStringRef> str(AdoptCF, pluginView->mimeType().createCFString());
- CFDictionarySetValue(userInfo.get(), key, str.get());
+ CFDictionarySetValue(userInfo.get(), key, pluginView->mimeType().createCFString().get());
}
if (pluginView->plugin()) {
String pluginName = pluginView->plugin()->name();
if (!pluginName.isNull()) {
static CFStringRef key = MarshallingHelpers::LPCOLESTRToCFStringRef(WebKitErrorPlugInNameKey);
- RetainPtr<CFStringRef> str(AdoptCF, pluginName.createCFString());
- CFDictionarySetValue(userInfo.get(), key, str.get());
+ CFDictionarySetValue(userInfo.get(), key, pluginName.createCFString().get());
}
}
RetainPtr<CFMutableDictionaryRef> userInfo(AdoptCF, CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
static CFStringRef databaseNameKey = MarshallingHelpers::LPCOLESTRToCFStringRef(WebDatabaseNameKey);
- RetainPtr<CFStringRef> str(AdoptCF, databaseName.createCFString());
- CFDictionarySetValue(userInfo.get(), databaseNameKey, str.get());
+ CFDictionarySetValue(userInfo.get(), databaseNameKey, databaseName.createCFString().get());
COMPtr<CFDictionaryPropertyBag> userInfoBag = CFDictionaryPropertyBag::createInstance();
userInfoBag->setDictionary(userInfo.get());
void WebHistory::visitedURL(const KURL& url, const String& title, const String& httpMethod, bool wasFailure, bool increaseVisitCount)
{
- RetainPtr<CFStringRef> urlString(AdoptCF, url.string().createCFString());
+ RetainPtr<CFStringRef> urlString = url.string().createCFString();
- IWebHistoryItem* entry = (IWebHistoryItem*) CFDictionaryGetValue(m_entriesByURL.get(), urlString.get());
+ IWebHistoryItem* entry = (IWebHistoryItem*)CFDictionaryGetValue(m_entriesByURL.get(), urlString.get());
if (entry) {
COMPtr<IWebHistoryItemPrivate> entryPrivate(Query, entry);
if (!entryPrivate)
COMPtr<IWebHistoryItem> WebHistory::itemForURLString(const String& urlString) const
{
- RetainPtr<CFStringRef> urlCFString(AdoptCF, urlString.createCFString());
- if (!urlCFString)
+ if (!urlString)
return 0;
COMPtr<IWebHistoryItem> item;
- if (FAILED(itemForURLString(urlCFString.get(), &item)))
+ if (FAILED(itemForURLString(urlString.createCFString().get(), &item)))
return 0;
return item;
}
if (!m_historyItem->urlString().isEmpty()) {
keys[keyCount] = urlKey;
- values[keyCount++] = m_historyItem->urlString().createCFString();
+ values[keyCount++] = m_historyItem->urlString().createCFString().leakRef();
}
keys[keyCount] = lastVisitedDateKey;
if (!m_historyItem->title().isEmpty()) {
keys[keyCount] = titleKey;
- values[keyCount++] = m_historyItem->title().createCFString();
+ values[keyCount++] = m_historyItem->title().createCFString().leakRef();
}
keys[keyCount] = visitCountKey;
ASSERT(size);
CFStringRef* items = new CFStringRef[size];
for (size_t i = 0; i < size; ++i)
- items[i] = redirectURLs->at(i).createCFString();
+ items[i] = redirectURLs->at(i).createCFString().leakRef();
CFArrayRef result = CFArrayCreate(0, (const void**)items, size, &kCFTypeArrayCallBacks);
for (size_t i = 0; i < size; ++i)
CFRelease(items[i]);
CFStringRef WebIconDatabase::iconDatabaseNotificationUserInfoURLKey()
{
- static CFStringRef iconUserInfoURLKey = String(WebIconNotificationUserInfoURLKey).createCFString();
+ static CFStringRef iconUserInfoURLKey = String(WebIconNotificationUserInfoURLKey).createCFString().leakRef();
return iconUserInfoURLKey;
}
RetainPtr<CFMutableDictionaryRef> dictionary(AdoptCF,
CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
- RetainPtr<CFStringRef> url(AdoptCF, pageURL.createCFString());
- CFDictionaryAddValue(dictionary.get(), WebIconDatabase::iconDatabaseNotificationUserInfoURLKey(), url.get());
+ CFDictionaryAddValue(dictionary.get(), WebIconDatabase::iconDatabaseNotificationUserInfoURLKey(), pageURL.createCFString().get());
COMPtr<CFDictionaryPropertyBag> userInfo = CFDictionaryPropertyBag::createInstance();
userInfo->setDictionary(dictionary.get());
return 0;
String bundlePathString(pathStr);
- CFStringRef bundlePathCFString = bundlePathString.createCFString();
- if (!bundlePathCFString)
+ if (!bundlePathString)
return 0;
- CFURLRef bundleURLRef = CFURLCreateWithFileSystemPath(0, bundlePathCFString, kCFURLWindowsPathStyle, true);
- CFRelease(bundlePathCFString);
+ CFURLRef bundleURLRef = CFURLCreateWithFileSystemPath(0, bundlePathString.createCFString().get(), kCFURLWindowsPathStyle, true);
if (!bundleURLRef)
return 0;
if (!bundle)
return notFound;
- RetainPtr<CFStringRef> keyString(AdoptCF, key.createCFString());
- CFStringRef result = CFCopyLocalizedStringWithDefaultValue(keyString.get(), 0, bundle, notFound, 0);
+ CFStringRef result = CFCopyLocalizedStringWithDefaultValue(key.createCFString().get(), 0, bundle, notFound, 0);
ASSERT_WITH_MESSAGE(result != notFound, "could not find localizable string %s in bundle", key);
return result;
CFDictionaryAddValue(defaults, CFSTR(WebKitDefaultFixedFontSizePreferenceKey), CFSTR("13"));
String defaultDefaultEncoding(WEB_UI_STRING("ISO-8859-1", "The default, default character encoding"));
- CFDictionaryAddValue(defaults, CFSTR(WebKitDefaultTextEncodingNamePreferenceKey), defaultDefaultEncoding.createCFString());
+ CFDictionaryAddValue(defaults, CFSTR(WebKitDefaultTextEncodingNamePreferenceKey), defaultDefaultEncoding.createCFString().get());
CFDictionaryAddValue(defaults, CFSTR(WebKitUserStyleSheetEnabledPreferenceKey), kCFBooleanFalse);
CFDictionaryAddValue(defaults, CFSTR(WebKitUserStyleSheetLocationPreferenceKey), CFSTR(""));
RetainPtr<CFURLCacheRef> cfurlCache(AdoptCF, CFURLCacheCopySharedURLCache());
RetainPtr<CFStringRef> cfurlCacheDirectory(AdoptCF, wkCopyFoundationCacheDirectory(0));
if (!cfurlCacheDirectory)
- cfurlCacheDirectory.adoptCF(WebCore::localUserSpecificStorageDirectory().createCFString());
+ cfurlCacheDirectory = WebCore::localUserSpecificStorageDirectory().createCFString();
// As a fudge factor, use 1000 instead of 1024, in case the reported byte
// count doesn't align exactly to a megabyte boundary.
if (FAILED(hr))
return hr;
- RetainPtr<CFStringRef> urlString(AdoptCF, toString(str).createCFString());
- RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithString(kCFAllocatorDefault, urlString.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
+2012-10-29 Anders Carlsson <andersca@apple.com>
+
+ String::createCFString should return a RetainPtr
+ https://bugs.webkit.org/show_bug.cgi?id=100419
+
+ Reviewed by Andreas Kling.
+
+ Update callers of String::createCFString.
+
+ * Platform/mac/ModuleMac.mm:
+ (WebKit::Module::load):
+ * PluginProcess/mac/PluginProcessMac.mm:
+ (WebKit::initializeSandbox):
+ * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
+ (WebKit::NetscapePluginModule::getPluginInfo):
+ (WebKit::NetscapePluginModule::createPluginMIMETypesPreferences):
+ * UIProcess/cf/WebBackForwardListCF.cpp:
+ (WebKit::WebBackForwardList::createCFDictionaryRepresentation):
+ * UIProcess/cf/WebPageProxyCF.cpp:
+ (WebKit::WebPageProxy::sessionStateData):
+ (WebKit::autosaveKey):
+ (WebKit::WebPageProxy::saveRecentSearches):
+ * WebProcess/ResourceCache/WebResourceCacheManager.cpp:
+ (WebKit::WebResourceCacheManager::clearCacheForOrigin):
+ * WebProcess/WebPage/win/WebPageWin.cpp:
+ (WebKit::cachedResponseForURL):
+ * WebProcess/win/WebProcessWin.cpp:
+ (WebKit::WebProcess::platformSetCacheModel):
+ (WebKit::WebProcess::platformInitializeWebProcess):
+
2012-10-30 Kondapally Kalyan <kalyan.kondapally@intel.com>
Regression(r132647)-Enable WebGL in EwkView.
bool Module::load()
{
- RetainPtr<CFStringRef> bundlePath(AdoptCF, m_path.createCFString());
- RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, bundlePath.get(), kCFURLPOSIXPathStyle, FALSE));
+ RetainPtr<CFURLRef> bundleURL = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, m_path.createCFString().get(), kCFURLPOSIXPathStyle, FALSE));
if (!bundleURL)
return false;
- RetainPtr<CFBundleRef> bundle(AdoptCF, CFBundleCreate(kCFAllocatorDefault, bundleURL.get()));
+ RetainPtr<CFBundleRef> bundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, bundleURL.get()));
if (!bundle)
return false;
if (sandboxProfileDirectoryPath.isEmpty())
return;
- RetainPtr<CFStringRef> cfPluginPath = adoptCF(pluginPath.createCFString());
- RetainPtr<CFURLRef> pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, cfPluginPath.get(), kCFURLPOSIXPathStyle, false));
+ RetainPtr<CFURLRef> pluginURL = adoptCF(CFURLCreateWithFileSystemPath(0, pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false));
if (!pluginURL)
return;
if (!bundleIdentifier)
return;
- RetainPtr<CFStringRef> cfSandboxProfileDirectoryPath = adoptCF(sandboxProfileDirectoryPath.createCFString());
- RetainPtr<CFURLRef> sandboxProfileDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, cfSandboxProfileDirectoryPath.get(), kCFURLPOSIXPathStyle, TRUE));
+ RetainPtr<CFURLRef> sandboxProfileDirectory = adoptCF(CFURLCreateWithFileSystemPath(0, sandboxProfileDirectoryPath.createCFString().get(), kCFURLPOSIXPathStyle, TRUE));
RetainPtr<CFStringRef> sandboxFileName = CFStringCreateWithFormat(0, 0, CFSTR("%@.sb"), bundleIdentifier);
RetainPtr<CFURLRef> sandboxURL = adoptCF(CFURLCreateWithFileSystemPathRelativeToBase(0, sandboxFileName.get(), kCFURLPOSIXPathStyle, FALSE, sandboxProfileDirectory.get()));
bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
{
- RetainPtr<CFStringRef> bundlePath(AdoptCF, pluginPath.createCFString());
- RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, bundlePath.get(), kCFURLPOSIXPathStyle, false));
+ RetainPtr<CFURLRef> bundleURL = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false));
// Try to initialize the bundle.
- RetainPtr<CFBundleRef> bundle(AdoptCF, CFBundleCreate(kCFAllocatorDefault, bundleURL.get()));
+ RetainPtr<CFBundleRef> bundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, bundleURL.get()));
if (!bundle)
return false;
bool NetscapePluginModule::createPluginMIMETypesPreferences(const String& pluginPath)
{
- RetainPtr<CFStringRef> bundlePath(AdoptCF, pluginPath.createCFString());
- RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, bundlePath.get(), kCFURLPOSIXPathStyle, false));
+ RetainPtr<CFURLRef> bundleURL = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false));
- // Try to initialize the bundle.
- RetainPtr<CFBundleRef> bundle(AdoptCF, CFBundleCreate(kCFAllocatorDefault, bundleURL.get()));
+ RetainPtr<CFBundleRef> bundle = adoptCF(CFBundleCreate(kCFAllocatorDefault, bundleURL.get()));
if (!bundle)
return false;
continue;
}
- RetainPtr<CFStringRef> url(AdoptCF, m_entries[i]->url().createCFString());
- RetainPtr<CFStringRef> title(AdoptCF, m_entries[i]->title().createCFString());
- RetainPtr<CFStringRef> originalURL(AdoptCF, m_entries[i]->originalURL().createCFString());
+ RetainPtr<CFStringRef> url = m_entries[i]->url().createCFString();
+ RetainPtr<CFStringRef> title = m_entries[i]->title().createCFString();
+ RetainPtr<CFStringRef> originalURL = m_entries[i]->originalURL().createCFString();
// FIXME: This uses the CoreIPC data encoding format, which means that whenever we change the CoreIPC encoding we need to bump the CurrentSessionStateDataVersion
// constant in WebPageProxyCF.cpp. The CoreIPC data format is meant to be an implementation detail, and not something that should be written to disk.
if (provisionalURL.isEmpty())
provisionalURL = m_mainFrame->provisionalURL();
if (!provisionalURL.isEmpty()) {
- provisionalURLString.adoptCF(provisionalURL.createCFString());
+ provisionalURLString = provisionalURL.createCFString();
keys[numValues] = ProvisionalURLKey();
values[numValues] = provisionalURLString.get();
++numValues;
static RetainPtr<CFStringRef> autosaveKey(const String& name)
{
- String key = "com.apple.WebKit.searchField:" + name;
- return RetainPtr<CFStringRef>(AdoptCF, key.createCFString());
+ return String("com.apple.WebKit.searchField:" + name).createCFString();
}
void WebPageProxy::saveRecentSearches(const String& name, const Vector<String>& searchItems)
if (size_t size = searchItems.size()) {
items.adoptCF(CFArrayCreateMutable(0, size, &kCFTypeArrayCallBacks));
- for (size_t i = 0; i < size; ++i) {
- RetainPtr<CFStringRef> item(AdoptCF, searchItems[i].createCFString());
- CFArrayAppendValue(items.get(), item.get());
- }
+ for (size_t i = 0; i < size; ++i)
+ CFArrayAppendValue(items.get(), searchItems[i].createCFString().get());
}
CFPreferencesSetAppValue(autosaveKey(name).get(), items.get(), kCFPreferencesCurrentApplication);
#if USE(CFURLCACHE)
if (resourceCachesToClear != InMemoryResourceCachesOnly) {
RetainPtr<CFMutableArrayRef> hostArray(AdoptCF, CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
- RetainPtr<CFStringRef> host(AdoptCF, origin->host().createCFString());
- CFArrayAppendValue(hostArray.get(), host.get());
+ CFArrayAppendValue(hostArray.get(), origin->host().createCFString().get());
clearCFURLCacheForHostNames(hostArray.get());
}
wkSetRequestStorageSession(ResourceHandle::currentStorageSession(), request.get());
#endif
- RetainPtr<CFStringRef> userAgent(AdoptCF, webPage->userAgent().createCFString());
- CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get());
+ CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), webPage->userAgent().createCFString().get());
RetainPtr<CFURLCacheRef> cache;
#if USE(CFURLSTORAGESESSIONS)
cfurlCacheDirectory.adoptCF(wkCopyFoundationCacheDirectory(0));
if (!cfurlCacheDirectory)
- cfurlCacheDirectory.adoptCF(WebCore::localUserSpecificStorageDirectory().createCFString());
+ cfurlCacheDirectory = WebCore::localUserSpecificStorageDirectory().createCFString();
// As a fudge factor, use 1000 instead of 1024, in case the reported byte
// count doesn't align exactly to a megabyte boundary.
if (defaultStorageSession)
return;
- RetainPtr<CFStringRef> cachePath(AdoptCF, parameters.diskCacheDirectory.createCFString());
- if (!cachePath)
+ if (!parameters.diskCacheDirectory)
return;
CFIndex cacheDiskCapacity = parameters.cfURLCacheDiskCapacity;
CFIndex cacheMemoryCapacity = parameters.cfURLCacheMemoryCapacity;
- RetainPtr<CFURLCacheRef> uiProcessCache(AdoptCF, CFURLCacheCreate(kCFAllocatorDefault, cacheMemoryCapacity, cacheDiskCapacity, cachePath.get()));
+ RetainPtr<CFURLCacheRef> uiProcessCache(AdoptCF, CFURLCacheCreate(kCFAllocatorDefault, cacheMemoryCapacity, cacheDiskCapacity, parameters.diskCacheDirectory.createCFString().get()));
CFURLCacheSetSharedURLCache(uiProcessCache.get());
#endif // USE(CFNETWORK)
}
+2012-10-29 Anders Carlsson <andersca@apple.com>
+
+ String::createCFString should return a RetainPtr
+ https://bugs.webkit.org/show_bug.cgi?id=100419
+
+ Reviewed by Andreas Kling.
+
+ Update callers of String::createCFString.
+
+ * WebKitTestRunner/InjectedBundle/mac/InjectedBundlePageMac.mm:
+ (WTR::InjectedBundlePage::platformDidStartProvisionalLoadForFrame):
+
2012-10-30 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com>
[WK2][WTR] WebKitTestRunner needs testRunner.queueLoadHTMLString
StringBuilder builder;
builder.appendLiteral("CRASHING TEST: ");
builder.append(testPath);
- RetainPtr<CFStringRef> cfString(AdoptCF, builder.toString().createCFString());
- WKSetCrashReportApplicationSpecificInformation(cfString.get());
+ WKSetCrashReportApplicationSpecificInformation(builder.toString().createCFString().get());
}
#endif
}