Changeset 150606 in webkit
- Timestamp:
- May 23, 2013 12:46:05 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150602 r150606 1 2013-05-23 Benjamin Poulain <bpoulain@apple.com> 2 3 KURL::createCFURL() should return a RetainPtr<CFURLRef> 4 https://bugs.webkit.org/show_bug.cgi?id=116644 5 6 Reviewed by Andreas Kling. 7 8 For consistency with the other createCFType() APIs in WebKit, KURL should 9 return a RetainPtr<> instead of raw +1 CFURLRef. 10 11 No leak were discovered while making this change. 12 13 * platform/KURL.h: 14 * platform/cf/KURLCFNet.cpp: 15 (WebCore): 16 (WebCore::createCFURLFromBuffer): 17 (WebCore::KURL::createCFURL): 18 (WebCore::KURL::fileSystemPath): 19 * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: 20 (WebCore::AVFWrapper::createAssetForURL): 21 * platform/graphics/cg/GraphicsContextCG.cpp: 22 (WebCore::GraphicsContext::setURLForRect): 23 * platform/mac/KURLMac.mm: 24 (WebCore): 25 (WebCore::KURL::operator NSURL *): 26 (WebCore::KURL::createCFURL): 27 * platform/network/cf/CookieJarCFNet.cpp: 28 (WebCore::setCookiesFromDOM): 29 (WebCore::cookiesForDOM): 30 (WebCore::cookieRequestHeaderFieldValue): 31 (WebCore::getRawCookies): 32 (WebCore::deleteCookie): 33 * platform/network/cf/DNSCFNet.cpp: 34 (WebCore::DNSResolveQueue::platformProxyIsEnabledInSystemPreferences): 35 * platform/network/cf/ProxyServerCFNet.cpp: 36 (WebCore::addProxyServersForURL): 37 * platform/network/cf/ResourceRequestCFNet.cpp: 38 (WebCore::ResourceRequest::doUpdatePlatformRequest): 39 (WebCore::ResourceRequest::doUpdatePlatformHTTPBody): 40 * platform/network/cf/ResourceResponseCFNet.cpp: 41 (WebCore::ResourceResponse::cfURLResponse): 42 * platform/network/cf/SocketStreamHandleCFNet.cpp: 43 (WebCore::SocketStreamHandle::SocketStreamHandle): 44 1 45 2013-05-18 Robert Hogan <robert@webkit.org> 2 46 -
trunk/Source/WebCore/platform/KURL.h
r148921 r150606 1 1 /* 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved.2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #include <wtf/Forward.h> 30 30 #include <wtf/HashMap.h> 31 #include <wtf/RetainPtr.h> 31 32 #include <wtf/text/WTFString.h> 32 33 … … 168 169 #if USE(CF) 169 170 KURL(CFURLRef); 170 CFURLRefcreateCFURL() const;171 RetainPtr<CFURLRef> createCFURL() const; 171 172 #endif 172 173 -
trunk/Source/WebCore/platform/cf/KURLCFNet.cpp
r149255 r150606 1 1 /* 2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2004, 2008, 2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 36 36 typedef Vector<char, 512> CharBuffer; 37 37 38 CFURLRefcreateCFURLFromBuffer(const CharBuffer&);38 RetainPtr<CFURLRef> createCFURLFromBuffer(const CharBuffer&); 39 39 40 40 KURL::KURL(CFURLRef url) … … 53 53 } 54 54 55 CFURLRefcreateCFURLFromBuffer(const CharBuffer& buffer)55 RetainPtr<CFURLRef> createCFURLFromBuffer(const CharBuffer& buffer) 56 56 { 57 57 // NOTE: We use UTF-8 here since this encoding is used when computing strings when returning URL components … … 59 59 // could either be a malformed string or bytes in a different encoding, like Shift-JIS, so we fall back 60 60 // onto using ISO Latin-1 in those cases. 61 CFURLRef result = CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingUTF8, 0, true);61 RetainPtr<CFURLRef> result = adoptCF(CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingUTF8, 0, true)); 62 62 if (!result) 63 result = CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingISOLatin1, 0, true);63 result = adoptCF(CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingISOLatin1, 0, true)); 64 64 return result; 65 65 } 66 66 67 67 #if !PLATFORM(MAC) && !(PLATFORM(QT) && USE(QTKIT)) 68 CFURLRefKURL::createCFURL() const68 RetainPtr<CFURLRef> KURL::createCFURL() const 69 69 { 70 70 // FIXME: What should this return for invalid URLs? … … 80 80 String KURL::fileSystemPath() const 81 81 { 82 RetainPtr<CFURLRef> cfURL = adoptCF(createCFURL());82 RetainPtr<CFURLRef> cfURL = createCFURL(); 83 83 if (!cfURL) 84 84 return String(); -
trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
r149980 r150606 983 983 ASSERT(!avAsset()); 984 984 985 RetainPtr<CFURLRef> urlRef = adoptCF(KURL(ParsedURLString, url).createCFURL());985 RetainPtr<CFURLRef> urlRef = KURL(ParsedURLString, url).createCFURL(); 986 986 987 987 AVCFURLAssetRef assetRef = AVCFURLAssetCreateWithURLAndOptions(kCFAllocatorDefault, urlRef.get(), 0, m_notificationQueue); -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r149980 r150606 1290 1290 return; 1291 1291 1292 RetainPtr<CFURLRef> urlRef = adoptCF(link.createCFURL());1292 RetainPtr<CFURLRef> urlRef = link.createCFURL(); 1293 1293 if (!urlRef) 1294 1294 return; -
trunk/Source/WebCore/platform/mac/KURLMac.mm
r147715 r150606 35 35 36 36 typedef Vector<char, 512> CharBuffer; 37 extern CFURLRefcreateCFURLFromBuffer(const CharBuffer& buffer);37 extern RetainPtr<CFURLRef> createCFURLFromBuffer(const CharBuffer& buffer); 38 38 39 39 KURL::KURL(NSURL *url) … … 54 54 KURL::operator NSURL *() const 55 55 { 56 return HardAutorelease(createCFURL() );56 return HardAutorelease(createCFURL().leakRef()); 57 57 } 58 58 59 59 // We use the toll-free bridge between NSURL and CFURL to 60 60 // create a CFURLRef supporting both empty and null values. 61 CFURLRefKURL::createCFURL() const61 RetainPtr<CFURLRef> KURL::createCFURL() const 62 62 { 63 63 if (isNull()) 64 64 return 0; 65 65 66 if (isEmpty()) 67 return reinterpret_cast<CFURLRef>([[NSURL alloc] initWithString:@""]); 66 if (isEmpty()) { 67 RetainPtr<NSURL> emptyNSURL = adoptNS([[NSURL alloc] initWithString:@""]); 68 return reinterpret_cast<CFURLRef>(emptyNSURL.get()); 69 } 68 70 69 71 CharBuffer buffer; -
trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp
r149716 r150606 100 100 return; 101 101 102 RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());103 RetainPtr<CFURLRef> firstPartyForCookiesCF = adoptCF(firstParty.createCFURL());102 RetainPtr<CFURLRef> urlCF = url.createCFURL(); 103 RetainPtr<CFURLRef> firstPartyForCookiesCF = firstParty.createCFURL(); 104 104 105 105 // <http://bugs.webkit.org/show_bug.cgi?id=6531>, <rdar://4409034> … … 120 120 String cookiesForDOM(const NetworkStorageSession& session, const KURL&, const KURL& url) 121 121 { 122 RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());122 RetainPtr<CFURLRef> urlCF = url.createCFURL(); 123 123 124 124 bool secure = url.protocolIs("https"); … … 130 130 String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& url) 131 131 { 132 RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());132 RetainPtr<CFURLRef> urlCF = url.createCFURL(); 133 133 134 134 bool secure = url.protocolIs("https"); … … 148 148 rawCookies.clear(); 149 149 150 RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());150 RetainPtr<CFURLRef> urlCF = url.createCFURL(); 151 151 152 152 bool sendSecureCookies = url.protocolIs("https"); … … 179 179 RetainPtr<CFHTTPCookieStorageRef> cookieStorage = session.cookieStorage(); 180 180 181 RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());181 RetainPtr<CFURLRef> urlCF = url.createCFURL(); 182 182 183 183 bool sendSecureCookies = url.protocolIs("https"); -
trunk/Source/WebCore/platform/network/cf/DNSCFNet.cpp
r149255 r150606 56 56 return false; 57 57 58 static CFURLRefhttpCFURL = KURL(ParsedURLString, "http://example.com/").createCFURL();59 static CFURLRefhttpsCFURL = KURL(ParsedURLString, "https://example.com/").createCFURL();58 RetainPtr<CFURLRef> httpCFURL = KURL(ParsedURLString, "http://example.com/").createCFURL(); 59 RetainPtr<CFURLRef> httpsCFURL = KURL(ParsedURLString, "https://example.com/").createCFURL(); 60 60 61 RetainPtr<CFArrayRef> httpProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpCFURL , proxySettings.get()));62 RetainPtr<CFArrayRef> httpsProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpsCFURL , proxySettings.get()));61 RetainPtr<CFArrayRef> httpProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpCFURL.get(), proxySettings.get())); 62 RetainPtr<CFArrayRef> httpsProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpsCFURL.get(), proxySettings.get())); 63 63 64 64 CFIndex httpProxyCount = CFArrayGetCount(httpProxyArray.get()); -
trunk/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp
r149255 r150606 126 126 return; 127 127 128 RetainPtr<CFURLRef> cfURL = adoptCF(url.createCFURL());128 RetainPtr<CFURLRef> cfURL = url.createCFURL(); 129 129 RetainPtr<CFArrayRef> proxiesForURL = adoptCF(CFNetworkCopyProxiesForURL(cfURL.get(), proxySettings.get())); 130 130 if (!proxiesForURL) -
trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
r149255 r150606 131 131 CFMutableURLRequestRef cfRequest; 132 132 133 RetainPtr<CFURLRef> url = adoptCF(ResourceRequest::url().createCFURL());134 RetainPtr<CFURLRef> firstPartyForCookies = adoptCF(ResourceRequest::firstPartyForCookies().createCFURL());133 RetainPtr<CFURLRef> url = ResourceRequest::url().createCFURL(); 134 RetainPtr<CFURLRef> firstPartyForCookies = ResourceRequest::firstPartyForCookies().createCFURL(); 135 135 if (m_cfRequest) { 136 136 cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get()); … … 191 191 CFMutableURLRequestRef cfRequest; 192 192 193 RetainPtr<CFURLRef> url = adoptCF(ResourceRequest::url().createCFURL());194 RetainPtr<CFURLRef> firstPartyForCookies = adoptCF(ResourceRequest::firstPartyForCookies().createCFURL());193 RetainPtr<CFURLRef> url = ResourceRequest::url().createCFURL(); 194 RetainPtr<CFURLRef> firstPartyForCookies = ResourceRequest::firstPartyForCookies().createCFURL(); 195 195 if (m_cfRequest) { 196 196 cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get()); -
trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp
r149255 r150606 51 51 { 52 52 if (!m_cfResponse && !m_isNull) { 53 RetainPtr<CFURLRef> url = adoptCF(m_url.createCFURL());53 RetainPtr<CFURLRef> url = m_url.createCFURL(); 54 54 55 55 // FIXME: This creates a very incomplete CFURLResponse, which does not even have a status code. -
trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp
r149255 r150606 67 67 68 68 KURL httpsURL(KURL(), "https://" + m_url.host()); 69 m_httpsURL = adoptCF(httpsURL.createCFURL());69 m_httpsURL = httpsURL.createCFURL(); 70 70 71 71 createStreams();
Note: See TracChangeset
for help on using the changeset viewer.