- .5% speed improvement by avoiding excess CFURLRef allocation
* loader/CachedResource.cpp:
(WebCore::CachedResource::getCFURL): New method. For Mac only (for now), cache the CFURL
here for later reuse.
* loader/CachedResource.h:
* loader/mac/LoaderFunctionsMac.mm:
(WebCore::CheckCacheObjectStatus): Use the cached CFURL, don't make a whole new one.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@17300
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-10-26 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Anders.
+
+ - .5% speed improvement by avoiding excess CFURLRef allocation
+
+ * loader/CachedResource.cpp:
+ (WebCore::CachedResource::getCFURL): New method. For Mac only (for now), cache the CFURL
+ here for later reuse.
+ * loader/CachedResource.h:
+ * loader/mac/LoaderFunctionsMac.mm:
+ (WebCore::CheckCacheObjectStatus): Use the cached CFURL, don't make a whole new one.
+
2006-10-25 Darin Adler <darin@apple.com>
Reviewed by Anders.
#include <KURL.h>
#include <wtf/Vector.h>
+#if PLATFORM(MAC)
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
namespace WebCore {
CachedResource::CachedResource(const String& URL, Type type, CachePolicy cachePolicy, time_t expireDate, unsigned size)
}
}
+#if PLATFORM(MAC)
+CFURLRef CachedResource::getCFURL()
+{
+ if (!m_cfURL) {
+ m_cfURL = KURL(url().deprecatedString()).createCFURL();
+ CFRelease(m_cfURL.get());
+ }
+
+ return m_cfURL.get();
+}
+#endif
+
}
#include <wtf/Vector.h>
#include <time.h>
+#if PLATFORM(MAC)
+#include "RetainPtr.h"
+#endif
+
namespace WebCore {
class Cache;
String accept() const { return m_accept; }
void setAccept(const String& accept) { m_accept = accept; }
+#if PLATFORM(MAC)
+ CFURLRef getCFURL();
+#endif
+
protected:
void setSize(unsigned size);
String m_accept;
Request* m_request;
+#if PLATFORM(MAC)
+ RetainPtr<CFURLRef> m_cfURL;
+#endif
+
PlatformResponse m_response;
PlatformData m_allData;
WebCoreFrameBridge *bridge = frame->bridge();
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- [bridge objectLoadedFromCacheWithURL:KURL(cachedObject->url().deprecatedString()).getNSURL()
+ [bridge objectLoadedFromCacheWithURL:(NSURL *)cachedObject->getCFURL()
response:(NSURLResponse *)cachedObject->response()
data:(NSData *)cachedObject->allData()];
END_BLOCK_OBJC_EXCEPTIONS;