RESOLVED FIXED 63155
Add NSError wrapper functions in ResourceError when USE(CFNETWORK) is enabled
https://bugs.webkit.org/show_bug.cgi?id=63155
Summary Add NSError wrapper functions in ResourceError when USE(CFNETWORK) is enabled
Pratik Solanki
Reported 2011-06-22 10:55:08 PDT
This is part of the move to the CFNetwork based loader on Mac - bug 51836. In order to send back NSError objects to WebKit on Mac, we need to have a wrapper NSError methods in ResourceError.
Attachments
Patch (13.02 KB, patch)
2011-06-22 11:11 PDT, Pratik Solanki
no flags
Patch (4.22 KB, patch)
2011-06-22 14:11 PDT, Pratik Solanki
darin: review+
Pratik Solanki
Comment 1 2011-06-22 11:11:08 PDT
Darin Adler
Comment 2 2011-06-22 11:28:17 PDT
Comment on attachment 98202 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=98202&action=review > Source/WebCore/platform/network/mac/ResourceErrorMac.mm:56 > + RetainPtr<NSDictionary> userInfo(AdoptNS, (NSDictionary *) CFErrorCopyUserInfo(error)); This needs to be AdoptCF, not AdoptNS. The difference between the two is in garbage collection mode. What matters is the type of retain, CFRetain vs [retain]. > Source/WebCore/platform/network/mac/ResourceErrorMac.mm:57 > + return [NSError errorWithDomain:(NSString*)CFErrorGetDomain(error) code:CFErrorGetCode(error) userInfo:userInfo.get()]; Don’t we want to cache a single NSError rather than creating new autoreleased one every time? I’m worried about the performance implications of creating new ones every time. > Source/WebKit/mac/ChangeLog:8 > + Use the explicit ResourceError::nsError() method instead of implicit operator casts. Why?
Pratik Solanki
Comment 3 2011-06-22 13:10:34 PDT
(In reply to comment #2) > (From update of attachment 98202 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=98202&action=review > > > Source/WebCore/platform/network/mac/ResourceErrorMac.mm:56 > > + RetainPtr<NSDictionary> userInfo(AdoptNS, (NSDictionary *) CFErrorCopyUserInfo(error)); > > This needs to be AdoptCF, not AdoptNS. ok > > Source/WebCore/platform/network/mac/ResourceErrorMac.mm:57 > > + return [NSError errorWithDomain:(NSString*)CFErrorGetDomain(error) code:CFErrorGetCode(error) userInfo:userInfo.get()]; > > Don’t we want to cache a single NSError rather than creating new autoreleased one every time? I’m worried about the performance implications of creating new ones every time. Yeah, I think we should cache it. Rewriting this part. > > Source/WebKit/mac/ChangeLog:8 > > + Use the explicit ResourceError::nsError() method instead of implicit operator casts. > > Why? I should have explained more in the changelog. I am pretty sure I was getting compile errors because the compiler was confused while trying to convert a ResourceError to an NSError* when USE(CFNETWORK) was enabled. But I am not seeing those anymore. I'll remove those changes.
Pratik Solanki
Comment 4 2011-06-22 14:11:04 PDT
Darin Adler
Comment 5 2011-06-22 17:30:19 PDT
Comment on attachment 98239 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=98239&action=review > Source/WebCore/platform/network/mac/ResourceErrorMac.mm:58 > + RetainPtr<NSDictionary> userInfo(AdoptCF, (NSDictionary *) CFErrorCopyUserInfo(error)); > + m_platformNSError.adoptNS([[NSError alloc] initWithDomain:(NSString*)CFErrorGetDomain(error) code:CFErrorGetCode(error) userInfo:userInfo.get()]); Different formatting of the typecasts on two successive lines.
Pratik Solanki
Comment 6 2011-06-22 23:01:05 PDT
Note You need to log in before you can comment on or make changes to this bug.