summaryrefslogtreecommitdiffstats
path: root/JavaScriptGlue/JSValueWrapper.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2009-08-11 17:01:47 +0100
committerBen Murdoch <benm@google.com>2009-08-11 18:21:02 +0100
commit0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch)
tree2943df35f62d885c89d01063cc528dd73b480fea /JavaScriptGlue/JSValueWrapper.cpp
parent7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff)
downloadexternal_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2
Merge in WebKit r47029.
Diffstat (limited to 'JavaScriptGlue/JSValueWrapper.cpp')
-rw-r--r--JavaScriptGlue/JSValueWrapper.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/JavaScriptGlue/JSValueWrapper.cpp b/JavaScriptGlue/JSValueWrapper.cpp
index 2f1ac09..d649d4a 100644
--- a/JavaScriptGlue/JSValueWrapper.cpp
+++ b/JavaScriptGlue/JSValueWrapper.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2009 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
@@ -32,7 +32,7 @@
#include <JavaScriptCore/PropertyNameArray.h>
#include <pthread.h>
-JSValueWrapper::JSValueWrapper(JSValuePtr inValue)
+JSValueWrapper::JSValueWrapper(JSValue inValue)
: fValue(inValue)
{
}
@@ -41,7 +41,7 @@ JSValueWrapper::~JSValueWrapper()
{
}
-JSValuePtr JSValueWrapper::GetValue()
+JSValue JSValueWrapper::GetValue()
{
return fValue.get();
}
@@ -66,7 +66,7 @@ void JSValueWrapper::JSObjectDispose(void *data)
CFArrayRef JSValueWrapper::JSObjectCopyPropertyNames(void *data)
{
- JSLock lock(true);
+ JSLock lock(LockForReal);
CFMutableArrayRef result = 0;
JSValueWrapper* ptr = (JSValueWrapper*)data;
@@ -101,14 +101,14 @@ CFArrayRef JSValueWrapper::JSObjectCopyPropertyNames(void *data)
JSObjectRef JSValueWrapper::JSObjectCopyProperty(void *data, CFStringRef propertyName)
{
- JSLock lock(true);
+ JSLock lock(LockForReal);
JSObjectRef result = 0;
JSValueWrapper* ptr = (JSValueWrapper*)data;
if (ptr)
{
ExecState* exec = getThreadGlobalExecState();
- JSValuePtr propValue = ptr->GetValue().toObject(exec)->get(exec, CFStringToIdentifier(propertyName, exec));
+ JSValue propValue = ptr->GetValue().toObject(exec)->get(exec, CFStringToIdentifier(propertyName, exec));
JSValueWrapper* wrapperValue = new JSValueWrapper(propValue);
JSObjectCallBacks callBacks;
@@ -125,13 +125,13 @@ JSObjectRef JSValueWrapper::JSObjectCopyProperty(void *data, CFStringRef propert
void JSValueWrapper::JSObjectSetProperty(void *data, CFStringRef propertyName, JSObjectRef jsValue)
{
- JSLock lock(true);
+ JSLock lock(LockForReal);
JSValueWrapper* ptr = (JSValueWrapper*)data;
if (ptr)
{
ExecState* exec = getThreadGlobalExecState();
- JSValuePtr value = JSObjectKJSValue((JSUserObject*)jsValue);
+ JSValue value = JSObjectKJSValue((JSUserObject*)jsValue);
JSObject *objValue = ptr->GetValue().toObject(exec);
PutPropertySlot slot;
objValue->put(exec, CFStringToIdentifier(propertyName, exec), value, slot);
@@ -140,7 +140,7 @@ void JSValueWrapper::JSObjectSetProperty(void *data, CFStringRef propertyName, J
JSObjectRef JSValueWrapper::JSObjectCallFunction(void *data, JSObjectRef thisObj, CFArrayRef args)
{
- JSLock lock(true);
+ JSLock lock(LockForReal);
JSObjectRef result = 0;
JSValueWrapper* ptr = (JSValueWrapper*)data;
@@ -148,16 +148,16 @@ JSObjectRef JSValueWrapper::JSObjectCallFunction(void *data, JSObjectRef thisObj
{
ExecState* exec = getThreadGlobalExecState();
- JSValuePtr value = JSObjectKJSValue((JSUserObject*)thisObj);
+ JSValue value = JSObjectKJSValue((JSUserObject*)thisObj);
JSObject* ksjThisObj = value.toObject(exec);
JSObject* objValue = ptr->GetValue().toObject(exec);
- ArgList listArgs;
+ MarkedArgumentBuffer listArgs;
CFIndex argCount = args ? CFArrayGetCount(args) : 0;
for (CFIndex i = 0; i < argCount; i++)
{
JSObjectRef jsArg = (JSObjectRef)CFArrayGetValueAtIndex(args, i);
- JSValuePtr kgsArg = JSObjectKJSValue((JSUserObject*)jsArg);
+ JSValue kgsArg = JSObjectKJSValue((JSUserObject*)jsArg);
listArgs.append(kgsArg);
}
@@ -165,7 +165,7 @@ JSObjectRef JSValueWrapper::JSObjectCallFunction(void *data, JSObjectRef thisObj
CallType callType = objValue->getCallData(callData);
if (callType == CallTypeNone)
return 0;
- JSValuePtr resultValue = call(exec, objValue, callType, callData, ksjThisObj, listArgs);
+ JSValue resultValue = call(exec, objValue, callType, callData, ksjThisObj, listArgs);
JSValueWrapper* wrapperValue = new JSValueWrapper(resultValue);
JSObjectCallBacks callBacks;
GetJSObectCallBacks(callBacks);
@@ -180,7 +180,7 @@ JSObjectRef JSValueWrapper::JSObjectCallFunction(void *data, JSObjectRef thisObj
CFTypeRef JSValueWrapper::JSObjectCopyCFValue(void *data)
{
- JSLock lock(true);
+ JSLock lock(LockForReal);
CFTypeRef result = 0;
JSValueWrapper* ptr = (JSValueWrapper*)data;
@@ -194,8 +194,11 @@ CFTypeRef JSValueWrapper::JSObjectCopyCFValue(void *data)
void JSValueWrapper::JSObjectMark(void *data)
{
JSValueWrapper* ptr = (JSValueWrapper*)data;
- if (ptr)
+ if (ptr && !ptr->fValue.get().marked())
{
- ptr->fValue.get().mark();
+ // This results in recursive marking but will be otherwise safe and correct.
+ MarkStack markStack;
+ markStack.append(ptr->fValue.get());
+ markStack.drain();
}
}