WebKit Bugzilla
Attachment 341954 Details for
Bug 186300
: [Cocoa] Improve smart pointer support for ARC (OSObjectPtr/DispatchPtr)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186300-20180604224128.patch (text/plain), 5.58 KB, created by
Darin Adler
on 2018-06-04 22:41:29 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-06-04 22:41:29 PDT
Size:
5.58 KB
patch
obsolete
>Subversion Revision: 232503 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 81d2c51125e4eb892900d7390c1ca3cf2bd83317..80cf369b870efce9d485cc2e396a67728f9c4b58 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,18 @@ >+2018-06-04 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Improve smart pointer support for ARC (OSObjectPtr/DispatchPtr) >+ https://bugs.webkit.org/show_bug.cgi?id=186300 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/DispatchPtr.h: Don't call dispatch_retain or dispatch_release >+ since ARC will automatically do it for us in the same places we are >+ doing it here. >+ >+ * wtf/OSObjectPtr.h: >+ (WTF::retainOSObject): Don't call os_retain since ARC will do it. >+ (WTF::releaseOSObject): Don't call os_release since ARC will do it. >+ > 2018-05-31 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r232212. >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8bd67f23582eafde95c57214f88fca7aac7c3cd9..bd7a772c5091a6039fbeac21b19951186567a505 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,14 @@ >+2018-06-04 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Improve smart pointer support for ARC (OSObjectPtr/DispatchPtr) >+ https://bugs.webkit.org/show_bug.cgi?id=186300 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: Removed unnecessary >+ include of OSObjectPtr.h. >+ * platform/ios/WebItemProviderPasteboard.mm: Ditto. >+ > 2018-06-03 Darin Adler <darin@apple.com> > > [Cocoa] Update more code to be more ARC-compatible to prepare for future ARC adoption >diff --git a/Source/WTF/wtf/DispatchPtr.h b/Source/WTF/wtf/DispatchPtr.h >index fb42865d84c435115cf2ad3d0b81e94a1ebd7644..6703ee835db1e503a2b12e87ae6af92148de084d 100644 >--- a/Source/WTF/wtf/DispatchPtr.h >+++ b/Source/WTF/wtf/DispatchPtr.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2015-2017 Apple Inc. All rights reserved. >+ * Copyright (C) 2015-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 >@@ -45,19 +45,26 @@ public: > explicit DispatchPtr(T ptr) > : m_ptr(ptr) > { >+#if !(defined(__OBJC__) && __has_feature(objc_arc)) > if (m_ptr) > dispatch_retain(m_ptr); >+#endif > } > DispatchPtr(const DispatchPtr& other) > : m_ptr(other.m_ptr) > { >+#if !(defined(__OBJC__) && __has_feature(objc_arc)) > if (m_ptr) > dispatch_retain(m_ptr); >+ >+#endif > } > ~DispatchPtr() > { >+#if !(defined(__OBJC__) && __has_feature(objc_arc)) > if (m_ptr) > dispatch_release(m_ptr); >+#endif > } > > DispatchPtr& operator=(const DispatchPtr& other) >@@ -69,9 +76,13 @@ public: > > DispatchPtr& operator=(std::nullptr_t) > { >+#if defined(__OBJC__) && __has_feature(objc_arc) >+ m_ptr = nullptr; >+#else > auto ptr = std::exchange(m_ptr, nullptr); > if (LIKELY(ptr != nullptr)) > dispatch_release(ptr); >+#endif > return *this; > } > >diff --git a/Source/WTF/wtf/OSObjectPtr.h b/Source/WTF/wtf/OSObjectPtr.h >index ed7eceb92c4d445767cff2379b1ab9539f38692b..721994875ed30011ea3c4b9f0b6b634ce22e6b4c 100644 >--- a/Source/WTF/wtf/OSObjectPtr.h >+++ b/Source/WTF/wtf/OSObjectPtr.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2014 Apple Inc. All rights reserved. >+ * Copyright (C) 2014-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 >@@ -23,8 +23,7 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef OSObjectPtr_h >-#define OSObjectPtr_h >+#pragma once > > #include <os/object.h> > #include <wtf/Assertions.h> >@@ -38,13 +37,21 @@ template<typename T> OSObjectPtr<T> adoptOSObject(T); > template<typename T> > static inline void retainOSObject(T ptr) > { >+#if defined(__OBJC__) && __has_feature(objc_arc) >+ UNUSED_PARAM(ptr); >+#else > os_retain(ptr); >+#endif > } > > template<typename T> > static inline void releaseOSObject(T ptr) > { >+#if defined(__OBJC__) && __has_feature(objc_arc) >+ UNUSED_PARAM(ptr); >+#else > os_release(ptr); >+#endif > } > > template<typename T> class OSObjectPtr { >@@ -132,5 +139,3 @@ template<typename T> inline OSObjectPtr<T> adoptOSObject(T ptr) > > using WTF::OSObjectPtr; > using WTF::adoptOSObject; >- >-#endif // OSObjectPtr_h >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >index b3b6bb516daea9b91a600c30165e2a62acce2d29..683c5c4b8a0f73482095c4b28025624998f077e7 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >@@ -51,7 +51,6 @@ > #import <wtf/MainThread.h> > #import <wtf/MediaTime.h> > #import <wtf/NeverDestroyed.h> >-#import <wtf/OSObjectPtr.h> > #import <wtf/SoftLinking.h> > #import <wtf/Vector.h> > >diff --git a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm b/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm >index 332dead624f5dbf56d1fd371871fa909efdd68de..f0c0b1e5107a7a2056e68b2708871e72662ceb2d 100644 >--- a/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm >+++ b/Source/WebCore/platform/ios/WebItemProviderPasteboard.mm >@@ -38,7 +38,6 @@ > #import <WebCore/Pasteboard.h> > #import <pal/spi/ios/UIKitSPI.h> > #import <wtf/BlockPtr.h> >-#import <wtf/OSObjectPtr.h> > #import <wtf/RetainPtr.h> > #import <wtf/SoftLinking.h> >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dbates
:
review+
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186300
: 341954 |
341959