Diff
Modified: trunk/Source/WTF/ChangeLog (239708 => 239709)
--- trunk/Source/WTF/ChangeLog 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WTF/ChangeLog 2019-01-08 00:03:09 UTC (rev 239709)
@@ -1,3 +1,30 @@
+2019-01-07 David Kilzer <[email protected]>
+
+ Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
+ <https://webkit.org/b/193056>
+
+ Reviewed by Alex Christensen.
+
+ * wtf/RetainPtr.h:
+ (WTF::RetainPtr<T>::HelperPtrType):
+ - Use C++ template metaprogramming to define a shared return
+ type for adoptNS() and retainPtr() that uses
+ RetainPtr<NSObject> instead of RetainPtr<NSObject *>. The
+ non-Objective-C typedef is used with retainPtr() for CFTypeRef
+ objects.
+ (WTF::adoptNS):
+ - Only make declarations available when compilng with
+ Objective-C. The inline implementation is only available for
+ Objective-C, so this makes the declarations consistent.
+ - Change return type to remove '*' from NS types using
+ RetainPtr<T>::HelperPtrType.
+ (WTF::retainPtr):
+ - Change return type to remove '*' from NS types using
+ RetainPtr<T>::HelperPtrType.
+
+ * wtf/SchedulePair.h:
+ - Remove '*' from RetainPtr<> type.
+
2019-01-07 Eric Carlson <[email protected]>
A MediaTime timescale must never be zero
Modified: trunk/Source/WTF/wtf/RetainPtr.h (239708 => 239709)
--- trunk/Source/WTF/wtf/RetainPtr.h 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WTF/wtf/RetainPtr.h 2019-01-08 00:03:09 UTC (rev 239709)
@@ -56,7 +56,9 @@
template<typename T> class RetainPtr;
template<typename T> RetainPtr<T> adoptCF(T CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
-template<typename T> RetainPtr<T> adoptNS(T NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
+#ifdef __OBJC__
+template<typename T> RetainPtr<typename RetainPtr<T>::HelperPtrType> adoptNS(T NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
+#endif
template<typename T> class RetainPtr {
public:
@@ -64,6 +66,12 @@
typedef ValueType* PtrType;
typedef CFTypeRef StorageType;
+#ifdef __OBJC__
+ typedef typename std::conditional<std::is_convertible<T, id>::value && !std::is_same<T, id>::value, typename std::remove_pointer<T>::type, T>::type HelperPtrType;
+#else
+ typedef T HelperPtrType;
+#endif
+
RetainPtr() : m_ptr(nullptr) { }
RetainPtr(PtrType ptr) : m_ptr(toStorageType(ptr)) { if (m_ptr) CFRetain(m_ptr); }
@@ -109,7 +117,9 @@
void swap(RetainPtr&);
template<typename U> friend RetainPtr<U> adoptCF(U CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
- template<typename U> friend RetainPtr<U> adoptNS(U NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
+#ifdef __OBJC__
+ template<typename U> friend RetainPtr<typename RetainPtr<U>::HelperPtrType> adoptNS(U NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
+#endif
private:
enum AdoptTag { Adopt };
@@ -152,7 +162,7 @@
};
// Helper function for creating a RetainPtr using template argument deduction.
-template<typename T> RetainPtr<T> retainPtr(T) WARN_UNUSED_RETURN;
+template<typename T> RetainPtr<typename RetainPtr<T>::HelperPtrType> retainPtr(T) WARN_UNUSED_RETURN;
template<typename T> inline RetainPtr<T>::~RetainPtr()
{
@@ -306,14 +316,14 @@
}
#ifdef __OBJC__
-template<typename T> inline RetainPtr<T> adoptNS(T NS_RELEASES_ARGUMENT ptr)
+template<typename T> inline RetainPtr<typename RetainPtr<T>::HelperPtrType> adoptNS(T NS_RELEASES_ARGUMENT ptr)
{
#if __has_feature(objc_arc)
return ptr;
#elif defined(OBJC_NO_GC)
- return RetainPtr<T>(ptr, RetainPtr<T>::Adopt);
+ return RetainPtr<typename RetainPtr<T>::HelperPtrType>(ptr, RetainPtr<typename RetainPtr<T>::HelperPtrType>::Adopt);
#else
- RetainPtr<T> result = ptr;
+ RetainPtr<typename RetainPtr<T>::HelperPtrType> result = ptr;
[ptr release];
return result;
#endif
@@ -320,7 +330,7 @@
}
#endif
-template<typename T> inline RetainPtr<T> retainPtr(T ptr)
+template<typename T> inline RetainPtr<typename RetainPtr<T>::HelperPtrType> retainPtr(T ptr)
{
return ptr;
}
@@ -373,10 +383,10 @@
using WTF::RetainPtr;
using WTF::adoptCF;
-using WTF::adoptNS;
using WTF::retainPtr;
#ifdef __OBJC__
+using WTF::adoptNS;
using WTF::dynamic_objc_cast;
#endif
Modified: trunk/Source/WTF/wtf/SchedulePair.h (239708 => 239709)
--- trunk/Source/WTF/wtf/SchedulePair.h 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WTF/wtf/SchedulePair.h 2019-01-08 00:03:09 UTC (rev 239709)
@@ -63,7 +63,7 @@
#if PLATFORM(COCOA)
WTF_EXPORT_PRIVATE SchedulePair(NSRunLoop*, CFStringRef);
- RetainPtr<NSRunLoop*> m_nsRunLoop;
+ RetainPtr<NSRunLoop> m_nsRunLoop;
#endif
RetainPtr<CFRunLoopRef> m_runLoop;
Modified: trunk/Source/WebCore/ChangeLog (239708 => 239709)
--- trunk/Source/WebCore/ChangeLog 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebCore/ChangeLog 2019-01-08 00:03:09 UTC (rev 239709)
@@ -1,3 +1,26 @@
+2019-01-07 David Kilzer <[email protected]>
+
+ Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
+ <https://webkit.org/b/193056>
+
+ Reviewed by Alex Christensen.
+
+ * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
+ (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:]):
+ (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:withDiscontinuity:]):
+ * platform/network/cf/AuthenticationChallenge.h:
+ - Remove '*' from RetainPtr<> type.
+
+ * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+ (WebCore::cookiesForURL):
+ - Once retainPtr() was changed to return RetainPtr<NSArray>
+ instead of RetainPtr<NSArray *> here, that forced the type of
+ `cookiesPtr` to change as well since
+ Optional<RetainPtr<NSArray>> is not assignable to
+ Optional<RetainPtr<NSArray *>> without further template
+ specialization, which didn't seem useful since
+ Optional<RetainPtr<>> variable types are rarely used.
+
2019-01-07 Devin Rousso <[email protected]>
Web Inspector: extend XHR breakpoints to work with fetch
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm (239708 => 239709)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -143,7 +143,7 @@
{
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser);
- RetainPtr<AVAsset*> protectedAsset = asset;
+ RetainPtr<AVAsset> protectedAsset = asset;
callOnMainThread([parent = _parent, protectedAsset = WTFMove(protectedAsset)] {
if (parent)
parent->didParseStreamDataAsAsset(protectedAsset.get());
@@ -155,7 +155,7 @@
UNUSED_PARAM(discontinuity);
ASSERT_UNUSED(streamDataParser, streamDataParser == _parser);
- RetainPtr<AVAsset*> protectedAsset = asset;
+ RetainPtr<AVAsset> protectedAsset = asset;
callOnMainThread([parent = _parent, protectedAsset = WTFMove(protectedAsset)] {
if (parent)
parent->didParseStreamDataAsAsset(protectedAsset.get());
Modified: trunk/Source/WebCore/platform/network/cf/AuthenticationChallenge.h (239708 => 239709)
--- trunk/Source/WebCore/platform/network/cf/AuthenticationChallenge.h 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebCore/platform/network/cf/AuthenticationChallenge.h 2019-01-08 00:03:09 UTC (rev 239709)
@@ -73,7 +73,7 @@
RetainPtr<CFURLAuthChallengeRef> m_cfChallenge;
#else
RetainPtr<id> m_sender;
- RetainPtr<NSURLAuthenticationChallenge *> m_nsChallenge;
+ RetainPtr<NSURLAuthenticationChallenge> m_nsChallenge;
#endif
};
Modified: trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (239708 => 239709)
--- trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -202,7 +202,7 @@
static NSArray *cookiesForURL(NSHTTPCookieStorage *storage, NSURL *url, NSURL *mainDocumentURL, const Optional<SameSiteInfo>& sameSiteInfo, NSString *partition = nullptr)
{
// The _getCookiesForURL: method calls the completionHandler synchronously. We use Optional<> to ensure this invariant.
- Optional<RetainPtr<NSArray *>> cookiesPtr;
+ Optional<RetainPtr<NSArray>> cookiesPtr;
auto completionHandler = [&cookiesPtr] (NSArray *cookies) {
cookiesPtr = retainPtr(cookies);
};
Modified: trunk/Source/WebKit/ChangeLog (239708 => 239709)
--- trunk/Source/WebKit/ChangeLog 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKit/ChangeLog 2019-01-08 00:03:09 UTC (rev 239709)
@@ -1,3 +1,22 @@
+2019-01-07 David Kilzer <[email protected]>
+
+ Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
+ <https://webkit.org/b/193056>
+
+ Reviewed by Alex Christensen.
+
+ * Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm:
+ (WebKit::XPCServiceMain):
+ * UIProcess/API/Cocoa/_WKThumbnailView.mm:
+ * UIProcess/ApplePay/WebPaymentCoordinatorProxy.h:
+ * UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
+ * UIProcess/Plugins/PluginProcessProxy.h:
+ * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
+ (WebKit::RemoteLayerTreeHost::createEmbeddedView):
+ * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
+ (WebKit::PlatformCALayerRemoteCustom::clone const):
+ - Remove '*' from RetainPtr<> type.
+
2019-01-07 Dean Jackson <[email protected]>
Turn on Pointer Events by default for iOS
Modified: trunk/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm (239708 => 239709)
--- trunk/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -130,7 +130,7 @@
@autoreleasepool {
NSDictionary *existingArguments = [[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain];
NSMutableDictionary *newArguments = [existingArguments mutableCopy];
- RetainPtr<NSMutableArray *> newLanguages = adoptNS([[NSMutableArray alloc] init]);
+ RetainPtr<NSMutableArray> newLanguages = adoptNS([[NSMutableArray alloc] init]);
xpc_array_apply(languages, ^(size_t index, xpc_object_t value) {
[newLanguages addObject:[NSString stringWithCString:xpc_string_get_string_ptr(value) encoding:NSUTF8StringEncoding]];
return true;
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm (239708 => 239709)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -57,7 +57,7 @@
CGFloat _lastSnapshotScale;
CGSize _lastSnapshotMaximumSize;
- RetainPtr<NSColor *> _overrideBackgroundColor;
+ RetainPtr<NSColor> _overrideBackgroundColor;
}
@synthesize snapshotSize=_snapshotSize;
Modified: trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h (239708 => 239709)
--- trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h 2019-01-08 00:03:09 UTC (rev 239709)
@@ -151,7 +151,7 @@
#if PLATFORM(MAC)
uint64_t m_showPaymentUIRequestSeed { 0 };
RetainPtr<NSWindow> m_sheetWindow;
- RetainPtr<NSObject *> m_sheetWindowWillCloseObserver;
+ RetainPtr<NSObject> m_sheetWindowWillCloseObserver;
#endif
#if defined(WEBPAYMENTCOORDINATORPROXY_ADDITIONS)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h (239708 => 239709)
--- trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h 2019-01-08 00:03:09 UTC (rev 239709)
@@ -111,7 +111,7 @@
VideoFullscreenManagerProxy* m_manager;
Ref<PlaybackSessionModelContext> m_playbackSessionModel;
uint64_t m_contextId;
- RetainPtr<PlatformView *> m_layerHostView;
+ RetainPtr<PlatformView> m_layerHostView;
HashSet<WebCore::VideoFullscreenModelClient*> m_clients;
WebCore::FloatSize m_videoDimensions;
bool m_hasVideo { false };
Modified: trunk/Source/WebKit/UIProcess/Plugins/PluginProcessProxy.h (239708 => 239709)
--- trunk/Source/WebKit/UIProcess/Plugins/PluginProcessProxy.h 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKit/UIProcess/Plugins/PluginProcessProxy.h 2019-01-08 00:03:09 UTC (rev 239709)
@@ -173,7 +173,7 @@
#if PLATFORM(COCOA)
RetainPtr<NSObject> m_activationObserver;
- RetainPtr<WKPlaceholderModalWindow *> m_placeholderWindow;
+ RetainPtr<WKPlaceholderModalWindow> m_placeholderWindow;
bool m_modalWindowIsShowing;
bool m_fullscreenWindowIsShowing;
unsigned m_preFullscreenAppPresentationOptions;
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm (239708 => 239709)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -128,7 +128,7 @@
if (m_isDebugLayerTreeHost)
return adoptNS([[UIView alloc] init]);
- auto result = m_embeddedViews.ensure(properties.embeddedViewID, [&]() -> RetainPtr<UIView *> {
+ auto result = m_embeddedViews.ensure(properties.embeddedViewID, [&]() -> RetainPtr<UIView> {
switch (properties.type) {
#if HAVE(PENCILKIT)
case PlatformCALayer::LayerTypeEditableImageLayer: {
Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm (239708 => 239709)
--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -100,7 +100,7 @@
Ref<WebCore::PlatformCALayer> PlatformCALayerRemoteCustom::clone(PlatformCALayerClient* owner) const
{
- RetainPtr<CALayer *> clonedLayer;
+ RetainPtr<CALayer> clonedLayer;
bool copyContents = true;
if (layerType() == LayerTypeAVPlayerLayer) {
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (239708 => 239709)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2019-01-08 00:03:09 UTC (rev 239709)
@@ -1,3 +1,27 @@
+2019-01-07 David Kilzer <[email protected]>
+
+ Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
+ <https://webkit.org/b/193056>
+
+ Reviewed by Alex Christensen.
+
+ * Plugins/Hosted/NetscapePluginHostProxy.h:
+ * Plugins/Hosted/NetscapePluginInstanceProxy.h:
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::enumerate):
+ (WebKit::NetscapePluginInstanceProxy::marshalValue):
+ (WebKit::NetscapePluginInstanceProxy::marshalValues):
+ (WebKit::NetscapePluginInstanceProxy::demarshalValue):
+ (WebKit::NetscapePluginInstanceProxy::demarshalValues):
+ * Plugins/Hosted/ProxyInstance.mm:
+ (WebKit::ProxyInstance::invoke):
+ * WebCoreSupport/WebGeolocationClient.mm:
+ * WebView/WebDataSource.mm:
+ (-[WebDataSource _receivedData:]):
+ * WebView/WebView.mm:
+ (-[WebView _cachedResponseForURL:]):
+ - Remove '*' from RetainPtr<> type.
+
2019-01-04 Alex Christensen <[email protected]>
Progress towards fixing Mac CMake build
Modified: trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginHostProxy.h (239708 => 239709)
--- trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginHostProxy.h 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginHostProxy.h 2019-01-08 00:03:09 UTC (rev 239709)
@@ -92,7 +92,7 @@
RetainPtr<CFMachPortRef> m_deadNameNotificationPort;
RetainPtr<id> m_activationObserver;
- RetainPtr<WebPlaceholderModalWindow *> m_placeholderWindow;
+ RetainPtr<WebPlaceholderModalWindow> m_placeholderWindow;
unsigned m_isModal;
bool m_menuBarIsVisible;
bool m_fullscreenWindowIsShowing;
Modified: trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h (239708 => 239709)
--- trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h 2019-01-08 00:03:09 UTC (rev 239709)
@@ -143,7 +143,7 @@
double& destX, double& destY, NPCoordinateSpace destSpace);
RefPtr<JSC::Bindings::Instance> createBindingsInstance(Ref<JSC::Bindings::RootObject>&&);
- RetainPtr<NSData *> marshalValues(JSC::ExecState*, const JSC::ArgList& args);
+ RetainPtr<NSData> marshalValues(JSC::ExecState*, const JSC::ArgList& args);
void marshalValue(JSC::ExecState*, JSC::JSValue, data_t& resultData, mach_msg_type_number_t& resultLength);
JSC::JSValue demarshalValue(JSC::ExecState*, const char* valueData, mach_msg_type_number_t valueLength);
Modified: trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm (239708 => 239709)
--- trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -101,8 +101,8 @@
}
uint32_t m_requestID;
- RetainPtr<NSURLRequest*> m_request;
- RetainPtr<NSString*> m_frameName;
+ RetainPtr<NSURLRequest> m_request;
+ RetainPtr<NSString> m_frameName;
bool m_allowPopups;
};
@@ -1277,7 +1277,7 @@
PropertyNameArray propertyNames(&vm, PropertyNameMode::Strings, PrivateSymbolMode::Exclude);
object->methodTable(vm)->getPropertyNames(object, exec, propertyNames, EnumerationMode());
- RetainPtr<NSMutableArray*> array = adoptNS([[NSMutableArray alloc] init]);
+ RetainPtr<NSMutableArray> array = adoptNS([[NSMutableArray alloc] init]);
for (unsigned i = 0; i < propertyNames.size(); i++) {
uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(propertyNames[i].string().utf8().data()));
@@ -1346,7 +1346,7 @@
void NetscapePluginInstanceProxy::marshalValue(ExecState* exec, JSValue value, data_t& resultData, mach_msg_type_number_t& resultLength)
{
- RetainPtr<NSMutableArray*> array = adoptNS([[NSMutableArray alloc] init]);
+ RetainPtr<NSMutableArray> array = adoptNS([[NSMutableArray alloc] init]);
addValueToArray(array.get(), exec, value);
@@ -1359,9 +1359,9 @@
memcpy(resultData, data.bytes, resultLength);
}
-RetainPtr<NSData *> NetscapePluginInstanceProxy::marshalValues(ExecState* exec, const ArgList& args)
+RetainPtr<NSData> NetscapePluginInstanceProxy::marshalValues(ExecState* exec, const ArgList& args)
{
- RetainPtr<NSMutableArray*> array = adoptNS([[NSMutableArray alloc] init]);
+ RetainPtr<NSMutableArray> array = adoptNS([[NSMutableArray alloc] init]);
for (unsigned i = 0; i < args.size(); i++)
addValueToArray(array.get(), exec, args.at(i));
@@ -1426,7 +1426,7 @@
JSValue NetscapePluginInstanceProxy::demarshalValue(ExecState* exec, const char* valueData, mach_msg_type_number_t valueLength)
{
- RetainPtr<NSData*> data = "" alloc] initWithBytesNoCopy:(void*)valueData length:valueLength freeWhenDone:NO]);
+ RetainPtr<NSData> data = "" alloc] initWithBytesNoCopy:(void*)valueData length:valueLength freeWhenDone:NO]);
NSArray *array = [NSPropertyListSerialization propertyListWithData:data.get() options:NSPropertyListImmutable format:nullptr error:nullptr];
@@ -1440,7 +1440,7 @@
void NetscapePluginInstanceProxy::demarshalValues(ExecState* exec, data_t valuesData, mach_msg_type_number_t valuesLength, MarkedArgumentBuffer& result)
{
- RetainPtr<NSData*> data = "" alloc] initWithBytesNoCopy:valuesData length:valuesLength freeWhenDone:NO]);
+ RetainPtr<NSData> data = "" alloc] initWithBytesNoCopy:valuesData length:valuesLength freeWhenDone:NO]);
NSArray *array = [NSPropertyListSerialization propertyListWithData:data.get() options:NSPropertyListImmutable format:nullptr error:nullptr];
Modified: trunk/Source/WebKitLegacy/mac/Plugins/Hosted/ProxyInstance.mm (239708 => 239709)
--- trunk/Source/WebKitLegacy/mac/Plugins/Hosted/ProxyInstance.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKitLegacy/mac/Plugins/Hosted/ProxyInstance.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -146,7 +146,7 @@
if (!m_instanceProxy)
return jsUndefined();
- RetainPtr<NSData*> arguments(m_instanceProxy->marshalValues(exec, args));
+ RetainPtr<NSData> arguments(m_instanceProxy->marshalValues(exec, args));
uint32_t requestID = m_instanceProxy->nextRequestID();
Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm (239708 => 239709)
--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -56,7 +56,7 @@
@interface WebGeolocationPolicyListener : NSObject <WebAllowDenyPolicyListener>
{
RefPtr<Geolocation> _geolocation;
- RetainPtr<WebView *> _webView;
+ RetainPtr<WebView> _webView;
}
- (id)initWithGeolocation:(Geolocation*)geolocation forWebView:(WebView*)webView;
@end
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebDataSource.mm (239708 => 239709)
--- trunk/Source/WebKitLegacy/mac/WebView/WebDataSource.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebDataSource.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -246,7 +246,7 @@
- (void)_receivedData:(NSData *)data
{
// protect self temporarily, as the bridge receivedData call could remove our last ref
- RetainPtr<WebDataSource*> protect(self);
+ RetainPtr<WebDataSource> protect(self);
[[self representation] receivedData:data withDataSource:self];
[[[[self webFrame] frameView] documentView] dataSourceUpdated:self];
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (239708 => 239709)
--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -3661,7 +3661,7 @@
- (NSCachedURLResponse *)_cachedResponseForURL:(NSURL *)URL
{
- RetainPtr<NSMutableURLRequest *> request = adoptNS([[NSMutableURLRequest alloc] initWithURL:URL]);
+ RetainPtr<NSMutableURLRequest> request = adoptNS([[NSMutableURLRequest alloc] initWithURL:URL]);
[request _web_setHTTPUserAgent:[self userAgentForURL:URL]];
NSCachedURLResponse *cachedResponse;
Modified: trunk/Tools/ChangeLog (239708 => 239709)
--- trunk/Tools/ChangeLog 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/ChangeLog 2019-01-08 00:03:09 UTC (rev 239709)
@@ -1,3 +1,81 @@
+2019-01-07 David Kilzer <[email protected]>
+
+ Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
+ <https://webkit.org/b/193056>
+
+ Reviewed by Alex Christensen.
+
+ * Scripts/webkitpy/style/checker.py:
+ - Ignore use of new runtime/retainptr check in
+ Tools/TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm since it
+ contains tests to ensure RetainPtr<NSObject *> is compatible
+ with RetainPtr<NSObject>.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (check_language):
+ (CppChecker):
+ - Add checker for use of '*' in RetainPtr<> type. A for loop
+ was used instead of a single regex so that angle brackets
+ could be matched up when checking the type contained within
+ the RetainPtr<> type.
+
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+ (CppStyleTest):
+ - Add unit test for new runtime/retainptr check.
+
+ * TestRunnerShared/EventSerialization/mac/EventSerializerMac.h:
+ * TestWebKitAPI/EditingTestHarness.h:
+ - Remove '*' from RetainPtr<> type.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ - Add cf/RetainPtr.cpp back to TestWTFLibrary target! This
+ regressed in r201938.
+
+ * TestWebKitAPI/Tests/WTF/cf/RetainPtr.cpp:
+ (TestWebKitAPI::TEST):
+ - Update tests to match RetainPtr.mm tests (except for the
+ `*SimilarNSType` tests since there is no CF equivalent of
+ RetainPtr<NSString> and RetainPtr<NSString *>).
+
+ * TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm:
+ (TestWebKitAPI::TEST):
+ - Update tests to:
+ - Not conflict by name with equivalent CF tests in
+ RetainPtr.cpp.
+ - Add test cases for RetainPtr<NSObject>,
+ RetainPtr<NSObject *> and RetainPtr<id> were appropriate.
+ - Add `*SimilarNSType` tests for converting between
+ RetainPtr<NSObject> and RetainPtr<NSObject *>.
+ - Change `0` to `nil` as appropriate.
+ - Re-alphabetize the tests by name.
+ - Add Optional<RetainPtr<>> tests.
+ - Add retainPtr() tests.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm:
+ (-[DownloadProgressTestRunner _download:decideDestinationWithSuggestedFilename:completionHandler:]):
+ * TestWebKitAPI/Tests/WebKitCocoa/IconLoadingDelegate.mm:
+ (TEST):
+ - Remove '*' from RetainPtr<> type.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/JITEnabled.mm:
+ (TEST(WebKit, JITEnabled)):
+ - Add missing WTFMove(). Apparently a temporary was being
+ created before in the argument list due to mismatched
+ RetainPtr<> types.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+ * TestWebKitAPI/Tests/WebKitCocoa/VideoControlsManager.mm:
+ (TestWebKitAPI::setUpWebViewForTestingVideoControlsManager):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
+ * TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm:
+ * WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm:
+ (WTR::resourcesDirectoryURL):
+ * WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm:
+ (WTR::InjectedBundle::platformInitialize):
+ * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
+ - Remove '*' from RetainPtr<> type.
+
2019-01-07 Eric Carlson <[email protected]>
A MediaTime timescale must never be zero
Modified: trunk/Tools/Scripts/webkitpy/style/checker.py (239708 => 239709)
--- trunk/Tools/Scripts/webkitpy/style/checker.py 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/Scripts/webkitpy/style/checker.py 2019-01-08 00:03:09 UTC (rev 239709)
@@ -142,6 +142,9 @@
os.path.join('Tools', 'DumpRenderTree', 'TestNetscapePlugIn')],
["-build/include",
"-readability/naming"]),
+ ([ # Ignore use of RetainPtr<NSObject *> for tests that ensure its compatibility with ReteainPtr<NSObject>.
+ os.path.join('Tools', 'TestWebKitAPI', 'Tests', 'WTF', 'ns', 'RetainPtr.mm')],
+ ["-runtime/retainptr"]),
([ # There is no clean way to avoid "yy_*" names used by flex.
os.path.join('Source', 'WebCore', 'css', 'CSSParser.cpp'),
# TestWebKitAPI uses funny macros like EXPECT_WK_STREQ.
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (239708 => 239709)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2019-01-08 00:03:09 UTC (rev 239709)
@@ -3313,6 +3313,25 @@
error(line_number, 'runtime/dispatch_set_target_queue', 5,
'Never use dispatch_set_target_queue. Use dispatch_queue_create_with_target instead.')
+ matched = search(r'\b(RetainPtr<.*)', line)
+ if matched:
+ match_line = matched.group(1)
+ nested_angle_bracket_count = 1
+ previous_closing_angle_bracket_index = -1
+ closing_angle_bracket_index = 9 # Used if only one pair of angle brackets.
+ for i in xrange(10, len(match_line) - 1):
+ if match_line[i] == '<':
+ nested_angle_bracket_count += 1
+ if match_line[i] == '>':
+ nested_angle_bracket_count -= 1
+ previous_closing_angle_bracket_index = closing_angle_bracket_index
+ closing_angle_bracket_index = i
+ if nested_angle_bracket_count == 0:
+ if "*" in match_line[previous_closing_angle_bracket_index:closing_angle_bracket_index]:
+ error(line_number, 'runtime/retainptr', 5,
+ 'RetainPtr<> should never contain a type with \'*\'. Correct: RetainPtr<NSString>, RetainPtr<CFStringRef>.')
+ break
+
# Check for suspicious usage of "if" like
# } if (a == b) {
if search(r'\}\s*if\s*\(', line):
@@ -4052,6 +4071,7 @@
'runtime/printf',
'runtime/printf_format',
'runtime/references',
+ 'runtime/retainptr',
'runtime/rtti',
'runtime/sizeof',
'runtime/soft-linked-alloc',
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (239708 => 239709)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2019-01-08 00:03:09 UTC (rev 239709)
@@ -1667,6 +1667,27 @@
' [runtime/dispatch_set_target_queue] [5]')
self.assert_lint('globalQueue = dispatch_queue_create_with_target("My Serial Queue", DISPATCH_QUEUE_SERIAL, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0));', '')
+ def test_retainptr_pointer(self):
+ self.assert_lint(
+ '''RetainPtr<CFRunLoopRef*> m_cfRunLoop;''',
+ 'RetainPtr<> should never contain a type with \'*\'. Correct: RetainPtr<NSString>, RetainPtr<CFStringRef>.'
+ ' [runtime/retainptr] [5]')
+ self.assert_lint('RetainPtr<CFRunLoopRef> m_cfRunLoop;', '')
+ self.assert_lint(
+ '''RetainPtr<NSRunLoop*> m_nsRunLoop;''',
+ 'RetainPtr<> should never contain a type with \'*\'. Correct: RetainPtr<NSString>, RetainPtr<CFStringRef>.'
+ ' [runtime/retainptr] [5]')
+ self.assert_lint('RetainPtr<NSRunLoop> m_nsRunLoop;', '')
+ self.assert_lint(
+ '''RetainPtr<NSMutableArray<NSDictionary *> *> m_editorStateHistory;''',
+ 'RetainPtr<> should never contain a type with \'*\'. Correct: RetainPtr<NSString>, RetainPtr<CFStringRef>.'
+ ' [runtime/retainptr] [5]')
+ self.assert_lint(
+ '''RetainPtr<NSDictionary<NSString *, NSArray<NSString *>> *> dictionary;''',
+ 'RetainPtr<> should never contain a type with \'*\'. Correct: RetainPtr<NSString>, RetainPtr<CFStringRef>.'
+ ' [runtime/retainptr] [5]')
+ self.assert_lint('''RetainPtr<NSDictionary<NSString *, NSArray<NSString *>>> dictionary;''', '')
+
# Variable-length arrays are not permitted.
def test_variable_length_array_detection(self):
errmsg = ('Do not use variable-length arrays. Use an appropriately named '
Modified: trunk/Tools/TestRunnerShared/EventSerialization/mac/EventSerializerMac.h (239708 => 239709)
--- trunk/Tools/TestRunnerShared/EventSerialization/mac/EventSerializerMac.h 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestRunnerShared/EventSerialization/mac/EventSerializerMac.h 2019-01-08 00:03:09 UTC (rev 239709)
@@ -38,8 +38,8 @@
@end
@interface EventStreamPlayer : NSObject {
- RetainPtr<NSMutableArray *> _remainingEventDictionaries;
- RetainPtr<NSWindow *> _window;
+ RetainPtr<NSMutableArray> _remainingEventDictionaries;
+ RetainPtr<NSWindow> _window;
BlockPtr<void ()> _completionHandler;
uint64_t _startTime;
}
Modified: trunk/Tools/TestWebKitAPI/EditingTestHarness.h (239708 => 239709)
--- trunk/Tools/TestWebKitAPI/EditingTestHarness.h 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestWebKitAPI/EditingTestHarness.h 2019-01-08 00:03:09 UTC (rev 239709)
@@ -31,8 +31,8 @@
#import <WebKit/WKUIDelegatePrivate.h>
@interface EditingTestHarness : NSObject<WKUIDelegatePrivate> {
- RetainPtr<NSMutableArray<NSDictionary *> *> _editorStateHistory;
- RetainPtr<TestWKWebView *> _webView;
+ RetainPtr<NSMutableArray<NSDictionary *>> _editorStateHistory;
+ RetainPtr<TestWKWebView> _webView;
}
- (instancetype)initWithWebView:(TestWKWebView *)webView;
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (239708 => 239709)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-01-08 00:03:09 UTC (rev 239709)
@@ -172,6 +172,7 @@
4433A396208044140091ED57 /* SynchronousTimeoutTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4433A395208044130091ED57 /* SynchronousTimeoutTests.mm */; };
44817A2F1F0486BF00003810 /* WKRequestActivatedElementInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 44817A2E1F0486BF00003810 /* WKRequestActivatedElementInfo.mm */; };
448D7E471EA6C55500ECC756 /* EnvironmentUtilitiesTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 448D7E451EA6C55500ECC756 /* EnvironmentUtilitiesTest.cpp */; };
+ 44AC8BC621D0245A00CAFB34 /* RetainPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC029B161486AD6400817DA9 /* RetainPtr.cpp */; };
4612C2B9210A6ACE00B788A6 /* LoadFileThenReload.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4612C2B8210A6ABF00B788A6 /* LoadFileThenReload.mm */; };
46397B951DC2C850009A78AE /* DOMNode.mm in Sources */ = {isa = PBXBuildFile; fileRef = 46397B941DC2C850009A78AE /* DOMNode.mm */; };
4647B1261EBA3B850041D7EF /* ProcessDidTerminate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4647B1251EBA3B730041D7EF /* ProcessDidTerminate.cpp */; };
@@ -3805,6 +3806,7 @@
7C83DF151D0A590C00FEBCF3 /* RefCounter.cpp in Sources */,
7C83DED71D0A590C00FEBCF3 /* RefLogger.cpp in Sources */,
7C83DF161D0A590C00FEBCF3 /* RefPtr.cpp in Sources */,
+ 44AC8BC621D0245A00CAFB34 /* RetainPtr.cpp in Sources */,
7C83DF241D0A590C00FEBCF3 /* RetainPtr.mm in Sources */,
7C83DF051D0A590C00FEBCF3 /* RunLoop.cpp in Sources */,
7C83DF261D0A590C00FEBCF3 /* SaturatedArithmeticOperations.cpp in Sources */,
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/cf/RetainPtr.cpp (239708 => 239709)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/cf/RetainPtr.cpp 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/cf/RetainPtr.cpp 2019-01-08 00:03:09 UTC (rev 239709)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,14 +29,155 @@
#include "config.h"
#include <wtf/RetainPtr.h>
+#include <wtf/cf/TypeCastsCF.h>
namespace TestWebKitAPI {
TEST(RetainPtr, AdoptCF)
{
- RetainPtr<CFArrayRef> foo = adoptCF(CFArrayCreate(kCFAllocatorDefault, nullptr, 0, nullptr));
+ RetainPtr<CFArrayRef> array1 = adoptCF(CFArrayCreate(kCFAllocatorDefault, nullptr, 0, nullptr));
+ EXPECT_EQ(1, CFGetRetainCount(array1.get()));
+ EXPECT_EQ(0, CFArrayGetCount(array1.get()));
- EXPECT_EQ(1, CFGetRetainCount(foo.get()));
+ RetainPtr<CFTypeRef> array2 = adoptCF(CFArrayCreate(kCFAllocatorDefault, nullptr, 0, nullptr));
+ EXPECT_EQ(1, CFGetRetainCount(array2.get()));
+ EXPECT_EQ(0, CFArrayGetCount(checked_cf_cast<CFArrayRef>(array2.get())));
}
+TEST(RetainPtr, ConstructionFromMutableCFType)
+{
+ CFMutableStringRef string = CFStringCreateMutableCopy(kCFAllocatorDefault, 4, CFSTR("foo"));
+
+ // This should invoke RetainPtr's move constructor.
+ // FIXME: This doesn't actually test that we moved the value. We should use a mock
+ // CFTypeRef that logs -retain and -release calls.
+ RetainPtr<CFStringRef> ptr = RetainPtr<CFMutableStringRef>(string);
+
+ EXPECT_EQ(string, ptr);
+
+ RetainPtr<CFMutableStringRef> temp = string;
+
+ // This should invoke RetainPtr's move constructor.
+ RetainPtr<CFStringRef> ptr2(WTFMove(temp));
+
+ EXPECT_EQ(string, ptr2);
+ EXPECT_EQ((CFStringRef)nullptr, temp);
+}
+
+TEST(RetainPtr, ConstructionFromSameCFType)
+{
+ CFStringRef string = CFSTR("foo");
+
+ // This should invoke RetainPtr's move constructor.
+ // FIXME: This doesn't actually test that we moved the value. We should use a mock
+ // CFTypeRef that logs -retain and -release calls.
+ RetainPtr<CFStringRef> ptr = RetainPtr<CFStringRef>(string);
+
+ EXPECT_EQ(string, ptr);
+
+ RetainPtr<CFStringRef> temp = string;
+
+ // This should invoke RetainPtr's move constructor.
+ RetainPtr<CFStringRef> ptr2(WTFMove(temp));
+
+ EXPECT_EQ(string, ptr2);
+ EXPECT_EQ((CFStringRef)nullptr, temp);
+}
+
+TEST(RetainPtr, MoveAssignmentFromMutableCFType)
+{
+ CFMutableStringRef string = CFStringCreateMutableCopy(kCFAllocatorDefault, 4, CFSTR("foo"));
+ RetainPtr<CFStringRef> ptr;
+
+ // This should invoke RetainPtr's move assignment operator.
+ // FIXME: This doesn't actually test that we moved the value. We should use a mock
+ // CFTypeRef that logs -retain and -release calls.
+ ptr = RetainPtr<CFMutableStringRef>(string);
+
+ EXPECT_EQ(string, ptr);
+
+ ptr = nullptr;
+ RetainPtr<CFMutableStringRef> temp = string;
+
+ // This should invoke RetainPtr's move assignment operator.
+ ptr = WTFMove(temp);
+
+ EXPECT_EQ(string, ptr);
+ EXPECT_EQ((CFStringRef)nullptr, temp);
+}
+
+TEST(RetainPtr, MoveAssignmentFromSameCFType)
+{
+ CFStringRef string = CFSTR("foo");
+ RetainPtr<CFStringRef> ptr;
+
+ // This should invoke RetainPtr's move assignment operator.
+ // FIXME: This doesn't actually test that we moved the value. We should use a mock
+ // CFTypeRef that logs -retain and -release calls.
+ ptr = RetainPtr<CFStringRef>(string);
+
+ EXPECT_EQ(string, ptr);
+
+ ptr = nullptr;
+ RetainPtr<CFStringRef> temp = string;
+
+ // This should invoke RetainPtr's move assignment operator.
+ ptr = WTFMove(temp);
+
+ EXPECT_EQ(string, ptr);
+ EXPECT_EQ((CFStringRef)nullptr, temp);
+}
+
+TEST(RetainPtr, OptionalRetainPtrCF)
+{
+ // Test assignment from adoptCF().
+ float value = 3.1415926535;
+ Optional<RetainPtr<CFNumberRef>> optionalObject1 = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &value));
+ EXPECT_EQ(1, CFGetRetainCount(optionalObject1.value().get()));
+ RetainPtr<CFNumberRef> object1 = optionalObject1.value();
+ EXPECT_EQ(optionalObject1.value(), object1);
+
+ // Test assignment from retainPtr().
+ Optional<RetainPtr<CFNumberRef>> optionalObject2 = retainPtr(CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &value));
+ CFRelease(optionalObject2.value().get());
+ EXPECT_EQ(1, CFGetRetainCount(optionalObject2.value().get()));
+ RetainPtr<CFNumberRef> object2 = optionalObject2.value();
+ EXPECT_EQ(optionalObject2.value(), object2);
+
+ EXPECT_NE(object1, object2);
+
+ // Test assignment from Optional<RetainPtr<CFNumberRef>>.
+ optionalObject1 = optionalObject2;
+ EXPECT_TRUE(optionalObject1.value());
+ EXPECT_TRUE(optionalObject1.value().get());
+ EXPECT_EQ(optionalObject1.value(), object2);
+ EXPECT_TRUE(optionalObject2.value());
+ EXPECT_TRUE(optionalObject2.value().get());
+ EXPECT_EQ(optionalObject2.value(), object2);
+
+ // Reset after assignment test.
+ optionalObject1 = object1;
+ EXPECT_EQ(optionalObject1.value(), object1);
+ EXPECT_EQ(optionalObject2.value(), object2);
+
+ // Test move from Optional<RetainPtr<CFNumberRef>>.
+ optionalObject1 = WTFMove(optionalObject2);
+ EXPECT_TRUE(optionalObject1.value());
+ EXPECT_TRUE(optionalObject1.value().get());
+ EXPECT_EQ(optionalObject1.value(), object2);
+ EXPECT_FALSE(optionalObject2);
+}
+
+TEST(RetainPtr, RetainPtrCF)
+{
+ float value = 3.1415926535;
+ RetainPtr<CFNumberRef> object1 = retainPtr(CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &value));
+ CFRelease(object1.get());
+ EXPECT_EQ(1, CFGetRetainCount(object1.get()));
+
+ RetainPtr<CFTypeRef> object2 = retainPtr(CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &value));
+ CFRelease(object2.get());
+ EXPECT_EQ(1, CFGetRetainCount(object2.get()));
+}
+
} // namespace TestWebKitAPI
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm (239708 => 239709)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -34,35 +34,98 @@
TEST(RetainPtr, AdoptNS)
{
- RetainPtr<NSObject> foo = adoptNS([[NSObject alloc] init]);
+ RetainPtr<NSObject> object1 = adoptNS([[NSObject alloc] init]);
+ EXPECT_EQ(1, CFGetRetainCount(object1.get()));
- EXPECT_EQ(1, CFGetRetainCount(foo.get()));
+ RetainPtr<NSObject *> object2 = adoptNS([[NSObject alloc] init]);
+ EXPECT_EQ(1, CFGetRetainCount(object2.get()));
+
+ RetainPtr<id> object3 = adoptNS([[NSObject alloc] init]);
+ EXPECT_EQ(1, CFGetRetainCount(object3.get()));
}
-TEST(RetainPtr, MoveAssignmentFromSameType)
+TEST(RetainPtr, ConstructionFromMutableNSType)
{
+ NSMutableString *string = [NSMutableString stringWithUTF8String:"foo"];
+
+ // This should invoke RetainPtr's move constructor.
+ // FIXME: This doesn't actually test that we moved the value. We should use a mock
+ // NSObject that logs -retain and -release calls.
+ RetainPtr<NSString> ptr = RetainPtr<NSMutableString>(string);
+
+ EXPECT_EQ(string, ptr);
+
+ RetainPtr<NSMutableString> temp = string;
+
+ // This should invoke RetainPtr's move constructor.
+ RetainPtr<NSString> ptr2(WTFMove(temp));
+
+ EXPECT_EQ(string, ptr2);
+ EXPECT_EQ((NSString *)nil, temp);
+}
+
+TEST(RetainPtr, ConstructionFromSameNSType)
+{
NSString *string = @"foo";
- RetainPtr<NSString> ptr;
- // This should invoke RetainPtr's move assignment operator.
+ // This should invoke RetainPtr's move constructor.
// FIXME: This doesn't actually test that we moved the value. We should use a mock
// NSObject that logs -retain and -release calls.
- ptr = RetainPtr<NSString>(string);
+ RetainPtr<NSString> ptr = RetainPtr<NSString>(string);
EXPECT_EQ(string, ptr);
- ptr = 0;
RetainPtr<NSString> temp = string;
- // This should invoke RetainPtr's move assignment operator.
- ptr = WTFMove(temp);
+ // This should invoke RetainPtr's move constructor.
+ RetainPtr<NSString> ptr2(WTFMove(temp));
+ EXPECT_EQ(string, ptr2);
+ EXPECT_EQ((NSString *)nil, temp);
+}
+
+TEST(RetainPtr, ConstructionFromSimilarNSType)
+{
+ NSString *string = @"foo";
+
+ // This should invoke RetainPtr's move constructor.
+ // FIXME: This doesn't actually test that we moved the value. We should use a mock
+ // NSObject that logs -retain and -release calls.
+ RetainPtr<NSString> ptr = RetainPtr<NSString *>(string);
+
EXPECT_EQ(string, ptr);
- EXPECT_EQ((NSString *)0, temp);
+
+ RetainPtr<NSString *> temp = string;
+
+ // This should invoke RetainPtr's move constructor.
+ RetainPtr<NSString> ptr2(WTFMove(temp));
+
+ EXPECT_EQ(string, ptr2);
+ EXPECT_EQ((NSString *)nil, temp);
}
-TEST(RetainPtr, MoveAssignmentFromSimilarType)
+TEST(RetainPtr, ConstructionFromSimilarNSTypeReversed)
{
+ NSString *string = @"foo";
+
+ // This should invoke RetainPtr's move constructor.
+ // FIXME: This doesn't actually test that we moved the value. We should use a mock
+ // NSObject that logs -retain and -release calls.
+ RetainPtr<NSString *> ptr = RetainPtr<NSString>(string);
+
+ EXPECT_EQ(string, ptr);
+
+ RetainPtr<NSString> temp = string;
+
+ // This should invoke RetainPtr's move constructor.
+ RetainPtr<NSString *> ptr2(WTFMove(temp));
+
+ EXPECT_EQ(string, ptr2);
+ EXPECT_EQ((NSString *)nil, temp);
+}
+
+TEST(RetainPtr, MoveAssignmentFromMutableNSType)
+{
NSMutableString *string = [NSMutableString stringWithUTF8String:"foo"];
RetainPtr<NSString> ptr;
@@ -73,7 +136,7 @@
EXPECT_EQ(string, ptr);
- ptr = 0;
+ ptr = nil;
RetainPtr<NSMutableString> temp = string;
// This should invoke RetainPtr's move assignment operator.
@@ -80,47 +143,135 @@
ptr = WTFMove(temp);
EXPECT_EQ(string, ptr);
- EXPECT_EQ((NSString *)0, temp);
+ EXPECT_EQ((NSString *)nil, temp);
}
-TEST(RetainPtr, ConstructionFromSameType)
+TEST(RetainPtr, MoveAssignmentFromSameNSType)
{
NSString *string = @"foo";
+ RetainPtr<NSString> ptr;
- // This should invoke RetainPtr's move constructor.
+ // This should invoke RetainPtr's move assignment operator.
// FIXME: This doesn't actually test that we moved the value. We should use a mock
// NSObject that logs -retain and -release calls.
- RetainPtr<NSString> ptr = RetainPtr<NSString>(string);
+ ptr = RetainPtr<NSString>(string);
EXPECT_EQ(string, ptr);
+ ptr = nil;
RetainPtr<NSString> temp = string;
- // This should invoke RetainPtr's move constructor.
- RetainPtr<NSString> ptr2(WTFMove(temp));
+ // This should invoke RetainPtr's move assignment operator.
+ ptr = WTFMove(temp);
- EXPECT_EQ(string, ptr2);
- EXPECT_EQ((NSString *)0, temp);
+ EXPECT_EQ(string, ptr);
+ EXPECT_EQ((NSString *)nil, temp);
}
-TEST(RetainPtr, ConstructionFromSimilarType)
+TEST(RetainPtr, MoveAssignmentFromSimilarNSType)
{
- NSMutableString *string = [NSMutableString stringWithUTF8String:"foo"];
+ NSString *string = @"foo";
+ RetainPtr<NSString> ptr;
- // This should invoke RetainPtr's move constructor.
+ // This should invoke RetainPtr's move assignment operator.
// FIXME: This doesn't actually test that we moved the value. We should use a mock
// NSObject that logs -retain and -release calls.
- RetainPtr<NSString> ptr = RetainPtr<NSMutableString>(string);
+ ptr = RetainPtr<NSString *>(string);
EXPECT_EQ(string, ptr);
- RetainPtr<NSMutableString> temp = string;
+ ptr = nil;
+ RetainPtr<NSString *> temp = string;
- // This should invoke RetainPtr's move constructor.
- RetainPtr<NSString> ptr2(WTFMove(temp));
+ // This should invoke RetainPtr's move assignment operator.
+ ptr = WTFMove(temp);
- EXPECT_EQ(string, ptr2);
- EXPECT_EQ((NSString *)0, temp);
+ EXPECT_EQ(string, ptr);
+ EXPECT_EQ((NSString *)nil, temp);
}
+TEST(RetainPtr, MoveAssignmentFromSimilarNSTypeReversed)
+{
+ NSString *string = @"foo";
+ RetainPtr<NSString *> ptr;
+
+ // This should invoke RetainPtr's move assignment operator.
+ // FIXME: This doesn't actually test that we moved the value. We should use a mock
+ // NSObject that logs -retain and -release calls.
+ ptr = RetainPtr<NSString>(string);
+
+ EXPECT_EQ(string, ptr);
+
+ ptr = nil;
+ RetainPtr<NSString> temp = string;
+
+ // This should invoke RetainPtr's move assignment operator.
+ ptr = WTFMove(temp);
+
+ EXPECT_EQ(string, ptr);
+ EXPECT_EQ((NSString *)nil, temp);
+}
+
+TEST(RetainPtr, OptionalRetainPtrNS)
+{
+ // Test assignment from adoptNS().
+ Optional<RetainPtr<NSObject>> optionalObject1 = adoptNS([NSObject new]);
+ EXPECT_EQ(1, CFGetRetainCount(optionalObject1.value().get()));
+ RetainPtr<NSObject> object1 = optionalObject1.value();
+ EXPECT_EQ(optionalObject1.value(), object1);
+
+ // Test assignment from retainPtr().
+ Optional<RetainPtr<NSObject>> optionalObject2;
+ @autoreleasepool {
+ optionalObject2 = retainPtr([[NSObject new] autorelease]);
+ }
+ EXPECT_EQ(1, CFGetRetainCount(optionalObject2.value().get()));
+ RetainPtr<NSObject> object2 = optionalObject2.value();
+ EXPECT_EQ(optionalObject2.value(), object2);
+
+ EXPECT_NE(object1, object2);
+
+ // Test assignment from Optional<RetainPtr<NSObject>>.
+ optionalObject1 = optionalObject2;
+ EXPECT_TRUE(optionalObject1.value());
+ EXPECT_TRUE(optionalObject1.value().get());
+ EXPECT_EQ(optionalObject1.value(), object2);
+ EXPECT_TRUE(optionalObject2.value());
+ EXPECT_TRUE(optionalObject2.value().get());
+ EXPECT_EQ(optionalObject2.value(), object2);
+
+ // Reset after assignment test.
+ optionalObject1 = object1;
+ EXPECT_EQ(optionalObject1.value(), object1);
+ EXPECT_EQ(optionalObject2.value(), object2);
+
+ // Test move from Optional<RetainPtr<NSObject>>.
+ optionalObject1 = WTFMove(optionalObject2);
+ EXPECT_TRUE(optionalObject1.value());
+ EXPECT_TRUE(optionalObject1.value().get());
+ EXPECT_EQ(optionalObject1.value(), object2);
+ EXPECT_FALSE(optionalObject2);
+}
+
+TEST(RetainPtr, RetainPtrNS)
+{
+ RetainPtr<NSObject> object1;
+ @autoreleasepool {
+ object1 = retainPtr([[NSObject new] autorelease]);
+ }
+ EXPECT_EQ(1, CFGetRetainCount(object1.get()));
+
+ RetainPtr<NSObject *> object2;
+ @autoreleasepool {
+ object2 = retainPtr([[NSObject new] autorelease]);
+ }
+ EXPECT_EQ(1, CFGetRetainCount(object2.get()));
+
+ RetainPtr<id> object3;
+ @autoreleasepool {
+ object3 = retainPtr([[NSObject new] autorelease]);
+ }
+ EXPECT_EQ(1, CFGetRetainCount(object3.get()));
+}
+
} // namespace TestWebKitAPI
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm (239708 => 239709)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -381,7 +381,7 @@
EXPECT_EQ(download, m_download.get());
WebCore::FileSystem::PlatformFileHandle fileHandle;
- RetainPtr<NSString *> path = (NSString *)WebCore::FileSystem::openTemporaryFile("TestWebKitAPI", fileHandle);
+ RetainPtr<NSString> path = (NSString *)WebCore::FileSystem::openTemporaryFile("TestWebKitAPI", fileHandle);
EXPECT_TRUE(fileHandle != WebCore::FileSystem::invalidPlatformFileHandle);
WebCore::FileSystem::closeFile(fileHandle);
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IconLoadingDelegate.mm (239708 => 239709)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IconLoadingDelegate.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/IconLoadingDelegate.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -205,7 +205,7 @@
RetainPtr<IconLoadingSchemeHandler> handler = adoptNS([[IconLoadingSchemeHandler alloc] initWithData:mainData]);
NSURL *url = "" mainBundle] URLForResource:@"large-red-square-image" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
- RetainPtr<NSData *> iconDataFromDisk = [NSData dataWithContentsOfURL:url];
+ RetainPtr<NSData> iconDataFromDisk = [NSData dataWithContentsOfURL:url];
[handler.get() setFaviconData:iconDataFromDisk.get()];
[configuration setURLSchemeHandler:handler.get() forURLScheme:@"testing"];
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/JITEnabled.mm (239708 => 239709)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/JITEnabled.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/JITEnabled.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -53,7 +53,7 @@
auto configuration = adoptNS([WKWebViewConfiguration new]);
[configuration setProcessPool:[[[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()] autorelease]];
auto webViewNoJIT = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
- checkJITEnabled(webViewNoJIT, NO);
+ checkJITEnabled(WTFMove(webViewNoJIT), NO);
checkJITEnabled(adoptNS([WKWebView new]), YES);
}
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (239708 => 239709)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -188,7 +188,7 @@
@interface PSONScheme : NSObject <WKURLSchemeHandler> {
const char* _bytes;
HashMap<String, String> _redirects;
- HashMap<String, RetainPtr<NSData *>> _dataMappings;
+ HashMap<String, RetainPtr<NSData>> _dataMappings;
}
- (instancetype)initWithBytes:(const char*)bytes;
- (void)addRedirectFromURLString:(NSString *)sourceURLString toURLString:(NSString *)destinationURLString;
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/VideoControlsManager.mm (239708 => 239709)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/VideoControlsManager.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/VideoControlsManager.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -117,7 +117,7 @@
namespace TestWebKitAPI {
-RetainPtr<VideoControlsManagerTestWebView*> setUpWebViewForTestingVideoControlsManager(NSRect frame)
+RetainPtr<VideoControlsManagerTestWebView> setUpWebViewForTestingVideoControlsManager(NSRect frame)
{
RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
configuration.get().mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone;
@@ -126,7 +126,7 @@
TEST(VideoControlsManager, VideoControlsManagerSingleLargeVideo)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
// A large video with audio should have a controls manager even if it is played via script like this video.
// So the expectation is YES.
@@ -136,7 +136,7 @@
TEST(VideoControlsManager, VideoControlsManagerSingleSmallVideo)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
// A small video will not have a controls manager unless it started playing because of a user gesture. Since this
// video is started with a script, the expectation is NO.
@@ -146,7 +146,7 @@
TEST(VideoControlsManager, VideoControlsManagerMultipleVideosWithAudio)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
[webView loadTestPageNamed:@"large-videos-with-audio"];
[webView waitForPageToLoadWithAutoplayingVideos:0];
@@ -157,7 +157,7 @@
// FIXME: Re-enable this test once <webkit.org/b/175143> is resolved.
TEST(VideoControlsManager, DISABLED_VideoControlsManagerMultipleVideosWithAudioAndAutoplay)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
[webView loadTestPageNamed:@"large-videos-with-audio-autoplay"];
[webView waitForPageToLoadWithAutoplayingVideos:1];
@@ -168,7 +168,7 @@
TEST(VideoControlsManager, VideoControlsManagerMultipleVideosScrollPausedVideoOutOfView)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
[webView loadTestPageNamed:@"large-videos-paused-video-hides-controls"];
[webView waitForPageToLoadWithAutoplayingVideos:1];
@@ -179,7 +179,7 @@
TEST(VideoControlsManager, VideoControlsManagerMultipleVideosScrollPlayingVideoWithSoundOutOfView)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
[webView loadTestPageNamed:@"large-videos-playing-video-keeps-controls"];
[webView waitForPageToLoadWithAutoplayingVideos:1];
@@ -190,7 +190,7 @@
TEST(VideoControlsManager, VideoControlsManagerMultipleVideosScrollPlayingMutedVideoOutOfView)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
[webView loadTestPageNamed:@"large-videos-playing-muted-video-hides-controls"];
[webView waitForPageToLoadWithAutoplayingVideos:1];
@@ -201,7 +201,7 @@
TEST(VideoControlsManager, VideoControlsManagerMultipleVideosShowControlsForLastInteractedVideo)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 800, 600));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 800, 600));
NSPoint clickPoint = NSMakePoint(400, 300);
[webView loadTestPageNamed:@"large-videos-autoplaying-click-to-pause"];
@@ -228,7 +228,7 @@
// FIXME: Re-enable this test once <webkit.org/b/175909> is resolved.
TEST(VideoControlsManager, DISABLED_VideoControlsManagerMultipleVideosSwitchControlledVideoWhenScrolling)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 800, 600));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 800, 600));
[webView loadTestPageNamed:@"large-videos-autoplaying-scroll-to-video"];
[webView waitForPageToLoadWithAutoplayingVideos:2];
@@ -241,7 +241,7 @@
TEST(VideoControlsManager, VideoControlsManagerMultipleVideosScrollOnlyLargeVideoOutOfView)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
[webView loadTestPageNamed:@"large-video-playing-scroll-away"];
[webView waitForPageToLoadWithAutoplayingVideos:1];
@@ -251,7 +251,7 @@
TEST(VideoControlsManager, VideoControlsManagerSingleSmallAutoplayingVideo)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
[webView loadTestPageNamed:@"autoplaying-video-with-audio"];
[webView waitForPageToLoadWithAutoplayingVideos:1];
@@ -262,7 +262,7 @@
TEST(VideoControlsManager, VideoControlsManagerLargeAutoplayingVideoSeeksAfterEnding)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
[webView loadTestPageNamed:@"large-video-seek-after-ending"];
@@ -275,7 +275,7 @@
TEST(VideoControlsManager, VideoControlsManagerLargeAutoplayingVideoSeeksAndPlaysAfterEnding)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
// Since the video is still playing, the expectation is YES even if the video has ended once.
[webView loadTestPageNamed:@"large-video-seek-to-beginning-and-play-after-ending"];
@@ -284,7 +284,7 @@
TEST(VideoControlsManager, VideoControlsManagerLargeAutoplayingVideoAfterSeekingToEnd)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
[webView loadTestPageNamed:@"large-video-hides-controls-after-seek-to-end"];
[webView waitForPageToLoadWithAutoplayingVideos:1];
@@ -297,7 +297,7 @@
TEST(VideoControlsManager, VideoControlsManagerSingleLargeVideoWithoutAudio)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
// A large video with no audio will not have a controls manager unless it started playing because of a user gesture. Since this
// video is started with a script, the expectation is NO.
@@ -307,7 +307,7 @@
TEST(VideoControlsManager, VideoControlsManagerAudioElementStartedWithScript)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
// An audio element MUST be started with a user gesture in order to have a controls manager, so the expectation is NO.
[webView loadTestPageNamed:@"audio-only"];
@@ -316,7 +316,7 @@
TEST(VideoControlsManager, VideoControlsManagerAudioElementStartedByInteraction)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 400, 400));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 400, 400));
[webView loadTestPageNamed:@"play-audio-on-click"];
[webView waitForPageToLoadWithAutoplayingVideos:0];
@@ -329,7 +329,7 @@
TEST(VideoControlsManager, DISABLED_VideoControlsManagerAudioElementFollowingUserInteraction)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 400, 400));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 400, 400));
[webView loadTestPageNamed:@"play-audio-on-click"];
[webView waitForPageToLoadWithAutoplayingVideos:0];
@@ -354,7 +354,7 @@
TEST(VideoControlsManager, VideoControlsManagerTearsDownMediaControlsOnDealloc)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
NSURL *urlOfVideo = [[NSBundle mainBundle] URLForResource:@"video-with-audio" withExtension:@"mp4" subdirectory:@"TestWebKitAPI.resources"];
[webView loadFileURL:urlOfVideo allowingReadAccessToURL:[urlOfVideo URLByDeletingLastPathComponent]];
@@ -374,7 +374,7 @@
TEST(VideoControlsManager, VideoControlsManagerDoesNotShowMediaControlsForOffscreenVideo)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 1024, 768));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 1024, 768));
[webView loadTestPageNamed:@"large-video-offscreen"];
[webView waitForMediaControlsToHide];
@@ -382,7 +382,7 @@
TEST(VideoControlsManager, VideoControlsManagerKeepsControlsStableDuringSrcChangeOnClick)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 800, 600));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 800, 600));
[webView loadTestPageNamed:@"change-video-source-on-click"];
[webView waitForPageToLoadWithAutoplayingVideos:1];
@@ -393,7 +393,7 @@
TEST(VideoControlsManager, VideoControlsManagerKeepsControlsStableDuringSrcChangeOnEnd)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 800, 600));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 800, 600));
[webView loadTestPageNamed:@"change-video-source-on-end"];
[webView expectControlsManager:YES afterReceivingMessage:@"changed"];
@@ -401,7 +401,7 @@
TEST(VideoControlsManager, VideoControlsManagerSmallVideoInMediaDocument)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 100, 100));
__block bool finishedLoad = false;
[webView performAfterLoading:^ {
@@ -419,7 +419,7 @@
TEST(VideoControlsManager, VideoControlsManagerOffscreenIframeMediaDocument)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 800, 600));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 800, 600));
[webView loadTestPageNamed:@"offscreen-iframe-of-media-document"];
// We do not expect a controls manager becuase the media document is in an iframe.
@@ -428,7 +428,7 @@
TEST(VideoControlsManager, VideoControlsManagerLongSkinnyVideoInWideMainFrame)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 1600, 800));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 1600, 800));
[webView loadTestPageNamed:@"skinny-autoplaying-video-with-audio"];
[webView expectControlsManager:NO afterReceivingMessage:@"playing"];
@@ -436,7 +436,7 @@
TEST(VideoControlsManager, VideoControlsManagerWideMediumSizedVideoInWideMainFrame)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 1600, 800));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 1600, 800));
[webView loadTestPageNamed:@"wide-autoplaying-video-with-audio"];
[webView expectControlsManager:YES afterReceivingMessage:@"playing"];
@@ -444,7 +444,7 @@
TEST(VideoControlsManager, VideoControlsManagerFullSizeVideoInWideMainFrame)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 1600, 800));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 1600, 800));
[webView loadTestPageNamed:@"full-size-autoplaying-video-with-audio"];
[webView expectControlsManager:YES afterReceivingMessage:@"playing"];
@@ -452,7 +452,7 @@
TEST(VideoControlsManager, VideoControlsManagerVideoMutesOnPlaying)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
[webView loadTestPageNamed:@"large-video-mutes-onplaying"];
[webView expectControlsManager:NO afterReceivingMessage:@"playing"];
@@ -460,7 +460,7 @@
TEST(VideoControlsManager, VideoControlsManagerPageWithEnormousVideo)
{
- RetainPtr<VideoControlsManagerTestWebView*> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
+ RetainPtr<VideoControlsManagerTestWebView> webView = setUpWebViewForTestingVideoControlsManager(NSMakeRect(0, 0, 500, 500));
[webView loadTestPageNamed:@"enormous-video-with-sound"];
[webView expectControlsManager:NO afterReceivingMessage:@"playing"];
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm (239708 => 239709)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -908,7 +908,7 @@
static unsigned loadCount;
@interface DataMappingSchemeHandler : NSObject <WKURLSchemeHandler> {
- HashMap<String, RetainPtr<NSData *>> _dataMappings;
+ HashMap<String, RetainPtr<NSData>> _dataMappings;
Function<void(id <WKURLSchemeTask>)> _taskHandler;
}
- (void)addMappingFromURLString:(NSString *)urlString toData:(const char*)data;
Modified: trunk/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm (239708 => 239709)
--- trunk/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -297,8 +297,8 @@
RetainPtr<MockDropSession> _dropSession;
RetainPtr<NSMutableArray> _observedEventNames;
RetainPtr<NSArray> _externalItemProviders;
- RetainPtr<NSArray *> _sourceItemProviders;
- RetainPtr<NSArray *> _finalSelectionRects;
+ RetainPtr<NSArray> _sourceItemProviders;
+ RetainPtr<NSArray> _finalSelectionRects;
CGPoint _startLocation;
CGPoint _endLocation;
CGRect _lastKnownDragCaretRect;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm (239708 => 239709)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -47,7 +47,7 @@
static NSURL *resourcesDirectoryURL()
{
- static NeverDestroyed<RetainPtr<NSURL *>> resourcesDirectory([[NSBundle bundleForClass:[WKTRFontActivatorDummyClass class]] resourceURL]);
+ static NeverDestroyed<RetainPtr<NSURL>> resourcesDirectory([[NSBundle bundleForClass:[WKTRFontActivatorDummyClass class]] resourceURL]);
return resourcesDirectory.get().get();
}
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm (239708 => 239709)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -37,7 +37,7 @@
// Language was set up earlier in main(). Don't clobber it.
NSArray *languages = [[[NSUserDefaults standardUserDefaults] volatileDomainForName:NSArgumentDomain] valueForKey:@"AppleLanguages"];
- RetainPtr<NSMutableDictionary *> dict = adoptNS([[NSMutableDictionary alloc] init]);
+ RetainPtr<NSMutableDictionary> dict = adoptNS([[NSMutableDictionary alloc] init]);
if (languages)
[dict setObject:languages forKey:@"AppleLanguages"];
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm (239708 => 239709)
--- trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm 2019-01-07 23:49:33 UTC (rev 239708)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm 2019-01-08 00:03:09 UTC (rev 239709)
@@ -48,7 +48,7 @@
#if WK_API_ENABLED
@interface TestRunnerWKWebView () <WKUIDelegatePrivate> {
- RetainPtr<NSNumber *> m_stableStateOverride;
+ RetainPtr<NSNumber> m_stableStateOverride;
BOOL m_isInteractingWithFormControl;
}