Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jan 2019 00:03:09 +0000 (00:03 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jan 2019 00:03:09 +0000 (00:03 +0000)
commitf8c869de2a1765a6980ac64f9909fd899e88c130
treeec9d0a6f7d5ff95d071d3664f50e38837a0dce14
parent13e9ac3ce6b9ea09d265bd4b7e3662ba4bab73bf
Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
<https://webkit.org/b/193056>

Reviewed by Alex Christensen.

Source/WebCore:

* 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.

Source/WebKit:

* 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.

Source/WebKitLegacy/mac:

* 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.

Source/WTF:

* 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.

Tools:

* 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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239709 268f45cc-cd09-0410-ab3c-d52691b4dbfc
42 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/RetainPtr.h
Source/WTF/wtf/SchedulePair.h
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
Source/WebCore/platform/network/cf/AuthenticationChallenge.h
Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm
Source/WebKit/ChangeLog
Source/WebKit/Shared/EntryPointUtilities/mac/XPCService/XPCServiceMain.mm
Source/WebKit/UIProcess/API/Cocoa/_WKThumbnailView.mm
Source/WebKit/UIProcess/ApplePay/WebPaymentCoordinatorProxy.h
Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h
Source/WebKit/UIProcess/Plugins/PluginProcessProxy.h
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginHostProxy.h
Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.h
Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
Source/WebKitLegacy/mac/Plugins/Hosted/ProxyInstance.mm
Source/WebKitLegacy/mac/WebCoreSupport/WebGeolocationClient.mm
Source/WebKitLegacy/mac/WebView/WebDataSource.mm
Source/WebKitLegacy/mac/WebView/WebView.mm
Tools/ChangeLog
Tools/Scripts/webkitpy/style/checker.py
Tools/Scripts/webkitpy/style/checkers/cpp.py
Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
Tools/TestRunnerShared/EventSerialization/mac/EventSerializerMac.h
Tools/TestWebKitAPI/EditingTestHarness.h
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WTF/cf/RetainPtr.cpp
Tools/TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/IconLoadingDelegate.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/JITEnabled.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/VideoControlsManager.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm
Tools/TestWebKitAPI/ios/DragAndDropSimulatorIOS.mm
Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm
Tools/WebKitTestRunner/InjectedBundle/ios/InjectedBundleIOS.mm
Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm