Changeset 19059 in webkit
- Timestamp:
- Jan 23, 2007, 2:23:09 PM (19 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSClassRef.cpp
r17649 r19059 38 38 OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* protoClass) 39 39 : refCount(0) 40 // FIXME: <rdar://problem/4949018> 40 41 , className(definition->className) 41 42 , parentClass(definition->parentClass) … … 59 60 staticValues = new StaticValuesTable(); 60 61 while (staticValue->name) { 62 // FIXME: <rdar://problem/4949018> 61 63 staticValues->add(Identifier(staticValue->name).ustring().rep(), 62 64 new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes)); … … 68 70 staticFunctions = new StaticFunctionsTable(); 69 71 while (staticFunction->name) { 72 // FIXME: <rdar://problem/4949018> 70 73 staticFunctions->add(Identifier(staticFunction->name).ustring().rep(), 71 74 new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes)); -
trunk/JavaScriptCore/API/JSContextRef.cpp
r16371 r19059 42 42 JSObject* globalObject; 43 43 if (globalObjectClass) 44 // FIXME: We need to pass a real ExecState here to support an initialize callback in globalObjectClass 45 globalObject = new JSCallbackObject(0, globalObjectClass, 0, 0); 44 globalObject = new JSCallbackObject(0, globalObjectClass, 0, 0); // FIXME: <rdar://problem/4949002> 46 45 else 47 46 globalObject = new JSObject(); -
trunk/JavaScriptCore/API/JSObjectRef.h
r18888 r19059 286 286 */ 287 287 typedef struct { 288 const char* const name; // FIXME: convert UTF8288 const char* const name; 289 289 JSObjectGetPropertyCallback getProperty; 290 290 JSObjectSetPropertyCallback setProperty; … … 300 300 */ 301 301 typedef struct { 302 const char* const name; // FIXME: convert UTF8302 const char* const name; 303 303 JSObjectCallAsFunctionCallback callAsFunction; 304 304 JSPropertyAttributes attributes; -
trunk/JavaScriptCore/API/JSStringRef.cpp
r17372 r19059 47 47 { 48 48 JSLock lock; 49 // FIXME: Only works with ASCII 50 // Use decodeUTF8Sequence or http://www.unicode.org/Public/PROGRAMS/CVTUTF/ instead 49 // FIXME: <rdar://problem/4949018> 51 50 return toRef(UString(string).rep()->ref()); 52 51 } … … 112 111 return result; 113 112 } 114 115 #if defined(__APPLE__)116 JSStringRef JSStringCreateWithCFString(CFStringRef string)117 {118 JSLock lock;119 CFIndex length = CFStringGetLength(string);120 121 // Optimized path for when CFString backing store is a UTF16 buffer122 if (const UniChar* buffer = CFStringGetCharactersPtr(string)) {123 UString::Rep* rep = UString(reinterpret_cast<const UChar*>(buffer), length).rep()->ref();124 return toRef(rep);125 }126 127 UniChar* buffer = static_cast<UniChar*>(fastMalloc(sizeof(UniChar) * length));128 CFStringGetCharacters(string, CFRangeMake(0, length), buffer);129 UString::Rep* rep = UString(reinterpret_cast<UChar*>(buffer), length, false).rep()->ref();130 return toRef(rep);131 }132 133 CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string)134 {135 UString::Rep* rep = toJS(string);136 return CFStringCreateWithCharacters(alloc, reinterpret_cast<const JSChar*>(rep->data()), rep->size());137 }138 139 #endif // __APPLE__ -
trunk/JavaScriptCore/API/JSStringRef.h
r15497 r19059 35 35 #ifdef __cplusplus 36 36 extern "C" { 37 #endif 38 39 #if defined(__APPLE__) 40 #include "JSStringRefCF.h" 37 41 #endif 38 42 … … 137 141 bool JSStringIsEqualToUTF8CString(JSStringRef a, const char* b); 138 142 139 #if defined(__APPLE__)140 #include <CoreFoundation/CoreFoundation.h>141 // CFString convenience methods142 /*!143 @function144 @abstract Creates a JavaScript string from a CFString.145 @discussion This function is optimized to take advantage of cases when146 CFStringGetCharactersPtr returns a valid pointer.147 @param string The CFString to copy into the new JSString.148 @result A JSString containing string. Ownership follows the Create Rule.149 */150 JSStringRef JSStringCreateWithCFString(CFStringRef string);151 /*!152 @function153 @abstract Creates a CFString from a JavaScript string.154 @param alloc The alloc parameter to pass to CFStringCreate.155 @param string The JSString to copy into the new CFString.156 @result A CFString containing string. Ownership follows the Create Rule.157 */158 CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string);159 #endif // __APPLE__160 161 143 #ifdef __cplusplus 162 144 } -
trunk/JavaScriptCore/ChangeLog
r18963 r19059 1 2007-01-23 Geoffrey Garen <[email protected]> 2 3 Reviewed by Maciej Stachowiak. 4 5 Fixed <rdar://problem/4885131> Move CFString function declarations from 6 JSStringRef.h to JSStringRefCF.h 7 8 Also removed remaining API FIXMEs and changed them into Radars. 9 10 * API/JSClassRef.cpp: 11 (OpaqueJSClass::OpaqueJSClass): Added Radar numbers for UTF8 conversion. 12 13 * API/JSContextRef.cpp: 14 (JSGlobalContextCreate): Replaced FIXME for NULL JSContextRef with Radar number. 15 16 * API/JSObjectRef.h: Removed FIXME, which is unprofessional in a public header. 17 18 * API/JSStringRef.cpp: Moved CF related implementations to JSStringRefCF.cpp. 19 (JSStringCreateWithUTF8CString): Replaced FIXME with Radar number. 20 * API/JSStringRef.h: Moved CF related declarations to JSStringRefCF.h. Added 21 #include of JSStringRefCF.h as a stopgap until clients start #including 22 it as needed by themselves. 23 24 * API/JSStringRefCF.cpp: Added. 25 (JSStringCreateWithCFString): 26 (JSStringCopyCFString): Replaced JSChar cast with UniChar cast, which is 27 more appropriate for a CF call. 28 * API/JSStringRefCF.h: Added. 29 * JavaScriptCore.xcodeproj/project.pbxproj: 30 1 31 2007-01-18 Sanjay Madhav <[email protected]> 2 32 -
trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r18498 r19059 54 54 1440FCE30A51E46B0005F061 /* JSClassRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440FCE10A51E46B0005F061 /* JSClassRef.h */; }; 55 55 1440FCE40A51E46B0005F061 /* JSClassRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440FCE20A51E46B0005F061 /* JSClassRef.cpp */; }; 56 146AAB2B0B66A84900E55F16 /* JSStringRefCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */; }; 57 146AAB380B66A94400E55F16 /* JSStringRefCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */; }; 56 58 14760864099C633800437128 /* JSImmediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14760863099C633800437128 /* JSImmediate.cpp */; }; 57 59 1482B6EB0A4300B300517CFC /* JSValueRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B6EA0A4300B300517CFC /* JSValueRef.h */; settings = {ATTRIBUTES = (Public, ); }; }; … … 437 439 1440FCE10A51E46B0005F061 /* JSClassRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSClassRef.h; sourceTree = "<group>"; }; 438 440 1440FCE20A51E46B0005F061 /* JSClassRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSClassRef.cpp; sourceTree = "<group>"; }; 441 146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSStringRefCF.h; sourceTree = "<group>"; }; 442 146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringRefCF.cpp; sourceTree = "<group>"; }; 439 443 14760863099C633800437128 /* JSImmediate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSImmediate.cpp; sourceTree = "<group>"; }; 440 444 1482B6EA0A4300B300517CFC /* JSValueRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSValueRef.h; sourceTree = "<group>"; }; … … 785 789 1482B74C0A43032800517CFC /* JSStringRef.cpp */, 786 790 1482B74B0A43032800517CFC /* JSStringRef.h */, 791 146AAB2A0B66A84900E55F16 /* JSStringRefCF.h */, 792 146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */, 787 793 14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */, 788 794 1482B6EA0A4300B300517CFC /* JSValueRef.h */, … … 1214 1220 D212022B0AD4310D00ED79B6 /* DateMath.h in Headers */, 1215 1221 E11D51760B2E798D0056C188 /* StringExtras.h in Headers */, 1222 146AAB2B0B66A84900E55F16 /* JSStringRefCF.h in Headers */, 1216 1223 ); 1217 1224 runOnlyForDeploymentPostprocessing = 0; … … 1511 1518 65C7A1730A8EAACB00FA37EA /* JSWrapperObject.cpp in Sources */, 1512 1519 D212022A0AD4310D00ED79B6 /* DateMath.cpp in Sources */, 1520 146AAB380B66A94400E55F16 /* JSStringRefCF.cpp in Sources */, 1513 1521 ); 1514 1522 runOnlyForDeploymentPostprocessing = 0;
Note:
See TracChangeset
for help on using the changeset viewer.