WebKit Bugzilla
Attachment 342292 Details for
Bug 186436
: [Cocoa] Remove all uses of NSAutoreleasePool as part of preparation for ARC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186436-20180608104122.patch (text/plain), 31.34 KB, created by
Darin Adler
on 2018-06-08 10:41:23 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-06-08 10:41:23 PDT
Size:
31.34 KB
patch
obsolete
>Subversion Revision: 232626 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 9bbd049c3b5ba08b27a6c0dc7105c0ee2b017463..1aab482fe3f30b284cf2d49f91aff08f211a2e13 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,22 @@ >+2018-06-08 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Remove all uses of NSAutoreleasePool as part of preparation for ARC >+ https://bugs.webkit.org/show_bug.cgi?id=186436 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WTF.xcodeproj/project.pbxproj: Added FoundationSPI.h >+ >+ * wtf/AutodrainedPool.h: Streamlined header a bit and added some comments. >+ * wtf/AutodrainedPoolMac.mm: >+ (WTF::AutodrainedPool::AutodrainedPool): Use NSPush/PopAutoreleasePool instead of >+ the NSAutoreleasePool class. >+ (WTF::AutodrainedPool::~AutodrainedPool): Ditto. >+ >+ * wtf/PlatformMac.cmake: Added FoundationSPI.h. >+ >+ * wtf/spi/cocoa/FoundationSPI.h: Moved from Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h. >+ > 2018-06-07 Yusuke Suzuki <utatane.tea@gmail.com> > > [WTF] Add WorkerPool >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 797f176a1ec5e1ad83bae1adff30d5dc5caa6b7c..d1fb6eb89d713950170c3c8eeb58cefcc857b996 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,28 @@ >+2018-06-08 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Remove all uses of NSAutoreleasePool as part of preparation for ARC >+ https://bugs.webkit.org/show_bug.cgi?id=186436 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * bridge/objc/objc_class.mm: Use import instead of include. >+ >+ * bridge/objc/objc_instance.h: Replaced _pool member to hold an object with >+ m_autoreleasePool member to hold a token from NSPushAutoreleasePool. Also >+ initialize all data members here in the class definition. >+ >+ * bridge/objc/objc_instance.mm: >+ (ObjcInstance::ObjcInstance): Moved most initialization to class definition. >+ (ObjcInstance::virtualBegin): Use NSPushAutoreleasePool instead of >+ NSAutoreleasePool class. >+ (ObjcInstance::virtualEnd): Use NSPopAutoreleasePool. >+ >+ * bridge/objc/objc_runtime.mm: Use import instead of include. >+ * bridge/objc/objc_utility.mm: Ditto. >+ >+ * platform/ios/wak/WebCoreThread.mm: Re-sorted includes. Removed declaration of >+ autorelease pool SPI and use FoundationSPI.h instead. >+ > 2018-06-08 Zalan Bujtas <zalan@apple.com> > > [LFC] Add vertical margin computation for inline, block-level, inline-block and floating replaced elements >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index 316b921f198ef53887e994da6d04fbdbb16a9837..de80f92c133235e7e219e29a01528c0ae078c459 100644 >--- a/Source/WebCore/PAL/ChangeLog >+++ b/Source/WebCore/PAL/ChangeLog >@@ -1,3 +1,14 @@ >+2018-06-08 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Remove all uses of NSAutoreleasePool as part of preparation for ARC >+ https://bugs.webkit.org/show_bug.cgi?id=186436 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * PAL.xcodeproj/project.pbxproj: Removed FoundationSPI.h. >+ * pal/PlatformMac.cmake: Ditto. >+ * pal/spi/cocoa/FoundationSPI.h: Moved into WTF project. >+ > 2018-06-07 Chris Dumez <cdumez@apple.com> > > Add base class to get WeakPtrFactory member and avoid some boilerplate code >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index f4c59494cbf1a3b6eeda8cda5bd787c9538f4370..f29dee5e359f03c956ca829cda56fff22d0e97be 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,22 @@ >+2018-06-08 Darin Adler <darin@apple.com> >+ >+ [Cocoa] Remove all uses of NSAutoreleasePool as part of preparation for ARC >+ https://bugs.webkit.org/show_bug.cgi?id=186436 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Carbon/CarbonUtils.m: Updated include location of FoundationSPI.h. >+ (WebInitForCarbon): Use NSPush/PopAutoreleasePool instead of NSAutoreleasePool object. >+ (PoolCleaner): Ditto. >+ >+ * History/WebHistory.mm: >+ (-[WebHistoryPrivate loadHistoryGutsFromURL:savedItemsCount:collectDiscardedItemsInto:error:]): >+ Use NSPush/PopAutoreleasePool instead of NSAutoreleasePool object. Also added comment >+ about possibly switching to @autoreleasepool and switched from NSEnumerator to a modern >+ for loop. >+ * WebView/WebView.mm: >+ (-[WebView rectsForTextMatches]): Ditto. >+ > 2018-06-07 Chris Dumez <cdumez@apple.com> > > Add base class to get WeakPtrFactory member and avoid some boilerplate code >diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj >index fb2ee7e1a089734412487580f8dfbc20973ca70b..764cc396839ae1fa7df34e98e092948c4812b721 100644 >--- a/Source/WTF/WTF.xcodeproj/project.pbxproj >+++ b/Source/WTF/WTF.xcodeproj/project.pbxproj >@@ -408,6 +408,7 @@ > 93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringViewObjC.mm; path = mac/StringViewObjC.mm; sourceTree = "<group>"; }; > 93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringViewCF.cpp; path = cf/StringViewCF.cpp; sourceTree = "<group>"; }; > 93AC91A718942FC400244939 /* LChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LChar.h; sourceTree = "<group>"; }; >+ 93D191CF20CAECE800C51B8E /* FoundationSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FoundationSPI.h; sourceTree = "<group>"; }; > 93DDE9311CDC052D00FD3491 /* dyldSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dyldSPI.h; sourceTree = "<group>"; }; > 93F1993D19D7958D00C2390B /* StringView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringView.cpp; sourceTree = "<group>"; }; > 974CFC8D16A4F327006D5404 /* WeakPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakPtr.h; sourceTree = "<group>"; }; >@@ -1269,6 +1270,7 @@ > CE46516C19DB1FB4003ECA05 /* cocoa */ = { > isa = PBXGroup; > children = ( >+ 93D191CF20CAECE800C51B8E /* FoundationSPI.h */, > CE46516D19DB1FB4003ECA05 /* NSMapTableSPI.h */, > A5098B011C16A4F900087797 /* SecuritySPI.h */, > ); >diff --git a/Source/WTF/wtf/AutodrainedPool.h b/Source/WTF/wtf/AutodrainedPool.h >index 6f02c5df4dee7ed3ef3f9698b459099b772a8c94..6c2019132ab616e95b7b3c2ceef6c09a9fb71e3a 100644 >--- a/Source/WTF/wtf/AutodrainedPool.h >+++ b/Source/WTF/wtf/AutodrainedPool.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2007, 2013 Apple Inc. All rights reserved. >+ * Copyright (C) 2007-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 >@@ -26,36 +26,29 @@ > * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef AutodrainedPool_h >-#define AutodrainedPool_h >+#pragma once > > #include <wtf/Noncopyable.h> > >-#if USE(FOUNDATION) && !defined(__OBJC__) >-typedef struct objc_object *id; >-#endif >- > namespace WTF { > >+// This class allows non-Objective-C C++ code to create an autorelease pool. >+// It should not be used in Objective-C++ code; instead @autoreleasepool should be used. >+// It can be used in cross-platform code; will compile down to nothing for non-Cocoa platforms. >+ > class AutodrainedPool { > WTF_MAKE_NONCOPYABLE(AutodrainedPool); >-public: >+ > #if USE(FOUNDATION) >+public: > WTF_EXPORT_PRIVATE AutodrainedPool(); > WTF_EXPORT_PRIVATE ~AutodrainedPool(); >-#else >- explicit AutodrainedPool() { } >- ~AutodrainedPool() { } >-#endif >- >+ > private: >-#if USE(FOUNDATION) >- id m_pool; >+ void* m_pool; > #endif > }; > > } // namespace WTF > > using WTF::AutodrainedPool; >- >-#endif >diff --git a/Source/WTF/wtf/AutodrainedPoolMac.mm b/Source/WTF/wtf/AutodrainedPoolMac.mm >index f0a75d2e2bf65674bc434fe93a63db97dd4a1bee..02a15190cc0be884e1a99e8ca695a399e810edce 100644 >--- a/Source/WTF/wtf/AutodrainedPoolMac.mm >+++ b/Source/WTF/wtf/AutodrainedPoolMac.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2007, 2013 Apple Inc. All rights reserved. >+ * Copyright (C) 2007-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,18 +29,18 @@ > #import "config.h" > #import "AutodrainedPool.h" > >-#import <Foundation/Foundation.h> >+#import <wtf/spi/cocoa/FoundationSPI.h> > > namespace WTF { > > AutodrainedPool::AutodrainedPool() >- : m_pool([[NSAutoreleasePool alloc] init]) >+ : m_pool(NSPushAutoreleasePool(0)) > { > } > > AutodrainedPool::~AutodrainedPool() > { >- [m_pool drain]; >+ NSPopAutoreleasePool(m_pool); > } > > } // namespace WTF >diff --git a/Source/WTF/wtf/PlatformMac.cmake b/Source/WTF/wtf/PlatformMac.cmake >index a26e0503e5f35e994f2c39b3991f3d8ce644b356..3e7a11dd72e61448c28604aac305f20ba1a43cf2 100644 >--- a/Source/WTF/wtf/PlatformMac.cmake >+++ b/Source/WTF/wtf/PlatformMac.cmake >@@ -21,6 +21,7 @@ list(APPEND WTF_PUBLIC_HEADERS > spi/cf/CFBundleSPI.h > spi/cf/CFStringSPI.h > >+ spi/cocoa/FoundationSPI.h > spi/cocoa/NSMapTableSPI.h > spi/cocoa/SecuritySPI.h > >diff --git a/Source/WTF/wtf/spi/cocoa/FoundationSPI.h b/Source/WTF/wtf/spi/cocoa/FoundationSPI.h >new file mode 100644 >index 0000000000000000000000000000000000000000..684175d12b9e3c7bdf26d2ebb530368ea77eee0f >--- /dev/null >+++ b/Source/WTF/wtf/spi/cocoa/FoundationSPI.h >@@ -0,0 +1,41 @@ >+/* >+ * Copyright (C) 2017 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if USE(APPLE_INTERNAL_SDK) >+ >+#include <Foundation/NSPrivateDecls.h> >+ >+#endif >+ >+typedef void* NSAutoreleasePoolMark; >+ >+WTF_EXTERN_C_BEGIN >+ >+NSAutoreleasePoolMark NSPushAutoreleasePool(NSUInteger capacity); >+void NSPopAutoreleasePool(NSAutoreleasePoolMark); >+ >+WTF_EXTERN_C_END >diff --git a/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj b/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj >index e43e1b89e630a212ab863f231cfab97f09a84b89..c6f7c9e47e14767142a25d21ac0cfdf6e723bbb2 100644 >--- a/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj >+++ b/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj >@@ -111,7 +111,6 @@ > 570AB8F920AF6E3D00B8BE87 /* NSXPCConnectionSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F820AF6E3D00B8BE87 /* NSXPCConnectionSPI.h */; }; > 57F12518205787D7001AB8A6 /* DeviceIdentitySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 57F12517205787C8001AB8A6 /* DeviceIdentitySPI.h */; }; > 7A1656441F97B2B900BA3CE4 /* NSKeyedArchiverSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */; }; >- A10265871F56746100B4C844 /* FoundationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10265861F56746100B4C844 /* FoundationSPI.h */; }; > A10265891F56747A00B4C844 /* HIToolboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10265881F56747A00B4C844 /* HIToolboxSPI.h */; }; > A102658B1F56748C00B4C844 /* QuickDrawSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A102658A1F56748C00B4C844 /* QuickDrawSPI.h */; }; > A102658E1F567E9D00B4C844 /* HIServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A102658D1F567E9D00B4C844 /* HIServicesSPI.h */; }; >@@ -259,7 +258,6 @@ > 57F12517205787C8001AB8A6 /* DeviceIdentitySPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceIdentitySPI.h; sourceTree = "<group>"; }; > 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSKeyedArchiverSPI.h; sourceTree = "<group>"; }; > 93E5909C1F93BF1E0067F8CF /* UnencodableHandling.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UnencodableHandling.h; sourceTree = "<group>"; }; >- A10265861F56746100B4C844 /* FoundationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FoundationSPI.h; sourceTree = "<group>"; }; > A10265881F56747A00B4C844 /* HIToolboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HIToolboxSPI.h; sourceTree = "<group>"; }; > A102658A1F56748C00B4C844 /* QuickDrawSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickDrawSPI.h; sourceTree = "<group>"; }; > A102658D1F567E9D00B4C844 /* HIServicesSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HIServicesSPI.h; sourceTree = "<group>"; }; >@@ -362,7 +360,6 @@ > 0C2DA1241F3BEB4900DBC317 /* CoreTextSPI.h */, > 0C2DA1251F3BEB4900DBC317 /* DataDetectorsCoreSPI.h */, > 57F12517205787C8001AB8A6 /* DeviceIdentitySPI.h */, >- A10265861F56746100B4C844 /* FoundationSPI.h */, > 0C2DA1261F3BEB4900DBC317 /* IOPMLibSPI.h */, > 0C2DA1271F3BEB4900DBC317 /* IOPSLibSPI.h */, > 0C2DA1281F3BEB4900DBC317 /* IOReturnSPI.h */, >@@ -636,7 +633,6 @@ > 57F12518205787D7001AB8A6 /* DeviceIdentitySPI.h in Headers */, > 0C2D9E731EEF5AF600DBC317 /* ExportMacros.h in Headers */, > F44291601FA5261E002CC93E /* FileSizeFormatter.h in Headers */, >- A10265871F56746100B4C844 /* FoundationSPI.h in Headers */, > 0C5AF91B1F43A4C7002EAC02 /* GraphicsServicesSPI.h in Headers */, > A102658E1F567E9D00B4C844 /* HIServicesSPI.h in Headers */, > A10265891F56747A00B4C844 /* HIToolboxSPI.h in Headers */, >diff --git a/Source/WebCore/PAL/pal/PlatformMac.cmake b/Source/WebCore/PAL/pal/PlatformMac.cmake >index 7e382d88e241eec690c5c5e92da3982446578192..b2acfbb13979a10073cbdb3495c0289bf5d23dd0 100644 >--- a/Source/WebCore/PAL/pal/PlatformMac.cmake >+++ b/Source/WebCore/PAL/pal/PlatformMac.cmake >@@ -17,7 +17,6 @@ list(APPEND PAL_PUBLIC_HEADERS > spi/cocoa/CFNSURLConnectionSPI.h > spi/cocoa/CoreTextSPI.h > spi/cocoa/DataDetectorsCoreSPI.h >- spi/cocoa/FoundationSPI.h > spi/cocoa/IOPMLibSPI.h > spi/cocoa/IOPSLibSPI.h > spi/cocoa/IOReturnSPI.h >diff --git a/Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h b/Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h >deleted file mode 100644 >index 684175d12b9e3c7bdf26d2ebb530368ea77eee0f..0000000000000000000000000000000000000000 >--- a/Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h >+++ /dev/null >@@ -1,41 +0,0 @@ >-/* >- * Copyright (C) 2017 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if USE(APPLE_INTERNAL_SDK) >- >-#include <Foundation/NSPrivateDecls.h> >- >-#endif >- >-typedef void* NSAutoreleasePoolMark; >- >-WTF_EXTERN_C_BEGIN >- >-NSAutoreleasePoolMark NSPushAutoreleasePool(NSUInteger capacity); >-void NSPopAutoreleasePool(NSAutoreleasePoolMark); >- >-WTF_EXTERN_C_END >diff --git a/Source/WebCore/bridge/objc/objc_class.mm b/Source/WebCore/bridge/objc/objc_class.mm >index ca4a6c2dec5b82b406adfed11209310b6683a6df..ce1ef6557a0763a7d3430a3bf986a1987f8cb356 100644 >--- a/Source/WebCore/bridge/objc/objc_class.mm >+++ b/Source/WebCore/bridge/objc/objc_class.mm >@@ -23,12 +23,12 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#include "config.h" >-#include "objc_class.h" >+#import "config.h" >+#import "objc_class.h" > >-#include "objc_instance.h" >-#include "WebScriptObject.h" >-#include "WebScriptObjectProtocol.h" >+#import "WebScriptObject.h" >+#import "WebScriptObjectProtocol.h" >+#import "objc_instance.h" > > namespace JSC { > namespace Bindings { >diff --git a/Source/WebCore/bridge/objc/objc_instance.h b/Source/WebCore/bridge/objc/objc_instance.h >index 993a6f571e63bfcdecbb4f94d3d05e87d8f24e3f..5f285e91b8df5d515e5560d44965da6404154eb4 100644 >--- a/Source/WebCore/bridge/objc/objc_instance.h >+++ b/Source/WebCore/bridge/objc/objc_instance.h >@@ -23,11 +23,8 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef BINDINGS_OBJC_INSTANCE_H_ >-#define BINDINGS_OBJC_INSTANCE_H_ >- >-#include "objc_class.h" >-#include "objc_utility.h" >+#import "objc_class.h" >+#import "objc_utility.h" > > namespace JSC { > >@@ -75,13 +72,11 @@ private: > virtual RuntimeObject* newRuntimeObject(ExecState*); > > RetainPtr<ObjectStructPtr> _instance; >- mutable ObjcClass *_class; >- ObjectStructPtr _pool; >- int _beginCount; >+ mutable ObjcClass* _class { nullptr }; >+ void* m_autoreleasePool { nullptr }; >+ int _beginCount { 0 }; > }; > > } // namespace Bindings > > } // namespace JSC >- >-#endif // BINDINGS_OBJC_INSTANCE_H_ >diff --git a/Source/WebCore/bridge/objc/objc_instance.mm b/Source/WebCore/bridge/objc/objc_instance.mm >index 68e57312dac0a7aa943583c89818e8e8a36f0317..b1221c0e12cd7ac86c5a0a4c7c14cb8057910628 100644 >--- a/Source/WebCore/bridge/objc/objc_instance.mm >+++ b/Source/WebCore/bridge/objc/objc_instance.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2004, 2008-2009, 2013, 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2004-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 >@@ -40,6 +40,7 @@ > #import <wtf/MainThread.h> > #import <wtf/NeverDestroyed.h> > #import <wtf/ThreadSpecific.h> >+#import <wtf/spi/cocoa/FoundationSPI.h> > > #ifdef NDEBUG > #define OBJC_LOG(formatAndArgs...) ((void)0) >@@ -100,9 +101,6 @@ void ObjcInstance::moveGlobalExceptionToExecState(ExecState* exec) > ObjcInstance::ObjcInstance(id instance, RefPtr<RootObject>&& rootObject) > : Instance(WTFMove(rootObject)) > , _instance(instance) >- , _class(0) >- , _pool(0) >- , _beginCount(0) > { > } > >@@ -133,8 +131,8 @@ ObjcInstance::~ObjcInstance() > > void ObjcInstance::virtualBegin() > { >- if (!_pool) >- _pool = [[NSAutoreleasePool alloc] init]; >+ if (!m_autoreleasePool) >+ m_autoreleasePool = NSPushAutoreleasePool(0); > _beginCount++; > } > >@@ -143,8 +141,9 @@ void ObjcInstance::virtualEnd() > _beginCount--; > ASSERT(_beginCount >= 0); > if (!_beginCount) { >- [_pool drain]; >- _pool = 0; >+ ASSERT(m_autoreleasePool); >+ NSPopAutoreleasePool(m_autoreleasePool); >+ m_autoreleasePool = nullptr; > } > } > >@@ -507,13 +506,11 @@ JSC::JSValue ObjcInstance::stringValue(ExecState* exec) const > > JSC::JSValue ObjcInstance::numberValue(ExecState*) const > { >- // FIXME: Implement something sensible > return jsNumber(0); > } > > JSC::JSValue ObjcInstance::booleanValue() const > { >- // FIXME: Implement something sensible > return jsBoolean(false); > } > >diff --git a/Source/WebCore/bridge/objc/objc_runtime.mm b/Source/WebCore/bridge/objc/objc_runtime.mm >index 87d0387a69a7537d2f9ed6bd6c5322b472501f1e..e7b1bdbebbf95d64c88f2f2bc1cf6a15112e2457 100644 >--- a/Source/WebCore/bridge/objc/objc_runtime.mm >+++ b/Source/WebCore/bridge/objc/objc_runtime.mm >@@ -23,20 +23,20 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#include "config.h" >-#include "objc_runtime.h" >- >-#include "JSDOMBinding.h" >-#include "ObjCRuntimeObject.h" >-#include "WebScriptObject.h" >-#include "WebScriptObjectProtocol.h" >-#include "objc_instance.h" >-#include "runtime_array.h" >-#include "runtime_object.h" >-#include <JavaScriptCore/Error.h> >-#include <JavaScriptCore/JSGlobalObject.h> >-#include <JavaScriptCore/JSLock.h> >-#include <wtf/RetainPtr.h> >+#import "config.h" >+#import "objc_runtime.h" >+ >+#import "JSDOMBinding.h" >+#import "ObjCRuntimeObject.h" >+#import "WebScriptObject.h" >+#import "WebScriptObjectProtocol.h" >+#import "objc_instance.h" >+#import "runtime_array.h" >+#import "runtime_object.h" >+#import <JavaScriptCore/Error.h> >+#import <JavaScriptCore/JSGlobalObject.h> >+#import <JavaScriptCore/JSLock.h> >+#import <wtf/RetainPtr.h> > > using namespace WebCore; > >diff --git a/Source/WebCore/bridge/objc/objc_utility.mm b/Source/WebCore/bridge/objc/objc_utility.mm >index 12d052d224894c3c7bbc9a67f275bbe68d348ce6..197043ff51daf4cb0956c8e58a4508c96a81dc3c 100644 >--- a/Source/WebCore/bridge/objc/objc_utility.mm >+++ b/Source/WebCore/bridge/objc/objc_utility.mm >@@ -23,16 +23,16 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#include "config.h" >-#include "objc_utility.h" >+#import "config.h" >+#import "objc_utility.h" > >-#include "WebScriptObjectProtocol.h" >-#include "objc_instance.h" >-#include "runtime_array.h" >-#include "runtime_object.h" >-#include <JavaScriptCore/JSGlobalObject.h> >-#include <JavaScriptCore/JSLock.h> >-#include <wtf/Assertions.h> >+#import "WebScriptObjectProtocol.h" >+#import "objc_instance.h" >+#import "runtime_array.h" >+#import "runtime_object.h" >+#import <JavaScriptCore/JSGlobalObject.h> >+#import <JavaScriptCore/JSLock.h> >+#import <wtf/Assertions.h> > > #if !defined(_C_LNG_LNG) > #define _C_LNG_LNG 'q' >diff --git a/Source/WebCore/platform/ios/wak/WebCoreThread.mm b/Source/WebCore/platform/ios/wak/WebCoreThread.mm >index 4a92bc6853b626e88fcf245e24f9bd7a267791fe..0a2c6e5a67b42fb80337956a6c80cf52807fd3c1 100644 >--- a/Source/WebCore/platform/ios/wak/WebCoreThread.mm >+++ b/Source/WebCore/platform/ios/wak/WebCoreThread.mm >@@ -34,24 +34,23 @@ > #import "RuntimeApplicationChecks.h" > #import "ThreadGlobalData.h" > #import "WAKWindow.h" >+#import "WKUtilities.h" > #import "WebCoreThreadInternal.h" > #import "WebCoreThreadMessage.h" > #import "WebCoreThreadRun.h" >-#import "WKUtilities.h" >- >+#import <Foundation/NSInvocation.h> > #import <JavaScriptCore/InitializeThreading.h> > #import <JavaScriptCore/JSLock.h> >+#import <libkern/OSAtomic.h> >+#import <objc/runtime.h> > #import <wtf/Assertions.h> > #import <wtf/MainThread.h> > #import <wtf/RecursiveLockAdapter.h> > #import <wtf/RunLoop.h> > #import <wtf/Threading.h> >+#import <wtf/spi/cocoa/FoundationSPI.h> > #import <wtf/text/AtomicString.h> > >-#import <Foundation/NSInvocation.h> >-#import <libkern/OSAtomic.h> >-#import <objc/runtime.h> >- > #define LOG_MESSAGES 0 > #define LOG_WEB_LOCK 0 > #define LOG_MAIN_THREAD_LOCKING 0 >@@ -82,16 +81,6 @@ - (void)releaseOnMainThread { > > @end > >-using NSAutoreleasePoolMark = void*; >-#ifdef __cplusplus >-extern "C" { >-#endif >-extern NSAutoreleasePoolMark NSPushAutoreleasePool(unsigned ignored); >-extern void NSPopAutoreleasePool(NSAutoreleasePoolMark token); >-#ifdef __cplusplus >-} >-#endif >- > static RecursiveLock webLock; > static Lock webThreadReleaseLock; > static RecursiveLock webCoreReleaseLock; >diff --git a/Source/WebKitLegacy/mac/Carbon/CarbonUtils.m b/Source/WebKitLegacy/mac/Carbon/CarbonUtils.m >index af197c7379911f8bbf07b227998435934c256839..c12f0353c4ddc4ba0713ab03d3f242260df9fff9 100644 >--- a/Source/WebKitLegacy/mac/Carbon/CarbonUtils.m >+++ b/Source/WebKitLegacy/mac/Carbon/CarbonUtils.m >@@ -29,13 +29,13 @@ > #ifndef __LP64__ > > #include "CarbonUtils.h" >-#import <pal/spi/cocoa/FoundationSPI.h> >+#import <wtf/spi/cocoa/FoundationSPI.h> > > extern CGImageRef _NSCreateImageRef( unsigned char *const bitmapData[5], int pixelsWide, int pixelsHigh, int bitsPerSample, int samplesPerPixel, int bitsPerPixel, int bytesPerRow, BOOL isPlanar, BOOL hasAlpha, NSString *colorSpaceName, CGColorSpaceRef customColorSpace, id sourceObj); > > static void PoolCleaner( EventLoopTimerRef inTimer, EventLoopIdleTimerMessage inState, void *inUserData ); > >-static NSAutoreleasePool* sPool; >+static NSAutoreleasePoolMark sPool; > static unsigned numPools; > static EventLoopRef poolLoop; > >@@ -63,7 +63,7 @@ static unsigned getNSAutoreleasePoolCount(void) > GetCurrentProcess( &process ); > NSApplicationLoad(); > >- sPool = [[NSAutoreleasePool allocWithZone:NULL] init]; >+ sPool = NSPushAutoreleasePool(0); > numPools = getNSAutoreleasePoolCount(); > > poolLoop = GetCurrentEventLoop (); >@@ -95,9 +95,8 @@ static unsigned getNSAutoreleasePoolCount(void) > if ( CFEqual( mode, kCFRunLoopDefaultMode ) && thisLoop == poolLoop) { > unsigned currentNumPools = getNSAutoreleasePoolCount()-1; > if (currentNumPools == numPools){ >- [sPool drain]; >- >- sPool = [[NSAutoreleasePool allocWithZone:NULL] init]; >+ NSPopAutoreleasePool(sPool); >+ sPool = NSPushAutoreleasePool(0); > numPools = getNSAutoreleasePoolCount(); > } > } >diff --git a/Source/WebKitLegacy/mac/History/WebHistory.mm b/Source/WebKitLegacy/mac/History/WebHistory.mm >index 9cf8a8e907ec92b8369d3f1a1a2cba5bd19b12a1..7f719fc5e06c549399739da78d364945b15e7e56 100644 >--- a/Source/WebKitLegacy/mac/History/WebHistory.mm >+++ b/Source/WebKitLegacy/mac/History/WebHistory.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2005, 2008, 2009 Apple Inc. All rights reserved. >+ * Copyright (C) 2005-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 >@@ -37,6 +37,7 @@ > #import <WebCore/HistoryItem.h> > #import <WebCore/PageGroup.h> > #import <pal/spi/cocoa/NSCalendarDateSPI.h> >+#import <wtf/spi/cocoa/FoundationSPI.h> > > #if PLATFORM(IOS) > #import <WebCore/WebCoreThreadMessage.h> >@@ -591,14 +592,15 @@ - (BOOL)loadHistoryGutsFromURL:(NSURL *)URL savedItemsCount:(int *)numberOfItems > > int itemCountLimit = [self historyItemLimit]; > NSTimeInterval ageLimitDate = [[self ageLimitDate] timeIntervalSinceReferenceDate]; >- NSEnumerator *enumerator = [array objectEnumerator]; > BOOL ageLimitPassed = NO; > BOOL itemLimitPassed = NO; > ASSERT(*numberOfItemsLoaded == 0); > >- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; >- NSDictionary *itemAsDictionary; >- while ((itemAsDictionary = [enumerator nextObject]) != nil) { >+ // FIXME: If we can test and see good performance draining the autorelease pool every time through the loop, >+ // instead of once every 50 iterations, then we should switch to @autoreleasepool and get rid of the use of >+ // FoundationSPI.h in this source file. >+ auto pool = NSPushAutoreleasePool(0); >+ for (NSDictionary *itemAsDictionary in array) { > WebHistoryItem *item = [[WebHistoryItem alloc] initFromDictionaryRepresentation:itemAsDictionary]; > > // item without URL is useless; data on disk must have been bad; ignore >@@ -618,14 +620,15 @@ - (BOOL)loadHistoryGutsFromURL:(NSURL *)URL savedItemsCount:(int *)numberOfItems > > // Draining the autorelease pool every 50 iterations was found by experimentation to be optimal > if (*numberOfItemsLoaded % 50 == 0) { >- [pool drain]; >- pool = [[NSAutoreleasePool alloc] init]; >+ NSPopAutoreleasePool(pool); >+ pool = NSPushAutoreleasePool(0); > } > } > } >+ > [item release]; > } >- [pool drain]; >+ NSPopAutoreleasePool(pool); > > return YES; > } >diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm >index 0e2f7c27c118b1f3248ea6f001734c9dcb8e612f..d8b543c641e72b794cee03b7eb81753cb8fe803a 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm >@@ -7903,28 +7903,30 @@ - (NSArray *)rectsForTextMatches > if ([view conformsToProtocol:@protocol(WebMultipleTextMatches)]) { > NSView <WebMultipleTextMatches> *documentView = (NSView <WebMultipleTextMatches> *)view; > NSRect documentViewVisibleRect = [documentView visibleRect]; >- NSArray *originalRects = [documentView rectsForTextMatches]; >- unsigned rectCount = [originalRects count]; >- unsigned rectIndex; >- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; >- for (rectIndex = 0; rectIndex < rectCount; ++rectIndex) { >- NSRect r = [[originalRects objectAtIndex:rectIndex] rectValue]; >+ // FIXME: If we can test and see good performance draining the autorelease pool every time >+ // through the loop, instead of once every 10 iterations, then we should switch to >+ // @autoreleasepool and get rid of the use of FoundationSPI.h in this source file. >+ unsigned iterationCount = 0; >+ auto pool = NSPushAutoreleasePool(0); >+ for (NSValue *rect in [documentView rectsForTextMatches]) { >+ NSRect r = [rect rectValue]; > // Clip rect to document view's visible rect so rect is confined to subframe > r = NSIntersectionRect(r, documentViewVisibleRect); > if (NSIsEmptyRect(r)) > continue; >- >+ > // Convert rect to our coordinate system > r = [documentView convertRect:r toView:self]; > [result addObject:[NSValue valueWithRect:r]]; >- if (rectIndex % 10 == 0) { >- [pool drain]; >- pool = [[NSAutoreleasePool alloc] init]; >+ if (++iterationCount == 10) { >+ NSPopAutoreleasePool(pool); >+ pool = NSPushAutoreleasePool(0); >+ iterationCount = 0; > } > } >- [pool drain]; >+ NSPopAutoreleasePool(pool); > } >- >+ > frame = incrementFrame(frame); > } while (frame); >
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186436
:
342292
|
342336
|
342342
|
342360
|
342443