[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:17:10 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 742e47d849ea83b05f11238caa3e1e24a042597e
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jun 6 00:33:12 2002 +0000
Some fixes to speed up the citibank.com page, and other related changes.
* khtml/ecma/kjs_dom.cpp: (DOMNode::getValueProperty): Only do a layout
if it's actually needed. This speeds things up immensely, and I'm pretty
sure it's correct.
* kwq/KWQListImpl.h: To speed things up, get rid of the "private part"
level of indirection. This is particularly vital for list iterators, which
are created and destroyed a lot on the stack. Also made trivial functions
be inline.
* kwq/KWQListImpl.mm:
(copyList): Now a static function rather than a member of the now-defunct
private class.
(KWQListImpl::KWQListImpl): Set up all the new members that used to be in
the separate private object.
(KWQListImpl::~KWQListImpl): Update the iterator-detaching code to do it
the new way, with intrusive list. Also, use clear() instead of having our
own code to delete the list -- note this is only used after the level above
us does a clear() anyway.
(KWQListImpl::clear): Use a loop to delete all the nodes rather than making
a delete of one node recursively delete the next -- iteration is more efficient,
and also easier to understand in this case. Also update all the iterators so
they don't point to deleted nodes.
(KWQListImpl::containsRef): Update to return the count, rather than just a
true or false value, since that's how the class is defined.
(KWQListImpl::assign): Delete the items if asked to (fixes a FIXME). Also
use a new swap member function since there's more to swap now.
(KWQListImpl::addIterator): Rewrite to use an intrusive linked list.
(KWQListImpl::removeIterator): Rewrite to use an intrusive linked list; this
makes it much faster since it doesn't have to search the list.
(KWQListImpl::swap): Implement this private member function used by assign.
(KWQListIteratorImpl::KWQListIteratorImpl): Set up the new members that
used to be in the separate private object.
* kwq/qt/qlist.h: Re-add the operator= definition. This would cause a storage
leak, although I haven't actually observed the leak.
* kwq/qt/qbuffer.h: Initialize opened to false. This was causing a test failure.
* kwq/KWQDictImpl.h:
* kwq/KWQDictImpl.mm: Streamline implementation a bit by getting rid of
unneeded copy constructor definition and making trivial constructor for
iterator inline.
* kwq/KWQPtrDictImpl.h: Remove unneeded include.
* WebCore-tests.exp: Update for changes in the entry points
used by the tests.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1282 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 7737bcf..e547db7 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,55 @@
+2002-06-05 Darin Adler <darin at apple.com>
+
+ Some fixes to speed up the citibank.com page, and other related changes.
+
+ * khtml/ecma/kjs_dom.cpp: (DOMNode::getValueProperty): Only do a layout
+ if it's actually needed. This speeds things up immensely, and I'm pretty
+ sure it's correct.
+
+ * kwq/KWQListImpl.h: To speed things up, get rid of the "private part"
+ level of indirection. This is particularly vital for list iterators, which
+ are created and destroyed a lot on the stack. Also made trivial functions
+ be inline.
+
+ * kwq/KWQListImpl.mm:
+ (copyList): Now a static function rather than a member of the now-defunct
+ private class.
+ (KWQListImpl::KWQListImpl): Set up all the new members that used to be in
+ the separate private object.
+ (KWQListImpl::~KWQListImpl): Update the iterator-detaching code to do it
+ the new way, with intrusive list. Also, use clear() instead of having our
+ own code to delete the list -- note this is only used after the level above
+ us does a clear() anyway.
+ (KWQListImpl::clear): Use a loop to delete all the nodes rather than making
+ a delete of one node recursively delete the next -- iteration is more efficient,
+ and also easier to understand in this case. Also update all the iterators so
+ they don't point to deleted nodes.
+ (KWQListImpl::containsRef): Update to return the count, rather than just a
+ true or false value, since that's how the class is defined.
+ (KWQListImpl::assign): Delete the items if asked to (fixes a FIXME). Also
+ use a new swap member function since there's more to swap now.
+ (KWQListImpl::addIterator): Rewrite to use an intrusive linked list.
+ (KWQListImpl::removeIterator): Rewrite to use an intrusive linked list; this
+ makes it much faster since it doesn't have to search the list.
+ (KWQListImpl::swap): Implement this private member function used by assign.
+ (KWQListIteratorImpl::KWQListIteratorImpl): Set up the new members that
+ used to be in the separate private object.
+
+ * kwq/qt/qlist.h: Re-add the operator= definition. This would cause a storage
+ leak, although I haven't actually observed the leak.
+
+ * kwq/qt/qbuffer.h: Initialize opened to false. This was causing a test failure.
+
+ * kwq/KWQDictImpl.h:
+ * kwq/KWQDictImpl.mm: Streamline implementation a bit by getting rid of
+ unneeded copy constructor definition and making trivial constructor for
+ iterator inline.
+
+ * kwq/KWQPtrDictImpl.h: Remove unneeded include.
+
+ * WebCore-tests.exp: Update for changes in the entry points
+ used by the tests.
+
2002-06-05 Richard Williamson <rjw at apple.com>
Fixed 2938552. This required an implementation of KHTMLPart::frames which
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 7737bcf..e547db7 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,55 @@
+2002-06-05 Darin Adler <darin at apple.com>
+
+ Some fixes to speed up the citibank.com page, and other related changes.
+
+ * khtml/ecma/kjs_dom.cpp: (DOMNode::getValueProperty): Only do a layout
+ if it's actually needed. This speeds things up immensely, and I'm pretty
+ sure it's correct.
+
+ * kwq/KWQListImpl.h: To speed things up, get rid of the "private part"
+ level of indirection. This is particularly vital for list iterators, which
+ are created and destroyed a lot on the stack. Also made trivial functions
+ be inline.
+
+ * kwq/KWQListImpl.mm:
+ (copyList): Now a static function rather than a member of the now-defunct
+ private class.
+ (KWQListImpl::KWQListImpl): Set up all the new members that used to be in
+ the separate private object.
+ (KWQListImpl::~KWQListImpl): Update the iterator-detaching code to do it
+ the new way, with intrusive list. Also, use clear() instead of having our
+ own code to delete the list -- note this is only used after the level above
+ us does a clear() anyway.
+ (KWQListImpl::clear): Use a loop to delete all the nodes rather than making
+ a delete of one node recursively delete the next -- iteration is more efficient,
+ and also easier to understand in this case. Also update all the iterators so
+ they don't point to deleted nodes.
+ (KWQListImpl::containsRef): Update to return the count, rather than just a
+ true or false value, since that's how the class is defined.
+ (KWQListImpl::assign): Delete the items if asked to (fixes a FIXME). Also
+ use a new swap member function since there's more to swap now.
+ (KWQListImpl::addIterator): Rewrite to use an intrusive linked list.
+ (KWQListImpl::removeIterator): Rewrite to use an intrusive linked list; this
+ makes it much faster since it doesn't have to search the list.
+ (KWQListImpl::swap): Implement this private member function used by assign.
+ (KWQListIteratorImpl::KWQListIteratorImpl): Set up the new members that
+ used to be in the separate private object.
+
+ * kwq/qt/qlist.h: Re-add the operator= definition. This would cause a storage
+ leak, although I haven't actually observed the leak.
+
+ * kwq/qt/qbuffer.h: Initialize opened to false. This was causing a test failure.
+
+ * kwq/KWQDictImpl.h:
+ * kwq/KWQDictImpl.mm: Streamline implementation a bit by getting rid of
+ unneeded copy constructor definition and making trivial constructor for
+ iterator inline.
+
+ * kwq/KWQPtrDictImpl.h: Remove unneeded include.
+
+ * WebCore-tests.exp: Update for changes in the entry points
+ used by the tests.
+
2002-06-05 Richard Williamson <rjw at apple.com>
Fixed 2938552. This required an implementation of KHTMLPart::frames which
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 7737bcf..e547db7 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,55 @@
+2002-06-05 Darin Adler <darin at apple.com>
+
+ Some fixes to speed up the citibank.com page, and other related changes.
+
+ * khtml/ecma/kjs_dom.cpp: (DOMNode::getValueProperty): Only do a layout
+ if it's actually needed. This speeds things up immensely, and I'm pretty
+ sure it's correct.
+
+ * kwq/KWQListImpl.h: To speed things up, get rid of the "private part"
+ level of indirection. This is particularly vital for list iterators, which
+ are created and destroyed a lot on the stack. Also made trivial functions
+ be inline.
+
+ * kwq/KWQListImpl.mm:
+ (copyList): Now a static function rather than a member of the now-defunct
+ private class.
+ (KWQListImpl::KWQListImpl): Set up all the new members that used to be in
+ the separate private object.
+ (KWQListImpl::~KWQListImpl): Update the iterator-detaching code to do it
+ the new way, with intrusive list. Also, use clear() instead of having our
+ own code to delete the list -- note this is only used after the level above
+ us does a clear() anyway.
+ (KWQListImpl::clear): Use a loop to delete all the nodes rather than making
+ a delete of one node recursively delete the next -- iteration is more efficient,
+ and also easier to understand in this case. Also update all the iterators so
+ they don't point to deleted nodes.
+ (KWQListImpl::containsRef): Update to return the count, rather than just a
+ true or false value, since that's how the class is defined.
+ (KWQListImpl::assign): Delete the items if asked to (fixes a FIXME). Also
+ use a new swap member function since there's more to swap now.
+ (KWQListImpl::addIterator): Rewrite to use an intrusive linked list.
+ (KWQListImpl::removeIterator): Rewrite to use an intrusive linked list; this
+ makes it much faster since it doesn't have to search the list.
+ (KWQListImpl::swap): Implement this private member function used by assign.
+ (KWQListIteratorImpl::KWQListIteratorImpl): Set up the new members that
+ used to be in the separate private object.
+
+ * kwq/qt/qlist.h: Re-add the operator= definition. This would cause a storage
+ leak, although I haven't actually observed the leak.
+
+ * kwq/qt/qbuffer.h: Initialize opened to false. This was causing a test failure.
+
+ * kwq/KWQDictImpl.h:
+ * kwq/KWQDictImpl.mm: Streamline implementation a bit by getting rid of
+ unneeded copy constructor definition and making trivial constructor for
+ iterator inline.
+
+ * kwq/KWQPtrDictImpl.h: Remove unneeded include.
+
+ * WebCore-tests.exp: Update for changes in the entry points
+ used by the tests.
+
2002-06-05 Richard Williamson <rjw at apple.com>
Fixed 2938552. This required an implementation of KHTMLPart::frames which
diff --git a/WebCore/WebCore-tests.exp b/WebCore/WebCore-tests.exp
index 56bdfdc..c626b57 100644
--- a/WebCore/WebCore-tests.exp
+++ b/WebCore/WebCore-tests.exp
@@ -9,7 +9,6 @@ __ZN10KWQMapImplC2ERKS_
__ZN10KWQMapImplD2Ev
__ZN11KWQDictImpl6insertERK7QStringPKv
__ZN11KWQDictImpl6removeERK7QStringb
-__ZN11KWQDictImplC1ERKS_
__ZN11KWQDictImplC1EibPFvPvE
__ZN11KWQListImpl10removeLastEb
__ZN11KWQListImpl11removeFirstEb
@@ -59,6 +58,7 @@ __ZN14KWQPtrDictImpl6assignERKS_b
__ZN14KWQPtrDictImpl6insertEPvPKv
__ZN14KWQPtrDictImpl6removeEPvb
__ZN14KWQPtrDictImplC1ERKS_
+__ZN14KWQPtrDictImplC2ERKS_
__ZN14KWQPtrDictImplC1EiPFvPvEPK24CFDictionaryKeyCallBacks
__ZN14KWQPtrDictImplD1Ev
__ZN14KWQPtrDictImplD2Ev
@@ -78,7 +78,6 @@ __ZN16KWQValueListImplD1Ev
__ZN16KWQValueListImplaSERKS_
__ZN18KWQMapIteratorImpl17incrementInternalEv
__ZN18KWQMapIteratorImplC2Ev
-__ZN19KWQDictIteratorImplC1ERK11KWQDictImpl
__ZN19KWQListIteratorImpl6toLastEv
__ZN19KWQListIteratorImpl7toFirstEv
__ZN19KWQListIteratorImplC1ERK11KWQListImpl
@@ -90,6 +89,7 @@ __ZN20KWQValueListNodeImplC2Ev
__ZN20KWQValueListNodeImplD2Ev
__ZN22KWQPtrDictIteratorImpl7toFirstEv
__ZN22KWQPtrDictIteratorImplC1ERK14KWQPtrDictImpl
+__ZN22KWQPtrDictIteratorImplC2ERK14KWQPtrDictImpl
__ZN22KWQPtrDictIteratorImplD1Ev
__ZN22KWQPtrDictIteratorImplD2Ev
__ZN22KWQPtrDictIteratorImplppEv
@@ -178,10 +178,8 @@ __ZNK10KWQMapImpl13beginInternalEv
__ZNK10KWQMapImpl13countInternalEv
__ZNK11KWQDictImpl4findERK7QString
__ZNK11KWQListImpl11containsRefEPKv
-__ZNK11KWQListImpl5countEv
__ZNK11KWQListImpl7currentEv
__ZNK11KWQListImpl7getLastEv
-__ZNK11KWQListImpl7isEmptyEv
__ZNK11QStringList4joinERK7QString
__ZNK12KWQArrayImpl2atEm
__ZNK12KWQArrayImpl4dataEv
diff --git a/WebCore/khtml/ecma/kjs_dom.cpp b/WebCore/khtml/ecma/kjs_dom.cpp
index b0522a0..ea6a03b 100644
--- a/WebCore/khtml/ecma/kjs_dom.cpp
+++ b/WebCore/khtml/ecma/kjs_dom.cpp
@@ -238,6 +238,10 @@ Value DOMNode::getValueProperty(ExecState *exec, int token) const
if ( docimpl )
{
docimpl->updateRendering();
+#ifdef APPLE_CHANGES
+ // Only do a layout if changes have occurred that make it necessary.
+ if ( docimpl->renderer() && !docimpl->renderer()->layouted() )
+#endif
if ( docimpl->view() )
docimpl->view()->layout();
}
diff --git a/WebCore/kwq/KWQBuffer.h b/WebCore/kwq/KWQBuffer.h
index e361aa6..f506012 100644
--- a/WebCore/kwq/KWQBuffer.h
+++ b/WebCore/kwq/KWQBuffer.h
@@ -34,7 +34,7 @@
class QBuffer {
public:
- QBuffer() : pos(0) { }
+ QBuffer() : opened(false), pos(0) { }
QByteArray buffer() const { return ba; }
uint size() const { return ba.size(); }
diff --git a/WebCore/kwq/KWQDictImpl.h b/WebCore/kwq/KWQDictImpl.h
index dff4b2f..ce307da 100644
--- a/WebCore/kwq/KWQDictImpl.h
+++ b/WebCore/kwq/KWQDictImpl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2001, 2002 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,35 +26,23 @@
#ifndef KWQ_DICT_IMPL_H
#define KWQ_DICT_IMPL_H
-#include <config.h>
-#include <KWQDef.h>
-#include <qstring.h>
-
-#ifndef USING_BORROWED_QDICT
-
#include <KWQPtrDictImpl.h>
+#include <qstring.h>
class KWQDictImpl : public KWQPtrDictImpl {
public:
KWQDictImpl(int size, bool caseSensitive, void (*deleteFunc)(void *));
- KWQDictImpl(const KWQDictImpl &di);
- // ~KWQDictImpl();
void insert(const QString &key, const void *value);
bool remove(const QString &key, bool deleteItems);
void *find(const QString &key) const;
};
-
class KWQDictIteratorImpl : public KWQPtrDictIteratorImpl {
public:
- KWQDictIteratorImpl(const KWQDictImpl &di);
- // ~KWQDictIteratorImpl();
+ KWQDictIteratorImpl(const KWQDictImpl &di) : KWQPtrDictIteratorImpl(di) { }
QString currentStringKey() const;
};
-
-#endif
-
#endif
diff --git a/WebCore/kwq/KWQDictImpl.mm b/WebCore/kwq/KWQDictImpl.mm
index c16cf33..4046805 100644
--- a/WebCore/kwq/KWQDictImpl.mm
+++ b/WebCore/kwq/KWQDictImpl.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2001, 2002 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,22 +26,14 @@
#include <KWQDictImpl.h>
#include <CoreFoundation/CoreFoundation.h>
-#ifndef USING_BORROWED_QDICT
-
KWQDictImpl::KWQDictImpl(int size, bool caseSensitive, void (*deleteFunc)(void *)) :
KWQPtrDictImpl(size, deleteFunc, &kCFCopyStringDictionaryKeyCallBacks)
{
}
-KWQDictImpl::KWQDictImpl(const KWQDictImpl &di) :
- KWQPtrDictImpl(di)
-{
-}
-
void KWQDictImpl::insert(const QString &key, const void *value)
{
KWQPtrDictImpl::insert(key.getCFMutableString(), value);
-
}
bool KWQDictImpl::remove(const QString &key, bool deleteItem)
@@ -54,11 +46,6 @@ void *KWQDictImpl::find(const QString &key) const
return KWQPtrDictImpl::find(key.getCFMutableString());
}
-KWQDictIteratorImpl::KWQDictIteratorImpl(const KWQDictImpl &di) :
- KWQPtrDictIteratorImpl(di)
-{
-}
-
QString KWQDictIteratorImpl::currentStringKey() const
{
void *key = currentKey();
@@ -68,5 +55,3 @@ QString KWQDictIteratorImpl::currentStringKey() const
}
return QString::fromCFString((CFStringRef)key);
}
-
-#endif
diff --git a/WebCore/kwq/KWQListImpl.h b/WebCore/kwq/KWQListImpl.h
index 4f9e403..7a12dbc 100644
--- a/WebCore/kwq/KWQListImpl.h
+++ b/WebCore/kwq/KWQListImpl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2001, 2002 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,6 +31,7 @@
#ifndef USING_BORROWED_QLIST
+class KWQListNode;
class KWQListIteratorImpl;
class KWQListImpl
@@ -41,8 +42,8 @@ public:
KWQListImpl(const KWQListImpl &impl);
~KWQListImpl();
- bool isEmpty() const;
- uint count() const;
+ bool isEmpty() const { return nodeCount == 0; }
+ uint count() const { return nodeCount; }
void clear(bool deleteItems);
void sort(int (*compareFunc)(void *a, void *b, void *data), void *data);
@@ -74,11 +75,19 @@ public:
KWQListImpl &assign(const KWQListImpl &impl, bool deleteItems);
private:
+ KWQListImpl &operator =(const KWQListImpl &impl);
+
+ void swap(KWQListImpl &impl);
+
void addIterator(KWQListIteratorImpl *iter) const;
void removeIterator(KWQListIteratorImpl *iter) const;
- class KWQListPrivate;
- KWQListPrivate *d;
+ KWQListNode *head;
+ KWQListNode *tail;
+ KWQListNode *cur;
+ uint nodeCount;
+ void (*deleteItem)(void *);
+ mutable KWQListIteratorImpl *iterators;
friend class KWQListIteratorImpl;
};
@@ -88,25 +97,24 @@ class KWQListIteratorImpl {
public:
KWQListIteratorImpl();
KWQListIteratorImpl(const KWQListImpl &impl);
- KWQListIteratorImpl(const KWQListIteratorImpl &impl);
~KWQListIteratorImpl();
+ KWQListIteratorImpl(const KWQListIteratorImpl &impl);
+ KWQListIteratorImpl &operator=(const KWQListIteratorImpl &impl);
+
uint count() const;
void *toFirst();
void *toLast();
void *current() const;
- // operators ---------------------------------------------------------------
-
void *operator--();
void *operator++();
- KWQListIteratorImpl &operator=(const KWQListIteratorImpl &impl);
-
private:
- class KWQListIteratorPrivate;
-
- KWQListIteratorPrivate *d;
+ const KWQListImpl *list;
+ KWQListNode *node;
+ KWQListIteratorImpl *next;
+ KWQListIteratorImpl *prev;
friend class KWQListImpl;
};
diff --git a/WebCore/kwq/KWQListImpl.mm b/WebCore/kwq/KWQListImpl.mm
index 78f48fa..0c68a10 100644
--- a/WebCore/kwq/KWQListImpl.mm
+++ b/WebCore/kwq/KWQListImpl.mm
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2001, 2002 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,54 +26,29 @@
#include <KWQListImpl.h>
#include <cstddef>
+#include <algorithm>
#include <CoreFoundation/CFArray.h>
-
-// KWQListNode
+#include <kwqdebug.h>
class KWQListNode
{
public:
- KWQListNode() : data(NULL), next(NULL), prev(NULL) {}
- ~KWQListNode();
+ KWQListNode(void *d) : data(d), next(NULL), prev(NULL) { }
void *data;
KWQListNode *next;
KWQListNode *prev;
};
-KWQListNode::~KWQListNode()
-{
- delete next;
-}
-
-// KWQListImpl::KWQListPrivate
-
-class KWQListImpl::KWQListPrivate
-{
-public:
- KWQListPrivate(void (*deleteFunc)(void *));
- KWQListPrivate(KWQListPrivate &vp);
- ~KWQListPrivate();
-
- static KWQListNode * copyList(KWQListNode *, KWQListNode *&tail);
-
- KWQListNode *head;
- KWQListNode *tail;
- KWQListNode *current;
- uint count;
- void (*deleteItem)(void *);
- KWQListNode *iterators;
-};
-KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l, KWQListNode *&tail)
+static KWQListNode *copyList(KWQListNode *l, KWQListNode *&tail)
{
KWQListNode *node = l;
KWQListNode *copyHead = NULL;
KWQListNode *last = NULL;
while (node != NULL) {
- KWQListNode *copy = new KWQListNode;
- copy->data = node->data;
+ KWQListNode *copy = new KWQListNode(node->data);
if (last != NULL) {
last->next = copy;
} else {
@@ -90,118 +65,70 @@ KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l, KWQListNode *
return copyHead;
}
-KWQListImpl::KWQListPrivate::KWQListPrivate(void (*deleteFunc)(void *)) :
+
+KWQListImpl::KWQListImpl(void (*deleteFunc)(void *)) :
head(NULL),
tail(NULL),
- current(NULL),
- count(0),
+ cur(NULL),
+ nodeCount(0),
deleteItem(deleteFunc),
iterators(NULL)
{
}
-KWQListImpl::KWQListPrivate::KWQListPrivate(KWQListPrivate &vp) :
- current(NULL),
- count(vp.count),
- deleteItem(vp.deleteItem),
- iterators(NULL)
-{
- head = copyList(vp.head, tail);
-}
-
-KWQListImpl::KWQListPrivate::~KWQListPrivate()
-{
- delete head;
- delete iterators;
-}
-
-
-// KWQListIteratorImpl::KWQListIteratorPrivate
-
-class KWQListIteratorImpl::KWQListIteratorPrivate
-{
-public:
- KWQListIteratorPrivate();
- KWQListIteratorPrivate(const KWQListImpl *list, KWQListNode *n);
-
- const KWQListImpl *list;
- KWQListNode *node;
-};
-
-KWQListIteratorImpl::KWQListIteratorPrivate::KWQListIteratorPrivate() :
- list(NULL),
- node(NULL)
-{
-}
-
-KWQListIteratorImpl::KWQListIteratorPrivate::KWQListIteratorPrivate(const KWQListImpl *l, KWQListNode *n) :
- list(l),
- node(n)
-{
-}
-
-
-
-// KWQListImpl
-
-KWQListImpl::KWQListImpl(void (*deleteFunc)(void *)) :
- d(new KWQListImpl::KWQListPrivate(deleteFunc))
-{
-}
-
KWQListImpl::KWQListImpl(const KWQListImpl &impl) :
- d(new KWQListImpl::KWQListPrivate(*impl.d))
+ cur(NULL),
+ nodeCount(impl.nodeCount),
+ deleteItem(impl.deleteItem),
+ iterators(NULL)
{
+ head = copyList(impl.head, tail);
}
KWQListImpl::~KWQListImpl()
{
- for (KWQListNode *node = d->iterators; node != NULL; node = node->next) {
- KWQListIteratorImpl::KWQListIteratorPrivate *p = ((KWQListIteratorImpl *)node->data)->d;
- p->list = NULL;
- p->node = NULL;
+ clear(false);
+
+ KWQListIteratorImpl *next;
+ for (KWQListIteratorImpl *it = iterators; it != NULL; it = next) {
+ next = it->next;
+ it->list = NULL;
+ it->next = NULL;
+ it->prev = NULL;
}
- delete d;
}
-bool KWQListImpl::isEmpty() const
-{
- return d->count == 0;
-}
-
-uint KWQListImpl::count() const
-{
- return d->count;
-}
-
void KWQListImpl::clear(bool deleteItems)
{
- if (deleteItems) {
- KWQListNode *node = d->head;
-
- while (node != NULL) {
- d->deleteItem(node->data);
- node = node->next;
- }
+ KWQListNode *next;
+
+ for (KWQListNode *node = head; node != NULL; node = next) {
+ next = node->next;
+ if (deleteItems) {
+ deleteItem(node->data);
+ }
+ delete node;
}
- delete d->head;
- d->head = NULL;
- d->tail = NULL;
- d->current = NULL;
- d->count = 0;
+ head = NULL;
+ tail = NULL;
+ cur = NULL;
+ nodeCount = 0;
+
+ for (KWQListIteratorImpl *it = iterators; it != NULL; it = it->next) {
+ it->node = NULL;
+ }
}
void KWQListImpl::sort(int (*compareFunc)(void *a, void *b, void *data), void *data)
{
// no sorting for 0 or 1-element lists
- if (d->count <= 1) {
+ if (nodeCount <= 1) {
return;
}
// special case for 2-element lists
- KWQListNode *head = d->head;
- if (d->count == 2) {
+ if (nodeCount == 2) {
void *a = head->data;
void *b = head->next->data;
if (compareFunc(a, b, data) <= 0) {
@@ -214,7 +141,7 @@ void KWQListImpl::sort(int (*compareFunc)(void *a, void *b, void *data), void *d
// insertion sort for most common sizes
const uint cutoff = 32;
- if (d->count <= cutoff) {
+ if (nodeCount <= cutoff) {
// Straight out of Sedgewick's Algorithms in C++.
// put all the elements into an array
@@ -225,7 +152,7 @@ void KWQListImpl::sort(int (*compareFunc)(void *a, void *b, void *data), void *d
}
// move the smallest element to the start to serve as a sentinel
- for (i = d->count - 1; i > 0; i--) {
+ for (i = nodeCount - 1; i > 0; i--) {
if (compareFunc(a[i-1], a[i], data) > 0) {
void *t = a[i-1];
a[i-1] = a[i];
@@ -234,7 +161,7 @@ void KWQListImpl::sort(int (*compareFunc)(void *a, void *b, void *data), void *d
}
// move other items to the right and put a[i] into position
- for (i = 2; i < d->count; i++) {
+ for (i = 2; i < nodeCount; i++) {
void *v = a[i];
uint j = i;
while (compareFunc(v, a[j-1], data) < 0) {
@@ -254,13 +181,13 @@ void KWQListImpl::sort(int (*compareFunc)(void *a, void *b, void *data), void *d
// CFArray sort for larger lists
- CFMutableArrayRef array = CFArrayCreateMutable(NULL, d->count, NULL);
+ CFMutableArrayRef array = CFArrayCreateMutable(NULL, nodeCount, NULL);
for (KWQListNode *node = head; node != NULL; node = node->next) {
CFArrayAppendValue(array, node->data);
}
- CFArraySortValues(array, CFRangeMake(0, d->count), (CFComparatorFunction) compareFunc, data);
+ CFArraySortValues(array, CFRangeMake(0, nodeCount), (CFComparatorFunction) compareFunc, data);
int i = 0;
for (KWQListNode *node = head; node != NULL; node = node->next) {
@@ -273,51 +200,50 @@ void KWQListImpl::sort(int (*compareFunc)(void *a, void *b, void *data), void *d
void *KWQListImpl::at(uint n)
{
KWQListNode *node;
- if (n >= d->count - 1) {
- node = d->tail;
+ if (n >= nodeCount - 1) {
+ node = tail;
} else {
- node = d->head;
+ node = head;
for (uint i = 0; i < n && node != NULL; i++) {
node = node->next;
}
}
- d->current = node;
+ cur = node;
return node->data;
}
bool KWQListImpl::insert(uint n, const void *item)
{
- if (n > d->count) {
+ if (n > nodeCount) {
return false;
}
- KWQListNode *node = new KWQListNode;
- node->data = (void *)item;
+ KWQListNode *node = new KWQListNode((void *)item);
if (n == 0) {
// inserting at head
- node->next = d->head;
- if (d->head != NULL) {
- d->head->prev = node;
+ node->next = head;
+ if (head != NULL) {
+ head->prev = node;
}
- d->head = node;
- if (d->tail == NULL) {
- d->tail = node;
+ head = node;
+ if (tail == NULL) {
+ tail = node;
}
- } else if (n == d->count) {
+ } else if (n == nodeCount) {
// inserting at tail
- node->prev = d->tail;
- if (d->tail != NULL) {
- d->tail->next = node;
+ node->prev = tail;
+ if (tail != NULL) {
+ tail->next = node;
}
- d->tail = node;
+ tail = node;
} else {
// general insertion
// iterate to one node before the insertion point, can't be null
- // since we know n > 0 and n < d->count
- KWQListNode *prevNode = d->head;
+ // since we know n > 0 and n < nodeCount
+ KWQListNode *prevNode = head;
for (uint i = 0; i < n - 1; i++) {
prevNode = prevNode->next;
@@ -330,56 +256,55 @@ bool KWQListImpl::insert(uint n, const void *item)
prevNode->next = node;
}
- d->count++;
- d->current = node;
+ nodeCount++;
+ cur = node;
return true;
}
-bool KWQListImpl::remove(bool deleteItem)
+bool KWQListImpl::remove(bool shouldDeleteItem)
{
- KWQListNode *node = d->current;
+ KWQListNode *node = cur;
if (node == NULL) {
return false;
}
if (node->prev == NULL) {
- d->head = node->next;
+ head = node->next;
} else {
node->prev->next = node->next;
}
if (node->next == NULL) {
- d->tail = node->prev;
+ tail = node->prev;
} else {
node->next->prev = node->prev;
}
if (node->next != NULL) {
- d->current = node->next;
+ cur = node->next;
} else {
- d->current = node->prev;
- }
-
- if (deleteItem) {
- d->deleteItem(node->data);
+ cur = node->prev;
}
- for (KWQListNode *iterator = d->iterators; iterator != NULL; iterator = iterator->next) {
- if (((KWQListIteratorImpl *)iterator->data)->d->node == node) {
- ((KWQListIteratorImpl *)iterator->data)->d->node = d->current;
+ for (KWQListIteratorImpl *it = iterators; it != NULL; it = it->next) {
+ if (it->node == node) {
+ it->node = cur;
}
}
- node->next = NULL;
+ if (shouldDeleteItem) {
+ deleteItem(node->data);
+ }
delete node;
- d->count--;
+
+ nodeCount--;
return true;
}
bool KWQListImpl::remove(uint n, bool deleteItem)
{
- if (n >= d->count) {
+ if (n >= nodeCount) {
return false;
}
@@ -394,14 +319,14 @@ bool KWQListImpl::removeFirst(bool deleteItem)
bool KWQListImpl::removeLast(bool deleteItem)
{
- return remove(d->count - 1, deleteItem);
+ return remove(nodeCount - 1, deleteItem);
}
bool KWQListImpl::remove(const void *item, bool deleteItem, int (*compareFunc)(void *a, void *b, void *data), void *data)
{
KWQListNode *node;
- node = d->head;
+ node = head;
while (node != NULL && compareFunc((void *)item, node->data, data) != 0) {
node = node->next;
@@ -411,7 +336,7 @@ bool KWQListImpl::remove(const void *item, bool deleteItem, int (*compareFunc)(v
return false;
}
- d->current = node;
+ cur = node;
return remove(deleteItem);
}
@@ -420,7 +345,7 @@ bool KWQListImpl::removeRef(const void *item, bool deleteItem)
{
KWQListNode *node;
- node = d->head;
+ node = head;
while (node != NULL && item != node->data) {
node = node->next;
@@ -430,25 +355,25 @@ bool KWQListImpl::removeRef(const void *item, bool deleteItem)
return false;
}
- d->current = node;
+ cur = node;
return remove(deleteItem);
}
void *KWQListImpl::getFirst() const
{
- return d->head ? d->head->data : 0;
+ return head ? head->data : 0;
}
void *KWQListImpl::getLast() const
{
- return d->tail ? d->tail->data : 0;
+ return tail ? tail->data : 0;
}
void *KWQListImpl::current() const
{
- if (d->current != NULL) {
- return d->current->data;
+ if (cur != NULL) {
+ return cur->data;
} else {
return NULL;
}
@@ -456,28 +381,28 @@ void *KWQListImpl::current() const
void *KWQListImpl::first()
{
- d->current = d->head;
+ cur = head;
return current();
}
void *KWQListImpl::last()
{
- d->current = d->tail;
+ cur = tail;
return current();
}
void *KWQListImpl::next()
{
- if (d->current != NULL) {
- d->current = d->current->next;
+ if (cur != NULL) {
+ cur = cur->next;
}
return current();
}
void *KWQListImpl::prev()
{
- if (d->current != NULL) {
- d->current = d->current->prev;
+ if (cur != NULL) {
+ cur = cur->prev;
}
return current();
}
@@ -498,7 +423,7 @@ void *KWQListImpl::take()
void KWQListImpl::append(const void *item)
{
- insert(d->count, item);
+ insert(nodeCount, item);
}
void KWQListImpl::prepend(const void *item)
@@ -508,151 +433,141 @@ void KWQListImpl::prepend(const void *item)
uint KWQListImpl::containsRef(const void *item) const
{
- KWQListNode *node = d->head;
-
- while (node != NULL && item != node->data) {
- node = node->next;
+ uint count = 0;
+
+ for (KWQListNode *node = head; node != NULL; node = node->next) {
+ if (item == node->data) {
+ ++count;
+ }
}
- return node != NULL;
+ return count;
}
KWQListImpl &KWQListImpl::assign(const KWQListImpl &impl, bool deleteItems)
{
- // FIXME: this doesn't respect the deleteItems flag
-
- KWQListImpl tmp(impl);
- KWQListImpl::KWQListPrivate *tmpD = tmp.d;
-
- tmp.d = d;
- d = tmpD;
-
+ clear(deleteItems);
+ KWQListImpl(impl).swap(*this);
return *this;
}
void KWQListImpl::addIterator(KWQListIteratorImpl *iter) const
{
- KWQListNode *node = new KWQListNode;
- node->data = iter;
- node->next = d->iterators;
- if (node->next != NULL) {
- node->next->prev = node;
+ iter->next = iterators;
+ iter->prev = NULL;
+
+ if (iterators != NULL) {
+ iterators->prev = iter;
}
- d->iterators = node;
+ iterators = iter;
}
void KWQListImpl::removeIterator(KWQListIteratorImpl *iter) const
{
- KWQListNode *node = d->iterators;
-
- while (node != NULL && node->data != iter) {
- node = node->next;
+ if (iter->prev == NULL) {
+ iterators = iter->next;
+ } else {
+ iter->prev->next = iter->next;
}
- if (node != NULL) {
- if (node->prev == NULL) {
- d->iterators = node->next;
- } else {
- node->prev->next = node->next;
- }
-
- if (node->next != NULL) {
- node->next->prev = node->prev;
- }
-
- node->next = NULL;
- delete node;
+ if (iter->next != NULL) {
+ iter->next->prev = iter->prev;
}
}
+void KWQListImpl::swap(KWQListImpl &other)
+{
+ using std::swap;
+
+ KWQ_ASSERT(iterators == NULL);
+ KWQ_ASSERT(other.iterators == NULL);
+
+ swap(head, other.head);
+ swap(tail, other.tail);
+ swap(cur, other.cur);
+ swap(nodeCount, other.nodeCount);
+ swap(deleteItem, other.deleteItem);
+}
-// KWQListIteratorImpl
-
KWQListIteratorImpl::KWQListIteratorImpl() :
- d(new KWQListIteratorImpl::KWQListIteratorPrivate())
+ list(NULL),
+ node(NULL)
{
}
KWQListIteratorImpl::KWQListIteratorImpl(const KWQListImpl &impl) :
- d(new KWQListIteratorImpl::KWQListIteratorPrivate(&impl, impl.d->head))
+ list(&impl),
+ node(impl.head)
{
impl.addIterator(this);
}
KWQListIteratorImpl::~KWQListIteratorImpl()
{
- if (d->list != NULL) {
- d->list->removeIterator(this);
+ if (list != NULL) {
+ list->removeIterator(this);
}
- delete d;
}
KWQListIteratorImpl::KWQListIteratorImpl(const KWQListIteratorImpl &impl) :
- d(new KWQListIteratorImpl::KWQListIteratorPrivate(impl.d->list, impl.d->node))
+ list(impl.list),
+ node(impl.node)
{
- if (d->list != NULL) {
- d->list->addIterator(this);
+ if (list != NULL) {
+ list->addIterator(this);
}
}
uint KWQListIteratorImpl::count() const
{
- if (d->list == NULL) {
- return 0;
- } else {
- return d->list->count();
- }
+ return list == NULL ? 0 : list->count();
}
void *KWQListIteratorImpl::toFirst()
{
- d->node = d->list->d->head;
+ node = list->head;
return current();
}
void *KWQListIteratorImpl::toLast()
{
- d->node = d->list->d->tail;
+ node = list->tail;
return current();
}
void *KWQListIteratorImpl::current() const
{
- if (d->node == NULL) {
- return NULL;
- } else {
- return d->node->data;
- }
+ return node == NULL ? NULL : node->data;
}
void *KWQListIteratorImpl::operator--()
{
- if (d->node != NULL) {
- d->node = d->node->prev;
+ if (node != NULL) {
+ node = node->prev;
}
return current();
}
void *KWQListIteratorImpl::operator++()
{
- if (d->node != NULL) {
- d->node = d->node->next;
+ if (node != NULL) {
+ node = node->next;
}
return current();
}
KWQListIteratorImpl &KWQListIteratorImpl::operator=(const KWQListIteratorImpl &impl)
{
- if (d->list != NULL) {
- d->list->removeIterator(this);
+ if (list != NULL) {
+ list->removeIterator(this);
}
- d->list = impl.d->list;
- d->node = impl.d->node;
+ list = impl.list;
+ node = impl.node;
- if (d->list != NULL) {
- d->list->addIterator(this);
+ if (list != NULL) {
+ list->addIterator(this);
}
return *this;
diff --git a/WebCore/kwq/KWQPtrDictImpl.h b/WebCore/kwq/KWQPtrDictImpl.h
index f2094fb..57d3131 100644
--- a/WebCore/kwq/KWQPtrDictImpl.h
+++ b/WebCore/kwq/KWQPtrDictImpl.h
@@ -30,10 +30,10 @@
#include <stddef.h>
-#include <CoreFoundation/CFDictionary.h>
-
-class KWQPtrDictPrivate;
+struct CFDictionaryKeyCallBacks;
+class KWQPtrDictPrivate;
+
class KWQPtrDictImpl
{
public:
diff --git a/WebCore/kwq/KWQPtrList.h b/WebCore/kwq/KWQPtrList.h
index 33b9369..6a22a92 100644
--- a/WebCore/kwq/KWQPtrList.h
+++ b/WebCore/kwq/KWQPtrList.h
@@ -38,8 +38,10 @@ template <class T> class QPtrListIterator;
template <class T> class QPtrList : public QPtrCollection {
public:
- QPtrList() : impl(deleteFunc) {}
- ~QPtrList() { if (del_item) { impl.clear(del_item); } }
+ QPtrList() : impl(deleteFunc) { }
+ ~QPtrList() { impl.clear(del_item); }
+
+ QPtrList& operator=(const QPtrList &l) { impl.assign(l.impl, del_item); return *this; }
bool isEmpty() const { return impl.isEmpty(); }
uint count() const { return impl.count(); }
@@ -49,8 +51,8 @@ public:
T *at(uint n) { return (T *)impl.at(n); }
bool insert(uint n, const T *item) { return impl.insert(n, item); }
- bool remove() {return impl.remove(del_item); }
- bool remove(uint n) {return impl.remove(n, del_item); }
+ bool remove() { return impl.remove(del_item); }
+ bool remove(uint n) { return impl.remove(n, del_item); }
bool remove(const T *item) { return impl.remove(item, del_item, compareFunc, this); }
bool removeFirst() { return impl.removeFirst(del_item); }
bool removeLast() { return impl.removeLast(del_item); }
@@ -75,12 +77,7 @@ public:
private:
static void deleteFunc(void *item) { delete (T *)item; }
-
- static int compareFunc(void *a, void *b, void *data)
- {
- QPtrList<T> *l = (QPtrList<T> *)data;
- return l->compareItems(a, b);
- }
+ static int compareFunc(void *a, void *b, void *data) { return ((QPtrList *)data)->compareItems(a, b); }
friend class QPtrListIterator<T>;
@@ -97,11 +94,9 @@ public:
T *toLast() { return (T *)impl.toLast(); }
T *current() const { return (T *)impl.current(); }
- // operators ---------------------------------------------------------------
-
operator T *() const { return (T *)impl.current(); }
- T *operator--() { return (T *)(--impl); }
- T *operator++() { return (T *)(++impl); }
+ T *operator--() { return (T *)--impl; }
+ T *operator++() { return (T *)++impl; }
private:
KWQListIteratorImpl impl;
@@ -125,7 +120,7 @@ inline std::ostream &operator<<(std::ostream &stream, const QPtrList<T> &l)
}
// print rest
- while(count != 0) {
+ while (count != 0) {
stream << ", " << *iter.current();
++iter;
--count;
diff --git a/WebCore/kwq/qt/qbuffer.h b/WebCore/kwq/qt/qbuffer.h
index e361aa6..f506012 100644
--- a/WebCore/kwq/qt/qbuffer.h
+++ b/WebCore/kwq/qt/qbuffer.h
@@ -34,7 +34,7 @@
class QBuffer {
public:
- QBuffer() : pos(0) { }
+ QBuffer() : opened(false), pos(0) { }
QByteArray buffer() const { return ba; }
uint size() const { return ba.size(); }
diff --git a/WebCore/kwq/qt/qlist.h b/WebCore/kwq/qt/qlist.h
index 33b9369..6a22a92 100644
--- a/WebCore/kwq/qt/qlist.h
+++ b/WebCore/kwq/qt/qlist.h
@@ -38,8 +38,10 @@ template <class T> class QPtrListIterator;
template <class T> class QPtrList : public QPtrCollection {
public:
- QPtrList() : impl(deleteFunc) {}
- ~QPtrList() { if (del_item) { impl.clear(del_item); } }
+ QPtrList() : impl(deleteFunc) { }
+ ~QPtrList() { impl.clear(del_item); }
+
+ QPtrList& operator=(const QPtrList &l) { impl.assign(l.impl, del_item); return *this; }
bool isEmpty() const { return impl.isEmpty(); }
uint count() const { return impl.count(); }
@@ -49,8 +51,8 @@ public:
T *at(uint n) { return (T *)impl.at(n); }
bool insert(uint n, const T *item) { return impl.insert(n, item); }
- bool remove() {return impl.remove(del_item); }
- bool remove(uint n) {return impl.remove(n, del_item); }
+ bool remove() { return impl.remove(del_item); }
+ bool remove(uint n) { return impl.remove(n, del_item); }
bool remove(const T *item) { return impl.remove(item, del_item, compareFunc, this); }
bool removeFirst() { return impl.removeFirst(del_item); }
bool removeLast() { return impl.removeLast(del_item); }
@@ -75,12 +77,7 @@ public:
private:
static void deleteFunc(void *item) { delete (T *)item; }
-
- static int compareFunc(void *a, void *b, void *data)
- {
- QPtrList<T> *l = (QPtrList<T> *)data;
- return l->compareItems(a, b);
- }
+ static int compareFunc(void *a, void *b, void *data) { return ((QPtrList *)data)->compareItems(a, b); }
friend class QPtrListIterator<T>;
@@ -97,11 +94,9 @@ public:
T *toLast() { return (T *)impl.toLast(); }
T *current() const { return (T *)impl.current(); }
- // operators ---------------------------------------------------------------
-
operator T *() const { return (T *)impl.current(); }
- T *operator--() { return (T *)(--impl); }
- T *operator++() { return (T *)(++impl); }
+ T *operator--() { return (T *)--impl; }
+ T *operator++() { return (T *)++impl; }
private:
KWQListIteratorImpl impl;
@@ -125,7 +120,7 @@ inline std::ostream &operator<<(std::ostream &stream, const QPtrList<T> &l)
}
// print rest
- while(count != 0) {
+ while (count != 0) {
stream << ", " << *iter.current();
++iter;
--count;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list