Changeset 86416 in webkit


Ignore:
Timestamp:
May 12, 2011 11:23:10 PM (13 years ago)
Author:
psolanki@apple.com
Message:

2011-05-12 Pratik Solanki <psolanki@apple.com>

Reviewed by Antti Koivisto.

Part of WebCore should use CFNetwork-based loader on Mac
https://bugs.webkit.org/show_bug.cgi?id=51836

Fixes for warnings and other minor cleanups when we enable USE_CFNETWORK on Mac.

  • platform/network/cf/ResourceErrorCF.cpp: (WebCore::ResourceError::cfStreamError):
  • platform/network/cf/ResourceHandleCFNet.cpp: (WebCore::allowsAnyHTTPSCertificateHosts): (WebCore::clientCerts): (WebCore::willSendRequest): (WebCore::didReceiveResponse): (WebCore::didReceiveData): (WebCore::didSendBodyData): (WebCore::shouldUseCredentialStorageCallback): (WebCore::didFinishLoading): (WebCore::didFail): (WebCore::didReceiveChallenge): (WebCore::makeFinalRequest): (WebCore::ResourceHandle::willLoadFromCache):
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86415 r86416  
     12011-05-12  Pratik Solanki  <psolanki@apple.com>
     2
     3        Reviewed by Antti Koivisto.
     4
     5        Part of WebCore should use CFNetwork-based loader on Mac
     6        https://bugs.webkit.org/show_bug.cgi?id=51836
     7
     8        Fixes for warnings and other minor cleanups when we enable USE_CFNETWORK on Mac.
     9
     10        * platform/network/cf/ResourceErrorCF.cpp:
     11        (WebCore::ResourceError::cfStreamError):
     12        * platform/network/cf/ResourceHandleCFNet.cpp:
     13        (WebCore::allowsAnyHTTPSCertificateHosts):
     14        (WebCore::clientCerts):
     15        (WebCore::willSendRequest):
     16        (WebCore::didReceiveResponse):
     17        (WebCore::didReceiveData):
     18        (WebCore::didSendBodyData):
     19        (WebCore::shouldUseCredentialStorageCallback):
     20        (WebCore::didFinishLoading):
     21        (WebCore::didFail):
     22        (WebCore::didReceiveChallenge):
     23        (WebCore::makeFinalRequest):
     24        (WebCore::ResourceHandle::willLoadFromCache):
     25
    1262011-05-12  Pratik Solanki  <psolanki@apple.com>
    227
  • trunk/Source/WebCore/platform/network/cf/ResourceErrorCF.cpp

    r82146 r86416  
    197197    else if (m_domain == "NSOSStatusErrorDomain")
    198198        result.domain = kCFStreamErrorDomainMacOSStatus;
    199     else
     199    else {
     200        result.domain = kCFStreamErrorDomainCustom;
    200201        ASSERT_NOT_REACHED();
     202    }
    201203
    202204    return result;
  • trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp

    r86415 r86416  
    107107static HashSet<String>& allowsAnyHTTPSCertificateHosts()
    108108{
    109     static HashSet<String> hosts;
    110 
     109    DEFINE_STATIC_LOCAL(HashSet<String>, hosts, ());
    111110    return hosts;
    112111}
     
    114113static HashMap<String, RetainPtr<CFDataRef> >& clientCerts()
    115114{
    116     static HashMap<String, RetainPtr<CFDataRef> > certs;
     115    typedef HashMap<String, RetainPtr<CFDataRef> > CertsMap;
     116    DEFINE_STATIC_LOCAL(CertsMap, certs, ());
    117117    return certs;
    118118}
     
    130130}
    131131
    132 CFURLRequestRef willSendRequest(CFURLConnectionRef conn, CFURLRequestRef cfRequest, CFURLResponseRef cfRedirectResponse, const void* clientInfo)
    133 {
     132static CFURLRequestRef willSendRequest(CFURLConnectionRef conn, CFURLRequestRef cfRequest, CFURLResponseRef cfRedirectResponse, const void* clientInfo)
     133{
     134#if LOG_DISABLED
     135    UNUSED_PARAM(conn);
     136#endif
    134137    ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
    135138
     
    185188}
    186189
    187 void didReceiveResponse(CFURLConnectionRef conn, CFURLResponseRef cfResponse, const void* clientInfo)
    188 {
     190static void didReceiveResponse(CFURLConnectionRef conn, CFURLResponseRef cfResponse, const void* clientInfo)
     191{
     192#if LOG_DISABLED
     193    UNUSED_PARAM(conn);
     194#endif
    189195    ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
    190196
     
    203209}
    204210
    205 void didReceiveData(CFURLConnectionRef conn, CFDataRef data, CFIndex originalLength, const void* clientInfo)
    206 {
     211static void didReceiveData(CFURLConnectionRef conn, CFDataRef data, CFIndex originalLength, const void* clientInfo)
     212{
     213#if LOG_DISABLED
     214    UNUSED_PARAM(conn);
     215#endif
    207216    ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
    208217    const UInt8* bytes = CFDataGetBytePtr(data);
    209218    CFIndex length = CFDataGetLength(data);
    210219
    211     LOG(Network, "CFNet - didReceiveData(conn=%p, handle=%p, bytes=%d) (%s)", conn, handle, length, handle->firstRequest().url().string().utf8().data());
     220    LOG(Network, "CFNet - didReceiveData(conn=%p, handle=%p, bytes=%ld) (%s)", conn, handle, length, handle->firstRequest().url().string().utf8().data());
    212221
    213222    if (handle->client())
     
    215224}
    216225
    217 static void didSendBodyData(CFURLConnectionRef conn, CFIndex bytesWritten, CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite, const void *clientInfo)
     226static void didSendBodyData(CFURLConnectionRef, CFIndex, CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite, const void *clientInfo)
    218227{
    219228    ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
     
    225234static Boolean shouldUseCredentialStorageCallback(CFURLConnectionRef conn, const void* clientInfo)
    226235{
     236#if LOG_DISABLED
     237    UNUSED_PARAM(conn);
     238#endif
    227239    ResourceHandle* handle = const_cast<ResourceHandle*>(static_cast<const ResourceHandle*>(clientInfo));
    228240
     
    235247}
    236248
    237 void didFinishLoading(CFURLConnectionRef conn, const void* clientInfo)
    238 {
     249static void didFinishLoading(CFURLConnectionRef conn, const void* clientInfo)
     250{
     251#if LOG_DISABLED
     252    UNUSED_PARAM(conn);
     253#endif
    239254    ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
    240255
     
    245260}
    246261
    247 void didFail(CFURLConnectionRef conn, CFErrorRef error, const void* clientInfo)
    248 {
     262static void didFail(CFURLConnectionRef conn, CFErrorRef error, const void* clientInfo)
     263{
     264#if LOG_DISABLED
     265    UNUSED_PARAM(conn);
     266#endif
    249267    ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
    250268
     
    284302}
    285303
    286 void didReceiveChallenge(CFURLConnectionRef conn, CFURLAuthChallengeRef challenge, const void* clientInfo)
    287 {
     304static void didReceiveChallenge(CFURLConnectionRef conn, CFURLAuthChallengeRef challenge, const void* clientInfo)
     305{
     306#if LOG_DISABLED
     307    UNUSED_PARAM(conn);
     308#endif
    288309    ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo));
    289310    ASSERT(handle);
     
    293314}
    294315
    295 void addHeadersFromHashMap(CFMutableURLRequestRef request, const HTTPHeaderMap& requestHeaders)
    296 {
    297     if (!requestHeaders.size())
    298         return;
    299 
    300     HTTPHeaderMap::const_iterator end = requestHeaders.end();
    301     for (HTTPHeaderMap::const_iterator it = requestHeaders.begin(); it != end; ++it) {
    302         CFStringRef key = it->first.createCFString();
    303         CFStringRef value = it->second.createCFString();
    304         CFURLRequestSetHTTPHeaderFieldValue(request, key, value);
    305         CFRelease(key);
    306         CFRelease(value);
    307     }
    308 }
    309 
    310316ResourceHandleInternal::~ResourceHandleInternal()
    311317{
     
    319325{
    320326    LOG(Network, "CFNet - Destroying job %p (%s)", this, d->m_firstRequest.url().string().utf8().data());
    321 }
    322 
    323 CFArrayRef arrayFromFormData(const FormData& d)
    324 {
    325     size_t size = d.elements().size();
    326     CFMutableArrayRef a = CFArrayCreateMutable(0, d.elements().size(), &kCFTypeArrayCallBacks);
    327     for (size_t i = 0; i < size; ++i) {
    328         const FormDataElement& e = d.elements()[i];
    329         if (e.m_type == FormDataElement::data) {
    330             CFDataRef data = CFDataCreate(0, (const UInt8*)e.m_data.data(), e.m_data.size());
    331             CFArrayAppendValue(a, data);
    332             CFRelease(data);
    333         } else {
    334             ASSERT(e.m_type == FormDataElement::encodedFile);
    335             CFStringRef filename = e.m_filename.createCFString();
    336             CFArrayAppendValue(a, filename);
    337             CFRelease(filename);
    338         }
    339     }
    340     return a;
    341327}
    342328
     
    365351        if (!sslProps)
    366352            sslProps.adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
     353#if PLATFORM(WIN)
    367354        wkSetClientCertificateInSSLProperties(sslProps.get(), (clientCert->second).get());
     355#endif
    368356    }
    369357
     
    715703}
    716704
    717 bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame* frame)
     705bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*)
    718706{
    719707    request.setCachePolicy(ReturnCacheDataDontLoad);
Note: See TracChangeset for help on using the changeset viewer.