Changeset 90825 in webkit
- Timestamp:
- Jul 12, 2011 10:51:16 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90819 r90825 1 2011-07-12 Pratik Solanki <psolanki@apple.com> 2 3 Reviewed by David Kilzer. 4 5 Add NSURLResponse wrapper in ResourceResponse when USE(CFNETWORK) is enabled 6 https://bugs.webkit.org/show_bug.cgi?id=63286 7 8 When USE(CFNETWORK) is enabled on Mac, keep an NSURLResponse object along with the 9 CFURLResponseRef so that WebKit can continue using the NSURLResponse. 10 11 No new tests because no change in functionality and option is not enabled on Mac. 12 13 * platform/network/cf/ResourceResponse.h: 14 (WebCore::ResourceResponse::ResourceResponse): 15 * platform/network/mac/ResourceResponseMac.mm: 16 (WebCore::ResourceResponse::initNSURLResponse): 17 (WebCore::ResourceResponse::nsURLResponse): 18 (WebCore::ResourceResponse::ResourceResponse): 19 1 20 2011-07-12 Pavel Podivilov <podivilov@chromium.org> 2 21 … … 88 107 (WebCore::HTMLInputElement::setChecked): 89 108 90 2011-0 6-23Pratik Solanki <psolanki@apple.com>109 2011-07-11 Pratik Solanki <psolanki@apple.com> 91 110 92 111 Reviewed by David Kilzer. -
trunk/Source/WebCore/platform/network/cf/ResourceResponse.h
r87460 r90825 32 32 #if USE(CFNETWORK) 33 33 typedef struct _CFURLResponse* CFURLResponseRef; 34 #else 34 #endif 35 35 36 #ifdef __OBJC__ 36 37 @class NSURLResponse; 37 38 #else 38 39 class NSURLResponse; 39 #endif40 40 #endif 41 41 … … 56 56 m_isNull = !cfResponse; 57 57 } 58 #if PLATFORM(MAC) 59 ResourceResponse(NSURLResponse *); 60 #endif 58 61 #else 59 ResourceResponse(NSURLResponse *nsResponse)62 ResourceResponse(NSURLResponse *nsResponse) 60 63 : m_nsResponse(nsResponse) 61 64 , m_initLevel(Uninitialized) … … 85 88 #if USE(CFNETWORK) 86 89 CFURLResponseRef cfURLResponse() const; 87 #else 90 #endif 91 #if PLATFORM(MAC) 88 92 NSURLResponse *nsURLResponse() const; 89 93 #endif … … 95 99 PassOwnPtr<CrossThreadResourceResponseData> doPlatformCopyData(PassOwnPtr<CrossThreadResourceResponseData> data) const { return data; } 96 100 void doPlatformAdopt(PassOwnPtr<CrossThreadResourceResponseData>) { } 101 #if PLATFORM(MAC) 102 void initNSURLResponse() const; 103 #endif 97 104 98 105 static bool platformCompare(const ResourceResponse& a, const ResourceResponse& b); … … 100 107 #if USE(CFNETWORK) 101 108 mutable RetainPtr<CFURLResponseRef> m_cfResponse; 102 #else 109 #endif 110 #if PLATFORM(MAC) 103 111 mutable RetainPtr<NSURLResponse> m_nsResponse; 104 112 #endif -
trunk/Source/WebCore/platform/network/mac/ResourceResponseMac.mm
r87460 r90825 27 27 #import "ResourceResponse.h" 28 28 29 #if !USE(CFNETWORK)30 31 29 #import "HTTPParsers.h" 32 30 #import "WebCoreURLResponse.h" … … 37 35 #include <wtf/text/CString.h> 38 36 39 @interface NSURLResponse (FoundationSecretsWebCoreKnowsAbout) 37 using namespace std; 38 39 @interface NSURLResponse (WebNSURLResponseDetails) 40 40 - (NSTimeInterval)_calculatedExpiration; 41 - (id)_initWithCFURLResponse:(CFURLResponseRef)response; 42 - (CFURLResponseRef) _CFURLResponse; 43 + (id)_responseWithCFURLResponse:(CFURLResponseRef)response; 41 44 @end 42 45 … … 49 52 static const int numCommonHeaderFields = sizeof(commonHeaderFields) / sizeof(AtomicString*); 50 53 54 void ResourceResponse::initNSURLResponse() const 55 { 56 // Work around a mistake in the NSURLResponse class - <rdar://problem/3346574>. 57 // The init function takes an NSInteger, even though the accessor returns a long long. 58 // For values that won't fit in an NSInteger, pass -1 instead. 59 NSInteger expectedContentLength; 60 if (m_expectedContentLength < 0 || m_expectedContentLength > numeric_limits<NSInteger>::max()) 61 expectedContentLength = -1; 62 else 63 expectedContentLength = static_cast<NSInteger>(m_expectedContentLength); 64 m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]); 65 } 66 67 #if USE(CFNETWORK) 68 51 69 NSURLResponse *ResourceResponse::nsURLResponse() const 52 70 { 53 if (!m_nsResponse && !m_isNull) { 54 // Work around a mistake in the NSURLResponse class. 55 // The init function takes an NSInteger, even though the accessor returns a long long. 56 // For values that won't fit in an NSInteger, pass -1 instead. 57 NSInteger expectedContentLength; 58 if (m_expectedContentLength < 0 || m_expectedContentLength > std::numeric_limits<NSInteger>::max()) 59 expectedContentLength = -1; 60 else 61 expectedContentLength = static_cast<NSInteger>(m_expectedContentLength); 62 const_cast<ResourceResponse*>(this)->m_nsResponse.adoptNS([[NSURLResponse alloc] initWithURL:m_url MIMEType:m_mimeType expectedContentLength:expectedContentLength textEncodingName:m_textEncodingName]); 71 if (!m_nsResponse && !m_cfResponse && !m_isNull) { 72 initNSURLResponse(); 73 m_cfResponse = [m_nsResponse.get() _CFURLResponse]; 63 74 } 75 76 if (!m_cfResponse) 77 return nil; 78 79 if (!m_nsResponse) 80 m_nsResponse.adoptNS([[NSURLResponse _responseWithCFURLResponse:m_cfResponse.get()] retain]); 81 82 return m_nsResponse.get(); 83 } 84 85 ResourceResponse::ResourceResponse(NSURLResponse* nsResponse) 86 : m_cfResponse([nsResponse _CFURLResponse]) 87 , m_nsResponse(nsResponse) 88 , m_initLevel(Uninitialized) 89 { 90 m_isNull = !nsResponse; 91 } 92 93 #else 94 95 NSURLResponse *ResourceResponse::nsURLResponse() const 96 { 97 if (!m_nsResponse && !m_isNull) 98 initNSURLResponse(); 64 99 return m_nsResponse.get(); 65 100 } … … 137 172 } 138 173 174 #endif // USE(CFNETWORK) 175 139 176 } // namespace WebCore 140 177 141 #endif // !USE(CFNETWORK)
Note: See TracChangeset
for help on using the changeset viewer.