2008-07-11 Stephanie Lewis <slewis@apple.com>
Reviewed by Darin Adler and Oliver Hunt.
JavaScriptCore:
Refactor RefCounting Leak counting code into a common class.
In order to export the symbols I needed to put the debug defines inside the function names
Before we had a separate channel for each Logging each Leak type. Since the leak channels were only used in one location, and only at quit for simplicity I combined them all into one leak channel.
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj: add new class
* kjs/nodes.cpp: remove old leak counting code
* wtf/RefCountedLeakCounter.cpp: Added. create a common leak counting class
* wtf/RefCountedLeakCounter.h: Added.
WebCore:
No Functionality Changed. Change all the leak counting code to use the new WTF leak counter class.
* bindings/js/JSCustomSQLTransactionCallback.cpp:
(WebCore::JSCustomSQLTransactionCallback::JSCustomSQLTransactionCallback):
(WebCore::JSCustomSQLTransactionCallback::~JSCustomSQLTransactionCallback):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::JSEventListener):
(WebCore::JSEventListener::~JSEventListener):
* dom/Node.cpp:
(WebCore::Node::Node):
(WebCore::Node::~Node):
* dom/Range.cpp:
(WebCore::Range::Range):
(WebCore::Range::~Range):
* history/CachedPage.cpp:
(WebCore::CachedPage::CachedPage):
(WebCore::CachedPage::~CachedPage):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::SubresourceLoader):
(WebCore::SubresourceLoader::~SubresourceLoader):
* page/Frame.cpp:
(WebCore::Frame::Frame):
(WebCore::Frame::~Frame):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::~Page):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::RenderObject):
(WebCore::RenderObject::~RenderObject):
* rendering/bidi.cpp:
(WebCore::throw):
(WebCore::BidiRun::operator delete):
WebKit
Move WebPreferences.m to objc++ so it can include the new WTF leak counting class.
* WebKit.xcodeproj/project.pbxproj:
Disable WTF leak messages when using fast teardown. Use full document teardown while running in debug.
* WebView/WebPreferences.m: Removed.
* WebView/WebPreferences.mm: Copied from http:/svn.webkit.org/repository/webkit/trunk/WebKit/mac/WebView/WebPreferences.m.
(+[WebPreferences initialize]): if running in Default enable full document teardown
(-[WebPreferences editableLinkBehavior]):
(-[WebPreferences setFullDocumentTeardownEnabled:]):
* WebView/WebView.mm:
(-[WebView _close]): disable leak messages if using fast teardown
WebKitTools:
Make sure we read WebCore Leak messages. Force full document teardown for DumpRenderTree.
Up timeout limit, some slower machines were timing out before crashtracer finished writing out to disk and quitting DRT.
* DumpRenderTree/mac/DumpRenderTree.mm:
(setDefaultsToConsistentValuesForTesting):
(resetWebViewToConsistentStateBeforeTesting):
* Scripts/run-webkit-tests:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@35148 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index 5776a00..00b4bea 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -34,6 +34,7 @@
#include "RenderView.h"
#include "break_lines.h"
#include <wtf/AlwaysInline.h>
+#include <wtf/RefCountedLeakCounter.h>
#include <wtf/Vector.h>
using namespace std;
@@ -108,18 +109,7 @@
}
#ifndef NDEBUG
-WTFLogChannel LogWebCoreBidiRunLeaks = { 0x00000000, "", WTFLogChannelOn };
-
-struct BidiRunCounter {
- static int count;
- ~BidiRunCounter()
- {
- if (count)
- LOG(WebCoreBidiRunLeaks, "LEAK: %d BidiRun\n", count);
- }
-};
-int BidiRunCounter::count = 0;
-static BidiRunCounter bidiRunCounter;
+static WTF::RefCountedLeakCounter bidiRunCounter("BidiRun");
static bool inBidiRunDestroy;
#endif
@@ -142,7 +132,7 @@
void* BidiRun::operator new(size_t sz, RenderArena* renderArena) throw()
{
#ifndef NDEBUG
- ++BidiRunCounter::count;
+ bidiRunCounter.increment();
#endif
return renderArena->allocate(sz);
}
@@ -150,7 +140,7 @@
void BidiRun::operator delete(void* ptr, size_t sz)
{
#ifndef NDEBUG
- --BidiRunCounter::count;
+ bidiRunCounter.decrement();
#endif
ASSERT(inBidiRunDestroy);