[Cocoa] Improve ARC compatibility of more code in JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=186973
Reviewed by Dan Bernstein.
Source/JavaScriptCore:
(WeakContextRef::WeakContextRef): Deleted.
(WeakContextRef::~WeakContextRef): Deleted.
(WeakContextRef::get): Deleted.
(WeakContextRef::set): Deleted.
- API/JSContextInternal.h: Removed unneeded header guards since this is
an Objective-C++ header. Removed unused WeakContextRef class. Removed declaration
of method -[JSContext initWithGlobalContextRef:] and JSContext property wrapperMap
since neither is used outside the class implementation.
(-[JSManagedValue initWithValue:]): Use a bridging cast.
(-[JSManagedValue dealloc]): Ditto.
(-[JSManagedValue didAddOwner:]): Ditto.
(-[JSManagedValue didRemoveOwner:]): Ditto.
(JSManagedValueHandleOwner::isReachableFromOpaqueRoots): Ditto.
(JSManagedValueHandleOwner::finalize): Ditto.
(+[JSValue valueWithNewRegularExpressionFromPattern:flags:inContext:]): Ditto.
(+[JSValue valueWithNewErrorFromMessage:inContext:]): Ditto.
(-[JSValue valueForProperty:]): Ditto.
(-[JSValue setValue:forProperty:]): Ditto.
(-[JSValue deleteProperty:]): Ditto.
(-[JSValue hasProperty:]): Ditto.
(-[JSValue invokeMethod:withArguments:]): Ditto.
(valueToObjectWithoutCopy): Ditto. Also removed unneeded explicit type names.
(valueToArray): Ditto.
(valueToDictionary): Ditto.
(objectToValueWithoutCopy): Ditto.
(objectToValue): Ditto.
(+[JSVMWrapperCache addWrapper:forJSContextGroupRef:]): Ditto.
(+[JSVMWrapperCache wrapperForJSContextGroupRef:]): Ditto.
(-[JSVirtualMachine isOldExternalObject:]): Ditto.
(-[JSVirtualMachine addManagedReference:withOwner:]): Ditto.
(-[JSVirtualMachine removeManagedReference:withOwner:]): Ditto.
(-[JSVirtualMachine contextForGlobalContextRef:]): Ditto.
(-[JSVirtualMachine addContext:forGlobalContextRef:]): Ditto.
(scanExternalObjectGraph): Ditto.
(scanExternalRememberedSet): Ditto.
(makeWrapper): Ditto.
(-[JSObjCClassInfo wrapperForObject:inContext:]): Ditto.
(-[JSWrapperMap objcWrapperForJSValueRef:inContext:]): Ditto.
(tryUnwrapObjcObject): Ditto.
- API/ObjCCallbackFunction.mm:
(blockSignatureContainsClass): Ditto.
(objCCallbackFunctionForMethod): Switched from retain to CFRetain, but not
sure we will be keeping this the same way under ARC.
(objCCallbackFunctionForBlock): Use a bridging cast.
(protocolImplementsProtocol): Use a more specific type that includes the
explicit unsafe_unretained for copied protocol lists.
(forEachProtocolImplementingProtocol): Ditto.
- inspector/remote/cocoa/RemoteInspectorCocoa.mm:
(Inspector::convertNSNullToNil): Added to replace the CONVERT_NSNULL_TO_NIL macro.
(Inspector::RemoteInspector::receivedSetupMessage): Use convertNSNullToNil.
- inspector/remote/cocoa/RemoteInspectorXPCConnection.mm: Moved the
CFXPCBridge SPI to a header named CFXPCBridgeSPI.h.
(auditTokenHasEntitlement): Deleted. Moved to Entitlements.h/cpp in WTF.
(Inspector::RemoteInspectorXPCConnection::handleEvent): Use WTF::hasEntitlement.
(Inspector::RemoteInspectorXPCConnection::sendMessage): Use a bridging cast.
Source/WebKit:
- Shared/EntryPointUtilities/mac/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::hasEntitlement): Use WTF::hasEntitlement.
- Shared/mac/SandboxUtilities.h: Removed connectedProcessHasEntitlement since
we can now use WTF::hasEntitlement instead.
- Shared/mac/SandboxUtilities.mm: Ditto.
- StorageProcess/ios/StorageProcessIOS.mm:
(WebKit::StorageProcess::parentProcessHasServiceWorkerEntitlement): Use
WTF::hasEntitlement.
- WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::parentProcessHasServiceWorkerEntitlement): Ditto.
Source/WTF:
- WTF.xcodeproj/project.pbxproj: Added CFXPCBridgeSPI.h, fixed a few
other small problems in the project file, and let Xcode fix a few too.
- wtf/cocoa/Entitlements.h: Added hasEntitlement function with overloads
for an audit token and an XPC connection.
- wtf/cocoa/Entitlements.mm:
(WTF::hasEntitlement): Added, with overloads for a SecTask, an audit token,
and an XPC connection.
(WTF::processHasEntitlement): Refactored to use the function above.
- wtf/spi/cocoa/CFXPCBridgeSPI.h: Added.