[webkit-changes] cvs commit: WebCore/khtml/misc
main_thread_malloc.cpp main_thread_malloc.h
Darin
darin at opensource.apple.com
Tue Aug 16 18:07:26 PDT 2005
darin 05/08/16 18:07:26
Modified: . ChangeLog WebCore-tests.exp
khtml/misc main_thread_malloc.cpp main_thread_malloc.h
Log:
Reviewed by Geoff.
- changed main_thread_malloc so we don't have two conflicting versions of the same function
This fixes a crash I was seeing running the WebKit tests.
* khtml/misc/main_thread_malloc.h: Took out all the ifdefs from this header.
* khtml/misc/main_thread_malloc.cpp: Added non-NDEBUG versions of the functions that just call
the system malloc, and put the NDEBUG versions in an #else.
* WebCore-tests.exp: Export the new stuff so the tests still work.
Revision Changes Path
1.4590 +13 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4589
retrieving revision 1.4590
diff -u -r1.4589 -r1.4590
--- ChangeLog 16 Aug 2005 23:57:02 -0000 1.4589
+++ ChangeLog 17 Aug 2005 01:07:21 -0000 1.4590
@@ -1,3 +1,16 @@
+2005-08-16 Darin Adler <darin at apple.com>
+
+ Reviewed by Geoff.
+
+ - changed main_thread_malloc so we don't have two conflicting versions of the same function
+ This fixes a crash I was seeing running the WebKit tests.
+
+ * khtml/misc/main_thread_malloc.h: Took out all the ifdefs from this header.
+ * khtml/misc/main_thread_malloc.cpp: Added non-NDEBUG versions of the functions that just call
+ the system malloc, and put the NDEBUG versions in an #else.
+
+ * WebCore-tests.exp: Export the new stuff so the tests still work.
+
2005-08-15 Maciej Stachowiak <mjs at apple.com>
Reviewed by John.
1.36 +2 -0 WebCore/WebCore-tests.exp
Index: WebCore-tests.exp
===================================================================
RCS file: /cvs/root/WebCore/WebCore-tests.exp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- WebCore-tests.exp 15 Aug 2005 04:30:59 -0000 1.35
+++ WebCore-tests.exp 17 Aug 2005 01:07:23 -0000 1.36
@@ -118,6 +118,8 @@
__ZN5QSizeC1Ev
__ZN5QTime7restartEv
__ZN5QTimeC1Eii
+__ZN5khtml16main_thread_freeEPv
+__ZN5khtml18main_thread_mallocEm
__ZN6QPointC1Eii
__ZN6QPointC1Ev
__ZN7QBuffer10writeBlockEPKcj
1.2 +31 -1 WebCore/khtml/misc/main_thread_malloc.cpp
Index: main_thread_malloc.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/misc/main_thread_malloc.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- main_thread_malloc.cpp 26 Apr 2005 18:46:04 -0000 1.1
+++ main_thread_malloc.cpp 17 Aug 2005 01:07:25 -0000 1.2
@@ -224,8 +224,36 @@
probably don't want to touch unless you are extending or adapting malloc.
*/
+#include "main_thread_malloc.h"
+
namespace khtml {
+#ifndef NDEBUG
+
+// In debugging builds, use the system malloc for its debugging features.
+
+void *main_thread_malloc(size_t n)
+{
+ return malloc(n);
+}
+
+void *main_thread_calloc(size_t n_elements, size_t element_size)
+{
+ return calloc(n_elements, element_size);
+}
+
+void main_thread_free(void* p)
+{
+ free(p);
+}
+
+void *main_thread_realloc(void* p, size_t n)
+{
+ return realloc(p, n);
+}
+
+#else
+
/*
WIN32 sets up defaults for MS environment and compilers.
Otherwise defaults are for unix.
@@ -5413,7 +5441,9 @@
#endif /* WIN32 */
-}; /* end of namespace KJS */
+#endif
+
+} /* end of namespace KJS */
/* ------------------------------------------------------------
History:
1.4 +4 -22 WebCore/khtml/misc/main_thread_malloc.h
Index: main_thread_malloc.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/misc/main_thread_malloc.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- main_thread_malloc.h 15 Aug 2005 04:58:51 -0000 1.3
+++ main_thread_malloc.h 17 Aug 2005 01:07:26 -0000 1.4
@@ -20,32 +20,16 @@
*
*/
-#ifndef KHTMLMAINTTHREADMALLOC_H
-#define KHTMLMAINTTHREADMALLOC_H
+#ifndef KHTML_MAIN_THREAD_MALLOC_H
+#define KHTML_MAIN_THREAD_MALLOC_H
// This is a copy of dlmalloc, a fast single-threaded malloc implementation.
-// JavaScriptCore is multi-threaded, but certain actions can only take place under
-// the global collector lock. Therefore, these functions should only be used
-// while holding the collector lock (this is true whenenever the interpreter is
-// executing or GC is taking place).
+// Therefore, these functions should only be used on the main thread.
-#ifndef NDEBUG
#include <stdlib.h>
-#endif
namespace khtml {
-#ifndef NDEBUG
-
-inline void *main_thread_malloc(size_t n) { return malloc(n); }
-inline void *main_thread_calloc(size_t n_elements, size_t element_size) { return calloc(n_elements, element_size); }
-inline void main_thread_free(void* p) { free(p); }
-inline void *main_thread_realloc(void* p, size_t n) { return realloc(p, n); }
-
-#define MAIN_THREAD_ALLOCATED
-
-#else
-
void *main_thread_malloc(size_t n);
void *main_thread_calloc(size_t n_elements, size_t element_size);
void main_thread_free(void* p);
@@ -55,8 +39,6 @@
void* operator new(size_t s) { return khtml::main_thread_malloc(s); } \
void operator delete(void* p) { khtml::main_thread_free(p); }
-#endif
-
}
-#endif /* KHTMLMAINTTHREADMALLOC_H */
+#endif /* KHTML_MAIN_THREAD_MALLOC_H */
More information about the webkit-changes
mailing list