diff options
Diffstat (limited to 'WebKitTools/DumpRenderTree/GCController.cpp')
-rw-r--r-- | WebKitTools/DumpRenderTree/GCController.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/WebKitTools/DumpRenderTree/GCController.cpp b/WebKitTools/DumpRenderTree/GCController.cpp index fe84a58..06a04fb 100644 --- a/WebKitTools/DumpRenderTree/GCController.cpp +++ b/WebKitTools/DumpRenderTree/GCController.cpp @@ -74,28 +74,15 @@ static JSValueRef getJSObjectCountCallback(JSContextRef context, JSObjectRef fun void GCController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception) { JSRetainPtr<JSStringRef> gcControllerStr(Adopt, JSStringCreateWithUTF8CString("GCController")); - JSValueRef gcControllerObject = JSObjectMake(context, getJSClass(), this); - JSObjectSetProperty(context, windowObject, gcControllerStr.get(), gcControllerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception); -} - -JSClassRef GCController::getJSClass() -{ - static JSClassRef gcControllerClass = 0; - if (!gcControllerClass) { - JSStaticFunction* staticFunctions = GCController::staticFunctions(); - JSClassDefinition classDefinition = { - 0, kJSClassAttributeNone, "GCController", 0, 0, staticFunctions, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; + JSClassRef classRef = getJSClass(); + JSValueRef gcControllerObject = JSObjectMake(context, classRef, this); + JSClassRelease(classRef); - gcControllerClass = JSClassCreate(&classDefinition); - } - - return gcControllerClass; + JSObjectSetProperty(context, windowObject, gcControllerStr.get(), gcControllerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception); } -JSStaticFunction* GCController::staticFunctions() +JSClassRef GCController::getJSClass() { static JSStaticFunction staticFunctions[] = { { "collect", collectCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -104,5 +91,10 @@ JSStaticFunction* GCController::staticFunctions() { 0, 0, 0 } }; - return staticFunctions; + static JSClassDefinition classDefinition = { + 0, kJSClassAttributeNone, "GCController", 0, 0, staticFunctions, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + + return JSClassCreate(&classDefinition); } |