Objective-C JavaScriptCore API should publicly support bridging to C
Created attachment 200150 [details] patch
Comment on attachment 200150 [details] patch r=me
Committed r149401: <http://trac.webkit.org/changeset/149401>
Comment on attachment 200150 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=200150&action=review > Source/JavaScriptCore/API/JSContext.h:124 > +// Creates a JSContext, wrapping its C API counterpart. > ++ (JSContext *)contextWithJSGlobalContextRef:(JSGlobalContextRef)jsGlobalContextRef; > +// Returns the C API counterpart wrapped by a JSContext. > +- (JSGlobalContextRef)JSGlobalContextRef; I'm not sure I like these method names. globalContextRef and contextWithGlobalContextRef: are more ObjC-like. > Source/JavaScriptCore/API/JSContext.mm:52 > -- (JSGlobalContextRef)globalContextRef > +- (JSGlobalContextRef)JSGlobalContextRef Keep it like you had before! > Source/JavaScriptCore/API/JSContext.mm:100 > - return [JSValue valueWithValue:result inContext:self]; > + return [JSValue valueWithJSValueRef:result inContext:self]; No…!
Here are the four functions we're considering in context: @interface JSValue(JSValueRefSupport) + (JSValue *)valueWithJSValueRef:(JSValueRef)value inContext:(JSContext *)context; - (JSValueRef)JSValueRef; @end @interface JSContext(JSContextRefSupport) + (JSContext *)contextWithJSGlobalContextRef:(JSGlobalContextRef)jsGlobalContextRef; - (JSGlobalContextRef)JSGlobalContextRef; @end If we switched away from type names for functions, what would we name the up-conversion and down-conversion functions in JSValue?
Comment on attachment 200150 [details] patch Clearing flags.
We discussed this in IRC and decided to keep the names as-is, since bare words "value" and "context" alone would probably be too terse, to the point of conflicting with things like NSValue and CGContext.