[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:26:44 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 85d75062e4b08cde6e7f909ced68ae77e2c9f8af
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Feb 14 02:10:46 2004 +0000
WebCore:
Reviewed by John.
- redo visited link history checking for a 2% speed improvement
* kwq/KWQKHistoryProvider.mm:
(KParts::HistoryProvider::contains): Don't make a KURL or an
NSString. Punt on canonicalization and directly pass the internal
Latin1 or unicode buffer.
* kwq/KWQString.h:
* kwq/KWQString.mm:
(QString::hasFastLatin1): New method to check whether getting the
latin1 buffer is fast (doesn't allocate).
* kwq/WebCoreHistory.h: add new methods to look up by raw latin1
or unicode buffer instead of NSString.
WebKit:
Reviewed by John.
- redo visited link history checking for a 2% speed improvement
* History.subproj/WebHistory.m:
(-[_WebCoreHistoryProvider containsItemForURLString:]): Removed.
(-[_WebCoreHistoryProvider containsItemForURLLatin1:length:]): Implemented.
For https and http URLs with empty path, add a slash. Make a CFString
using the passed-in latin1 buffer without copying.
(-[_WebCoreHistoryProvider containsItemForURLUnicode:length:]): Ditto
for unicode.
(matchLetter): New static helper function.
(matchUnicodeLetter): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 99688b9..268011b 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,20 @@
+2004-02-12 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by John.
+
+ - redo visited link history checking for a 2% speed improvement
+
+ * kwq/KWQKHistoryProvider.mm:
+ (KParts::HistoryProvider::contains): Don't make a KURL or an
+ NSString. Punt on canonicalization and directly pass the internal
+ Latin1 or unicode buffer.
+ * kwq/KWQString.h:
+ * kwq/KWQString.mm:
+ (QString::hasFastLatin1): New method to check whether getting the
+ latin1 buffer is fast (doesn't allocate).
+ * kwq/WebCoreHistory.h: add new methods to look up by raw latin1
+ or unicode buffer instead of NSString.
+
=== Safari-128 ===
2004-02-12 David Hyatt <hyatt at apple.com>
diff --git a/WebCore/kwq/KWQKHistoryProvider.mm b/WebCore/kwq/KWQKHistoryProvider.mm
index 5d8c1cf..a6483e9 100644
--- a/WebCore/kwq/KWQKHistoryProvider.mm
+++ b/WebCore/kwq/KWQKHistoryProvider.mm
@@ -44,11 +44,13 @@ void HistoryProvider::insert(const QString &s)
bool HistoryProvider::contains(const QString &s) const
{
- KWQ_BLOCK_EXCEPTIONS;
- return [[WebCoreHistory historyProvider] containsItemForURLString: KURL(s).canonicalURL().getNSString()];
- KWQ_UNBLOCK_EXCEPTIONS;
+ // the other side of the bridge is careful not to throw exceptions here
- return false;
+ if (s.hasFastLatin1()) {
+ return [[WebCoreHistory historyProvider] containsItemForURLLatin1:s.latin1() length:s.length()];
+ } else {
+ return [[WebCoreHistory historyProvider] containsItemForURLUnicode:(UniChar *)s.unicode() length:s.length()];
+ }
}
} // namespace KParts
diff --git a/WebCore/kwq/KWQString.h b/WebCore/kwq/KWQString.h
index a1c087a..76b1d59 100644
--- a/WebCore/kwq/KWQString.h
+++ b/WebCore/kwq/KWQString.h
@@ -410,6 +410,7 @@ public:
const char *ascii() const;
bool isAllASCII() const;
bool isAllLatin1() const;
+ bool hasFastLatin1() const;
void copyLatin1(char *latin1) const;
QCString utf8() const { int length; return utf8(length); }
QCString utf8(int &length) const;
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index a79efec..e4bce36 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -1533,6 +1533,12 @@ bool QString::isAllLatin1() const
return true;
}
+bool QString::hasFastLatin1() const
+{
+ KWQStringData *data = *dataHandle;
+ return data->_isAsciiValid;
+}
+
void QString::copyLatin1(char *buffer) const
{
KWQStringData *data = *dataHandle;
diff --git a/WebCore/kwq/WebCoreHistory.h b/WebCore/kwq/WebCoreHistory.h
index 8550784..4016b57 100644
--- a/WebCore/kwq/WebCoreHistory.h
+++ b/WebCore/kwq/WebCoreHistory.h
@@ -26,7 +26,8 @@
#import <Foundation/Foundation.h>
@protocol WebCoreHistoryProvider <NSObject>
-- (BOOL)containsItemForURLString:(NSString *)urlString;
+- (BOOL)containsItemForURLLatin1:(const char *)latin1 length:(unsigned)length;
+- (BOOL)containsItemForURLUnicode:(const UniChar *)unicode length:(unsigned)length;
@end
@interface WebCoreHistory : NSObject
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 422b673..7081bc8 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,19 @@
+2004-02-12 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by John.
+
+ - redo visited link history checking for a 2% speed improvement
+
+ * History.subproj/WebHistory.m:
+ (-[_WebCoreHistoryProvider containsItemForURLString:]): Removed.
+ (-[_WebCoreHistoryProvider containsItemForURLLatin1:length:]): Implemented.
+ For https and http URLs with empty path, add a slash. Make a CFString
+ using the passed-in latin1 buffer without copying.
+ (-[_WebCoreHistoryProvider containsItemForURLUnicode:length:]): Ditto
+ for unicode.
+ (matchLetter): New static helper function.
+ (matchUnicodeLetter): Ditto.
+
=== Safari-128 ===
2004-02-10 Ken Kocienda <kocienda at apple.com>
diff --git a/WebKit/History.subproj/WebHistory.m b/WebKit/History.subproj/WebHistory.m
index e1ba922..402cef7 100644
--- a/WebKit/History.subproj/WebHistory.m
+++ b/WebKit/History.subproj/WebHistory.m
@@ -498,9 +498,120 @@ NSString *DatesArrayKey = @"WebHistoryDates";
return self;
}
-- (BOOL)containsItemForURLString: (NSString *)URLString
+static inline bool matchLetter(char c, char lowercaseLetter)
+{
+ return (c | 0x20) == lowercaseLetter;
+}
+
+static inline bool matchUnicodeLetter(UniChar c, UniChar lowercaseLetter)
+{
+ return (c | 0x20) == lowercaseLetter;
+}
+
+#define BUFFER_SIZE 2048
+
+- (BOOL)containsItemForURLLatin1:(const char *)latin1 length:(unsigned)length
{
- return [history containsItemForURLString: URLString];
+ const char *latin1Str = latin1;
+ char staticStrBuffer[BUFFER_SIZE];
+ char *strBuffer = NULL;
+ BOOL needToAddSlash = FALSE;
+
+ if (length >= 6 &&
+ matchLetter(latin1[0], 'h') &&
+ matchLetter(latin1[1], 't') &&
+ matchLetter(latin1[2], 't') &&
+ matchLetter(latin1[3], 'p') &&
+ (latin1[4] == ':'
+ || (matchLetter(latin1[4], 's') && latin1[5] == ':'))) {
+ int pos = latin1[4] == ':' ? 5 : 6;
+ // skip possible initial two slashes
+ if (latin1[pos] == '/' && latin1[pos + 1] == '/') {
+ pos += 2;
+ }
+
+ char *nextSlash = strchr(latin1 + pos, '/');
+ if (nextSlash == NULL) {
+ needToAddSlash = TRUE;
+ }
+ }
+
+ if (needToAddSlash) {
+ if (length + 1 <= 2048) {
+ strBuffer = staticStrBuffer;
+ } else {
+ strBuffer = malloc(length + 2);
+ }
+ memcpy(strBuffer, latin1, length + 1);
+ strBuffer[length] = '/';
+ strBuffer[length+1] = '\0';
+ length++;
+
+ latin1Str = strBuffer;
+ }
+
+ CFStringRef str = CFStringCreateWithCStringNoCopy(NULL, latin1Str, kCFStringEncodingWindowsLatin1, kCFAllocatorNull);
+ BOOL result = [history containsItemForURLString:(id)str];
+ CFRelease(str);
+
+ if (strBuffer != staticStrBuffer) {
+ free(strBuffer);
+ }
+
+ return result;
+}
+
+- (BOOL)containsItemForURLUnicode:(const UniChar *)unicode length:(unsigned)length
+{
+ const UniChar *unicodeStr = unicode;
+ UniChar staticStrBuffer[1024];
+ UniChar *strBuffer = NULL;
+ BOOL needToAddSlash = FALSE;
+
+ if (length >= 6 &&
+ matchUnicodeLetter(unicode[0], 'h') &&
+ matchUnicodeLetter(unicode[1], 't') &&
+ matchUnicodeLetter(unicode[2], 't') &&
+ matchUnicodeLetter(unicode[3], 'p') &&
+ (unicode[4] == ':'
+ || (matchLetter(unicode[4], 's') && unicode[5] == ':'))) {
+ unsigned pos = unicode[4] == ':' ? 5 : 6;
+ // skip possible initial two slashes
+ if (unicode[pos] == '/' && unicode[pos + 1] == '/') {
+ pos += 2;
+ }
+
+ while (unicode[pos] != '/' && pos < length) {
+ pos++;
+ }
+
+ if (pos == length) {
+ needToAddSlash = TRUE;
+ }
+ }
+
+ if (needToAddSlash) {
+ if (length + 1 <= 1024) {
+ strBuffer = staticStrBuffer;
+ } else {
+ strBuffer = malloc(sizeof(UniChar) * (length + 1));
+ }
+ memcpy(strBuffer, unicode, 2 * length);
+ strBuffer[length] = '/';
+ length++;
+
+ unicodeStr = strBuffer;
+ }
+
+ CFStringRef str = CFStringCreateWithCharactersNoCopy(NULL, unicodeStr, length, kCFAllocatorNull);
+ BOOL result = [history containsItemForURLString:(id)str];
+ CFRelease(str);
+
+ if (strBuffer != staticStrBuffer) {
+ free(strBuffer);
+ }
+
+ return result;
}
- (void)dealloc
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list