summaryrefslogtreecommitdiffstats
path: root/JavaScriptGlue/JSUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'JavaScriptGlue/JSUtils.cpp')
-rw-r--r--JavaScriptGlue/JSUtils.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/JavaScriptGlue/JSUtils.cpp b/JavaScriptGlue/JSUtils.cpp
index 67dba86..581999c 100644
--- a/JavaScriptGlue/JSUtils.cpp
+++ b/JavaScriptGlue/JSUtils.cpp
@@ -36,6 +36,7 @@
#include "UserObjectImp.h"
#include <JavaScriptCore/JSString.h>
#include <JavaScriptCore/PropertyNameArray.h>
+#include <JavaScriptCore/WTFThreadData.h>
struct ObjectImpList {
JSObject* imp;
@@ -73,7 +74,7 @@ UString CFStringToUString(CFStringRef inCFString)
// Caller is responsible for releasing the returned CFStringRef
CFStringRef UStringToCFString(const UString& inUString)
{
- return CFStringCreateWithCharacters(0, (const UniChar*)inUString.data(), inUString.size());
+ return CFStringCreateWithCharacters(0, (const UniChar*)inUString.characters(), inUString.length());
}
@@ -163,7 +164,7 @@ JSValue JSObjectKJSValue(JSUserObject* ptr)
{
double num;
CFNumberGetValue((CFNumberRef)cfType, kCFNumberDoubleType, &num);
- result = jsNumber(getThreadGlobalExecState(), num);
+ result = jsNumber(num);
handled = true;
}
else if (typeID == CFBooleanGetTypeID())
@@ -283,8 +284,8 @@ CFTypeRef KJSValueToCFTypeInternal(JSValue inValue, ExecState *exec, ObjectImpLi
{
Identifier propName = *iter;
UString ustr = propName.ustring();
- const UniChar* uniChars = (const UniChar*)ustr.data();
- int size = ustr.size();
+ const UniChar* uniChars = (const UniChar*)ustr.characters();
+ int size = ustr.length();
while (size--) {
if (uniChars[size] < '0' || uniChars[size] > '9') {
isArray = false;
@@ -403,12 +404,17 @@ static void initializeGlobalObjectKey()
pthread_key_create(&globalObjectKey, unprotectGlobalObject);
}
+JSGlobalData* getThreadGlobalData()
+{
+ return &JSGlobalData::sharedInstance();
+}
+
static JSGlueGlobalObject* getThreadGlobalObject()
{
pthread_once(&globalObjectKeyOnce, initializeGlobalObjectKey);
JSGlueGlobalObject* globalObject = static_cast<JSGlueGlobalObject*>(pthread_getspecific(globalObjectKey));
if (!globalObject) {
- globalObject = new (&JSGlobalData::sharedInstance()) JSGlueGlobalObject(JSGlueGlobalObject::createStructure(jsNull()));
+ globalObject = new (getThreadGlobalData()) JSGlueGlobalObject(JSGlueGlobalObject::createStructure(jsNull()));
gcProtect(globalObject);
pthread_setspecific(globalObjectKey, globalObject);
}
@@ -427,23 +433,23 @@ ExecState* getThreadGlobalExecState()
JSGlueAPIEntry::JSGlueAPIEntry()
: m_lock(LockForReal)
- , m_storedIdentifierTable(currentIdentifierTable())
+ , m_storedIdentifierTable(wtfThreadData().currentIdentifierTable())
{
- setCurrentIdentifierTable(getThreadGlobalObject()->globalExec()->globalData().identifierTable);
+ wtfThreadData().setCurrentIdentifierTable(getThreadGlobalData()->identifierTable);
}
JSGlueAPIEntry::~JSGlueAPIEntry()
{
- setCurrentIdentifierTable(m_storedIdentifierTable);
+ wtfThreadData().setCurrentIdentifierTable(m_storedIdentifierTable);
}
JSGlueAPICallback::JSGlueAPICallback(ExecState* exec)
: m_dropLocks(exec)
{
- resetCurrentIdentifierTable();
+ wtfThreadData().resetCurrentIdentifierTable();
}
JSGlueAPICallback::~JSGlueAPICallback()
{
- setCurrentIdentifierTable(getThreadGlobalObject()->globalExec()->globalData().identifierTable);
+ wtfThreadData().setCurrentIdentifierTable(getThreadGlobalData()->identifierTable);
}