Changeset 174787 in webkit
- Timestamp:
- Oct 16, 2014, 12:45:31 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r174761 r174787 1 2014-10-16 Alexey Proskuryakov <ap@apple.com> 2 3 Crashes in ResourceHandleCFURLConnectionDelegateWithOperationQueue due to unimplemented retain/release 4 https://bugs.webkit.org/show_bug.cgi?id=137779 5 rdar://problem/18679320 6 7 Reviewed by Brady Eidson. 8 9 * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp: 10 (WebCore::ResourceHandleCFURLConnectionDelegate::retain): 11 (WebCore::ResourceHandleCFURLConnectionDelegate::release): 12 (WebCore::ResourceHandleCFURLConnectionDelegate::makeConnectionClient): 13 * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h: 14 Implemented retain/release. They are necessary, as ResourceHandle goes away when 15 it's canceled, and there is noone else to keep the client object alive but 16 CFURLConnection itself. 17 18 * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp: 19 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest): 20 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse): 21 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData): 22 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading): 23 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail): 24 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse): 25 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge): 26 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData): 27 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace): 28 (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveDataArray): 29 Added a FIXME about potential improvements that I spotted while invsestigating this. 30 1 31 2014-10-15 Andrei Bucur <abucur@adobe.com> 2 32 -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp
r169082 r174787 57 57 } 58 58 59 const void* ResourceHandleCFURLConnectionDelegate::retain(const void* clientInfo) 60 { 61 static_cast<ResourceHandleCFURLConnectionDelegate*>(const_cast<void*>(clientInfo))->ref(); 62 return clientInfo; 63 } 64 65 void ResourceHandleCFURLConnectionDelegate::release(const void* clientInfo) 66 { 67 static_cast<ResourceHandleCFURLConnectionDelegate*>(const_cast<void*>(clientInfo))->deref(); 68 } 69 59 70 CFURLRequestRef ResourceHandleCFURLConnectionDelegate::willSendRequestCallback(CFURLConnectionRef, CFURLRequestRef cfRequest, CFURLResponseRef originalRedirectResponse, const void* clientInfo) 60 71 { … … 174 185 CFURLConnectionClient_V6 ResourceHandleCFURLConnectionDelegate::makeConnectionClient() const 175 186 { 176 CFURLConnectionClient_V6 client = { 6, this, 0, 0, 0, 187 CFURLConnectionClient_V6 client = { 6, this, 188 &ResourceHandleCFURLConnectionDelegate::retain, 189 &ResourceHandleCFURLConnectionDelegate::release, 190 0, // copyDescription 177 191 &ResourceHandleCFURLConnectionDelegate::willSendRequestCallback, 178 192 &ResourceHandleCFURLConnectionDelegate::didReceiveResponseCallback, -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.h
r174244 r174787 60 60 61 61 private: 62 static const void* retain(const void*); 63 static void release(const void*); 62 64 static CFURLRequestRef willSendRequestCallback(CFURLConnectionRef, CFURLRequestRef, CFURLResponseRef, const void* clientInfo); 63 65 static void didReceiveResponseCallback(CFURLConnectionRef, CFURLResponseRef, const void* clientInfo); -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp
r174244 r174787 102 102 ASSERT(!isMainThread()); 103 103 104 // FIXME: The block implicitly copies protector object, which is wasteful. We should just call ref(), 105 // capture "this" by pointer value, and use a C++ lambda to prevent other unintentional capturing. 104 106 RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this); 105 107 … … 126 128 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse(CFURLConnectionRef connection, CFURLResponseRef cfResponse) 127 129 { 130 // FIXME: The block implicitly copies protector object, which is wasteful. We should just call ref(), 131 // capture "this" by pointer value, and use a C++ lambda to prevent other unintentional capturing. 128 132 RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this); 129 133 … … 162 166 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData(CFDataRef data, CFIndex originalLength) 163 167 { 168 // FIXME: The block implicitly copies protector object, which is wasteful. We should just call ref(), 169 // capture "this" by pointer value, and use a C++ lambda to prevent other unintentional capturing. 164 170 RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this); 165 171 CFRetain(data); … … 178 184 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading() 179 185 { 186 // FIXME: The block implicitly copies protector object, which is wasteful. We should just call ref(), 187 // capture "this" by pointer value, and use a C++ lambda to prevent other unintentional capturing. 180 188 RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this); 181 189 dispatch_async(dispatch_get_main_queue(), ^{ … … 191 199 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail(CFErrorRef error) 192 200 { 201 // FIXME: The block implicitly copies protector object, which is wasteful. We should just call ref(), 202 // capture "this" by pointer value, and use a C++ lambda to prevent other unintentional capturing. 193 203 RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this); 194 204 CFRetain(error); … … 206 216 CFCachedURLResponseRef ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse(CFCachedURLResponseRef cachedResponse) 207 217 { 218 // FIXME: The block implicitly copies protector object, which is wasteful. We should just call ref(), 219 // capture "this" by pointer value, and use a C++ lambda to prevent other unintentional capturing. 208 220 RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this); 209 221 … … 224 236 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge(CFURLAuthChallengeRef challenge) 225 237 { 238 // FIXME: The block implicitly copies protector object, which is wasteful. We should just call ref(), 239 // capture "this" by pointer value, and use a C++ lambda to prevent other unintentional capturing. 226 240 RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this); 227 241 CFRetain(challenge); … … 239 253 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData(CFIndex totalBytesWritten, CFIndex totalBytesExpectedToWrite) 240 254 { 255 // FIXME: The block implicitly copies protector object, which is wasteful. We should just call ref(), 256 // capture "this" by pointer value, and use a C++ lambda to prevent other unintentional capturing. 241 257 RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this); 242 258 dispatch_async(dispatch_get_main_queue(), ^{ … … 258 274 Boolean ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace(CFURLProtectionSpaceRef protectionSpace) 259 275 { 276 // FIXME: The block implicitly copies protector object, which is wasteful. We should just call ref(), 277 // capture "this" by pointer value, and use a C++ lambda to prevent other unintentional capturing. 260 278 RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this); 261 279 … … 286 304 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveDataArray(CFArrayRef dataArray) 287 305 { 306 // FIXME: The block implicitly copies protector object, which is wasteful. We should just call ref(), 307 // capture "this" by pointer value, and use a C++ lambda to prevent other unintentional capturing. 288 308 RefPtr<ResourceHandleCFURLConnectionDelegateWithOperationQueue> protector(this); 289 309 CFRetain(dataArray);
Note:
See TracChangeset
for help on using the changeset viewer.