Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1677)

Side by Side Diff: Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp

Issue 12090050: Revert 138962 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1397/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 CFURLConnectionHalt(d->m_connection.get()); 801 CFURLConnectionHalt(d->m_connection.get());
802 else 802 else
803 CFURLConnectionResume(d->m_connection.get()); 803 CFURLConnectionResume(d->m_connection.get());
804 } 804 }
805 805
806 bool ResourceHandle::loadsBlocked() 806 bool ResourceHandle::loadsBlocked()
807 { 807 {
808 return false; 808 return false;
809 } 809 }
810 810
811 bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*)
812 {
813 request.setCachePolicy(ReturnCacheDataDontLoad);
814
815 CFURLResponseRef cfResponse = 0;
816 CFErrorRef cfError = 0;
817 RetainPtr<CFDataRef> data = adoptCF(CFURLConnectionSendSynchronousRequest(re quest.cfURLRequest(), &cfResponse, &cfError, request.timeoutInterval()));
818 bool cached = cfResponse && !cfError;
819
820 if (cfError)
821 CFRelease(cfError);
822 if (cfResponse)
823 CFRelease(cfResponse);
824
825 return cached;
826 }
827
811 #if PLATFORM(MAC) 828 #if PLATFORM(MAC)
812 void ResourceHandle::schedule(SchedulePair* pair) 829 void ResourceHandle::schedule(SchedulePair* pair)
813 { 830 {
814 CFRunLoopRef runLoop = pair->runLoop(); 831 CFRunLoopRef runLoop = pair->runLoop();
815 if (!runLoop) 832 if (!runLoop)
816 return; 833 return;
817 834
818 CFURLConnectionScheduleWithRunLoop(d->m_connection.get(), runLoop, pair->mod e()); 835 CFURLConnectionScheduleWithRunLoop(d->m_connection.get(), runLoop, pair->mod e());
819 if (d->m_startWhenScheduled) { 836 if (d->m_startWhenScheduled) {
820 CFURLConnectionStart(d->m_connection.get()); 837 CFURLConnectionStart(d->m_connection.get());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 CFDataRef data = static_cast<CFDataRef>(CFArrayGetValueAtIndex(dataArray , index)); 935 CFDataRef data = static_cast<CFDataRef>(CFArrayGetValueAtIndex(dataArray , index));
919 CFDataAppendBytes(mergedData.get(), CFDataGetBytePtr(data), CFDataGetLen gth(data)); 936 CFDataAppendBytes(mergedData.get(), CFDataGetBytePtr(data), CFDataGetLen gth(data));
920 } 937 }
921 938
922 client()->didReceiveData(this, reinterpret_cast<const char*>(CFDataGetBytePt r(mergedData.get())), totalSize, static_cast<int>(totalSize)); 939 client()->didReceiveData(this, reinterpret_cast<const char*>(CFDataGetBytePt r(mergedData.get())), totalSize, static_cast<int>(totalSize));
923 } 940 }
924 #endif 941 #endif
925 942
926 } // namespace WebCore 943 } // namespace WebCore
927 944
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698