Changeset 49802 in webkit for trunk/JavaScriptCore/API
- Timestamp:
- Oct 19, 2009, 12:59:32 PM (16 years ago)
- Location:
- trunk/JavaScriptCore/API
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/APICast.h
r46598 r49802 28 28 29 29 #include "JSAPIValueWrapper.h" 30 #include "JSGlobalObject.h" 30 31 #include "JSValue.h" 31 32 #include <wtf/Platform.h> … … 119 120 inline JSGlobalContextRef toGlobalRef(JSC::ExecState* e) 120 121 { 122 ASSERT(e == e->lexicalGlobalObject()->globalExec()); 121 123 return reinterpret_cast<JSGlobalContextRef>(e); 122 124 } -
trunk/JavaScriptCore/API/JSContextRef.cpp
r46431 r49802 26 26 #include "config.h" 27 27 #include "JSContextRef.h" 28 #include "JSContextRefPrivate.h" 28 29 29 30 #include "APICast.h" … … 153 154 return toRef(&exec->globalData()); 154 155 } 156 157 JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx) 158 { 159 ExecState* exec = toJS(ctx); 160 exec->globalData().heap.registerThread(); 161 JSLock lock(exec); 162 163 return toGlobalRef(exec->lexicalGlobalObject()->globalExec()); 164 } -
trunk/JavaScriptCore/API/tests/testapi.c
r46598 r49802 26 26 #include "JavaScriptCore.h" 27 27 #include "JSBasePrivate.h" 28 #include "JSContextRefPrivate.h" 28 29 #include <math.h> 29 30 #define ASSERT_DISABLED 0 … … 42 43 #endif 43 44 44 static JSGlobalContextRef context = 0;45 static int failed = 0;45 static JSGlobalContextRef context; 46 static int failed; 46 47 static void assertEqualsAsBoolean(JSValueRef value, bool expectedValue) 47 48 { … … 619 620 } 620 621 621 static JSValueRef print_callAsFunction(JSContextRef c ontext, JSObjectRef functionObject, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)622 static JSValueRef print_callAsFunction(JSContextRef ctx, JSObjectRef functionObject, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 622 623 { 623 624 UNUSED_PARAM(functionObject); 624 625 UNUSED_PARAM(thisObject); 625 626 UNUSED_PARAM(exception); 627 628 ASSERT(JSContextGetGlobalContext(ctx) == context); 626 629 627 630 if (argumentCount > 0) { 628 JSStringRef string = JSValueToStringCopy(c ontext, arguments[0], NULL);631 JSStringRef string = JSValueToStringCopy(ctx, arguments[0], NULL); 629 632 size_t sizeUTF8 = JSStringGetMaximumUTF8CStringSize(string); 630 633 char* stringUTF8 = (char*)malloc(sizeUTF8); … … 635 638 } 636 639 637 return JSValueMakeUndefined(c ontext);640 return JSValueMakeUndefined(ctx); 638 641 } 639 642 … … 761 764 JSGlobalContextRetain(context); 762 765 JSGlobalContextRelease(context); 766 ASSERT(JSContextGetGlobalContext(context) == context); 763 767 764 768 JSReportExtraMemoryCost(context, 0);
Note:
See TracChangeset
for help on using the changeset viewer.