Ignore:
Timestamp:
Jun 5, 2018, 10:25:00 AM (7 years ago)
Author:
Darin Adler
Message:

[Cocoa] Update some JavaScriptCore code to be more ready for ARC
https://bugs.webkit.org/show_bug.cgi?id=186301

Reviewed by Anders Carlsson.

  • API/JSContext.mm:

(-[JSContext evaluateScript:withSourceURL:]): Use bridge for typecast.
(-[JSContext setName:]): Removed unnecessary call to copy, since the
JSStringCreateWithCFString function already reads the characters out
of the string and does not retain the string, so there is no need to
make an immutable copy. And used
bridge for typecast.

  • inspector/remote/cocoa/RemoteInspectorCocoa.mm:

(Inspector::RemoteInspector::receivedProxyApplicationSetupMessage):
Ditto.

  • inspector/remote/cocoa/RemoteInspectorXPCConnection.mm:

(Inspector::RemoteInspectorXPCConnection::deserializeMessage):
Use CFBridgingRelease instead of autorelease for a CF dictionary that
we return as an NSDictionary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSContext.mm

    r232452 r232513  
    101101{
    102102    JSValueRef exceptionValue = nullptr;
    103     JSStringRef scriptJS = JSStringCreateWithCFString((CFStringRef)script);
    104     JSStringRef sourceURLJS = sourceURL ? JSStringCreateWithCFString((CFStringRef)[sourceURL absoluteString]) : nullptr;
     103    JSStringRef scriptJS = JSStringCreateWithCFString((__bridge CFStringRef)script);
     104    JSStringRef sourceURLJS = sourceURL ? JSStringCreateWithCFString((__bridge CFStringRef)[sourceURL absoluteString]) : nullptr;
    105105    JSValueRef result = JSEvaluateScript(m_context, scriptJS, nullptr, sourceURLJS, 0, &exceptionValue);
    106106    if (sourceURLJS)
     
    203203- (void)setName:(NSString *)name
    204204{
    205     JSStringRef nameJS = name ? JSStringCreateWithCFString((CFStringRef)[[name copy] autorelease]) : nullptr;
     205    JSStringRef nameJS = name ? JSStringCreateWithCFString((__bridge CFStringRef)name) : nullptr;
    206206    JSGlobalContextSetName(m_context, nameJS);
    207207    if (nameJS)
Note: See TracChangeset for help on using the changeset viewer.