WebKit Bugzilla
Attachment 342336 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-20180608152118.patch (text/plain), 45.01 KB, created by
Darin Adler
on 2018-06-08 15:21:19 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-06-08 15:21:19 PDT
Size:
45.01 KB
patch
obsolete
>Subversion Revision: 232642 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 438129062e179ef9c3bddff230ce4f5b5fb5862f..f1304b44678fa17ac4fe29d89ad40d0ba23b52e1 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 Anders Carlsson. >+ >+ * WTF.xcodeproj/project.pbxproj: Added FoundationSPI.h. >+ >+ * wtf/AutodrainedPool.h: Streamlined header a bit, 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-08 Brian Burg <bburg@apple.com> > > [Cocoa] Web Automation: include browser name and version in listing for automation targets >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7ad212e7db2b05bab7176c977e82dc0e809cbeac..d3c5b8f2bc46a3490f65f9a29251eca64b6f5206 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,34 @@ >+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 Anders Carlsson. >+ >+ * 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/audio/mac/AudioBusMac.mm: >+ (WebCore::AudioBus::loadPlatformResource): Use @autoreleasepool. >+ >+ * platform/ios/wak/WebCoreThread.mm: Re-sorted includes. Removed declaration of >+ autorelease pool SPI and use FoundationSPI.h instead. >+ >+ * platform/network/cocoa/ResourceResponseCocoa.mm: >+ (WebCore::ResourceResponse::platformLazyInit): Use @autoreleasepool. >+ > 2018-06-08 Aditya Keerthi <akeerthi@apple.com> > > [Datalist] Allow TextFieldInputType to show and hide suggestions >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index a79652a922370a7d932a724096d377969ea62b73..d21f29227a583392db0f10d8ad2550a273ffac99 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 Anders Carlsson. >+ >+ * PAL.xcodeproj/project.pbxproj: Removed FoundationSPI.h. >+ * pal/PlatformMac.cmake: Ditto. >+ * pal/spi/cocoa/FoundationSPI.h: Moved into WTF project. >+ > 2018-06-08 Jonathan Bedard <jbedard@apple.com> > > [Mojave] Enable build >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 2b3ae50da359b18c5ceb7f0a463aed98c47a0330..f49cab640981545c660797f42b0890b6b73a4155 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 Anders Carlsson. >+ >+ * 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 @autoreleasepool instead of NSAutoreleasePool object. No need to do the "drain pool only >+ every 50 times"; the -[WebHistory loadFromURL] family of methods were once used by Safari, and >+ now hardly used if at all. >+ * WebView/WebView.mm: >+ (-[WebView rectsForTextMatches]): Ditto. >+ > 2018-06-08 Aditya Keerthi <akeerthi@apple.com> > > [Datalist] Allow TextFieldInputType to show and hide suggestions >diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj >index fb2ee7e1a089734412487580f8dfbc20973ca70b..27b2196f39281e965738bc593a8051917740100e 100644 >--- a/Source/WTF/WTF.xcodeproj/project.pbxproj >+++ b/Source/WTF/WTF.xcodeproj/project.pbxproj >@@ -53,7 +53,7 @@ > 1469419316EAAF6D0024E146 /* RunLoopTimerCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1469419116EAAF6D0024E146 /* RunLoopTimerCF.cpp */; }; > 1469419716EAAFF80024E146 /* SchedulePairMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1469419516EAAFF80024E146 /* SchedulePairMac.mm */; }; > 1469419916EAB0410024E146 /* SchedulePairCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1469419816EAB0410024E146 /* SchedulePairCF.cpp */; }; >- 1469419D16EAB10A0024E146 /* AutodrainedPoolMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1469419B16EAB10A0024E146 /* AutodrainedPoolMac.mm */; }; >+ 1469419D16EAB10A0024E146 /* AutodrainedPool.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1469419B16EAB10A0024E146 /* AutodrainedPool.mm */; }; > 1A1D8B9E1731879800141DA4 /* FunctionDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1D8B9D1731879800141DA4 /* FunctionDispatcher.cpp */; }; > 1ACADD841884480100D8B71D /* DeprecatedSymbolsUsedBySafari.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1ACADD821884480100D8B71D /* DeprecatedSymbolsUsedBySafari.mm */; }; > 1C181C7F1D3078DA00F5FA16 /* TextBreakIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C7D1D3078DA00F5FA16 /* TextBreakIterator.cpp */; }; >@@ -284,7 +284,7 @@ > 1469419516EAAFF80024E146 /* SchedulePairMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SchedulePairMac.mm; sourceTree = "<group>"; }; > 1469419816EAB0410024E146 /* SchedulePairCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SchedulePairCF.cpp; sourceTree = "<group>"; }; > 1469419A16EAB10A0024E146 /* AutodrainedPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutodrainedPool.h; sourceTree = "<group>"; }; >- 1469419B16EAB10A0024E146 /* AutodrainedPoolMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutodrainedPoolMac.mm; sourceTree = "<group>"; }; >+ 1469419B16EAB10A0024E146 /* AutodrainedPool.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutodrainedPool.mm; sourceTree = "<group>"; }; > 149EF16216BBFE0D000A4331 /* TriState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TriState.h; sourceTree = "<group>"; }; > 14C8279718FDD73400E1800C /* mbmalloc.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = mbmalloc.xcconfig; sourceTree = "<group>"; }; > 14E785E71DFB330100209BD1 /* OrdinalNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OrdinalNumber.h; sourceTree = "<group>"; }; >@@ -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>"; }; >@@ -807,7 +808,6 @@ > A8A4725C151A825A004123FF /* Assertions.h */, > A8A4725D151A825A004123FF /* Atomics.h */, > 1469419A16EAB10A0024E146 /* AutodrainedPool.h */, >- 1469419B16EAB10A0024E146 /* AutodrainedPoolMac.mm */, > 0F43D8EF1DB5ADDC00108FB6 /* AutomaticThread.cpp */, > 0F43D8F01DB5ADDC00108FB6 /* AutomaticThread.h */, > DCEE22041CEB9869000C2396 /* BackwardsGraph.h */, >@@ -1269,6 +1269,7 @@ > CE46516C19DB1FB4003ECA05 /* cocoa */ = { > isa = PBXGroup; > children = ( >+ 93D191CF20CAECE800C51B8E /* FoundationSPI.h */, > CE46516D19DB1FB4003ECA05 /* NSMapTableSPI.h */, > A5098B011C16A4F900087797 /* SecuritySPI.h */, > ); >@@ -1322,6 +1323,7 @@ > E4A0AD3B1A96251900536DF6 /* cocoa */ = { > isa = PBXGroup; > children = ( >+ 1469419B16EAB10A0024E146 /* AutodrainedPool.mm */, > E38C41241EB4E04C0042957D /* CPUTimeCocoa.mm */, > 143DDE9520C8BC37007F76FA /* Entitlements.cpp */, > 143DDE9720C8BE99007F76FA /* Entitlements.h */, >@@ -1445,7 +1447,7 @@ > 70ECA60D1B02426800449739 /* AtomicStringImpl.cpp in Sources */, > A5BA15FA182435A600A82E69 /* AtomicStringImplCF.cpp in Sources */, > 9BC70F05176C379D00101DEC /* AtomicStringTable.cpp in Sources */, >- 1469419D16EAB10A0024E146 /* AutodrainedPoolMac.mm in Sources */, >+ 1469419D16EAB10A0024E146 /* AutodrainedPool.mm in Sources */, > 0F43D8F11DB5ADDC00108FB6 /* AutomaticThread.cpp in Sources */, > 8134013815B092FD001FF0B8 /* Base64.cpp in Sources */, > A8A473A8151A825B004123FF /* bignum-dtoa.cc in Sources */, >diff --git a/Source/WTF/wtf/AutodrainedPool.h b/Source/WTF/wtf/AutodrainedPool.h >index 6f02c5df4dee7ed3ef3f9698b459099b772a8c94..4cbac6487a6bb549c96f241136488b6545ec7135 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,31 +26,32 @@ > * 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 >+#if defined(WTF_COMPILING_AUTODRAINED_POOL_IMPLEMENTATION) || !defined(__OBJC__) > > namespace WTF { > >+// This class allows non-Objective-C C++ code to create an autorelease pool. >+// It cannot be used in Objective-C++ code, won't be compiled; 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) > WTF_EXPORT_PRIVATE AutodrainedPool(); > WTF_EXPORT_PRIVATE ~AutodrainedPool(); > #else >- explicit AutodrainedPool() { } >- ~AutodrainedPool() { } >+ AutodrainedPool() = default; > #endif >- >-private: >+ > #if USE(FOUNDATION) >- id m_pool; >+private: >+ void* m_autoreleasePool; > #endif > }; > >diff --git a/Source/WTF/wtf/AutodrainedPoolMac.mm b/Source/WTF/wtf/AutodrainedPoolMac.mm >deleted file mode 100644 >index f0a75d2e2bf65674bc434fe93a63db97dd4a1bee..0000000000000000000000000000000000000000 >--- a/Source/WTF/wtf/AutodrainedPoolMac.mm >+++ /dev/null >@@ -1,46 +0,0 @@ >-/* >- * Copyright (C) 2007, 2013 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. >- * 3. Neither the name of Apple Inc. ("Apple") nor the names of >- * its contributors may be used to endorse or promote products derived >- * from this software without specific prior written permission. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. >- */ >- >-#import "config.h" >-#import "AutodrainedPool.h" >- >-#import <Foundation/Foundation.h> >- >-namespace WTF { >- >-AutodrainedPool::AutodrainedPool() >- : m_pool([[NSAutoreleasePool alloc] init]) >-{ >-} >- >-AutodrainedPool::~AutodrainedPool() >-{ >- [m_pool drain]; >-} >- >-} // namespace WTF >diff --git a/Source/WTF/wtf/PlatformMac.cmake b/Source/WTF/wtf/PlatformMac.cmake >index a26e0503e5f35e994f2c39b3991f3d8ce644b356..4d837a4471555431e22a794e9ead321302d7221f 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 > >@@ -32,7 +33,6 @@ list(APPEND WTF_PUBLIC_HEADERS > ) > > list(APPEND WTF_SOURCES >- AutodrainedPoolMac.mm > BlockObjCExceptions.mm > RunLoopTimerCF.cpp > SchedulePairCF.cpp >@@ -41,8 +41,7 @@ list(APPEND WTF_SOURCES > cf/LanguageCF.cpp > cf/RunLoopCF.cpp > >- text/mac/TextBreakIteratorInternalICUMac.mm >- >+ cocoa/AutodrainedPool.mm > cocoa/CPUTimeCocoa.mm > cocoa/Entitlements.cpp > cocoa/MachSendRight.cpp >@@ -61,6 +60,7 @@ list(APPEND WTF_SOURCES > text/mac/StringImplMac.mm > text/mac/StringMac.mm > text/mac/StringViewObjC.mm >+ text/mac/TextBreakIteratorInternalICUMac.mm > ) > > list(APPEND WTF_PRIVATE_INCLUDE_DIRECTORIES >diff --git a/Source/WTF/wtf/cocoa/AutodrainedPool.mm b/Source/WTF/wtf/cocoa/AutodrainedPool.mm >new file mode 100644 >index 0000000000000000000000000000000000000000..ed4cf42d2427a5a6ada9aa29f1a2947e8027c6b0 >--- /dev/null >+++ b/Source/WTF/wtf/cocoa/AutodrainedPool.mm >@@ -0,0 +1,50 @@ >+/* >+ * 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 >+ * 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. >+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of >+ * its contributors may be used to endorse or promote products derived >+ * from this software without specific prior written permission. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. >+ */ >+ >+#define WTF_COMPILING_AUTODRAINED_POOL_IMPLEMENTATION >+ >+#import "config.h" >+#import "AutodrainedPool.h" >+ >+#undef WTF_COMPILING_AUTODRAINED_POOL_IMPLEMENTATION >+ >+#import <wtf/spi/cocoa/FoundationSPI.h> >+ >+namespace WTF { >+ >+AutodrainedPool::AutodrainedPool() >+ : m_autoreleasePool { NSPushAutoreleasePool(0) } >+{ >+} >+ >+AutodrainedPool::~AutodrainedPool() >+{ >+ NSPopAutoreleasePool(m_autoreleasePool); >+} >+ >+} // namespace WTF >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 59e747afedf169c4961105997f435bdadee59d65..8de5ec72eea31d4d4e8c5ab8191ce2c2870c2e86 100644 >--- a/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj >+++ b/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj >@@ -112,7 +112,6 @@ > 57F12518205787D7001AB8A6 /* DeviceIdentitySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 57F12517205787C8001AB8A6 /* DeviceIdentitySPI.h */; }; > 7A1656441F97B2B900BA3CE4 /* NSKeyedArchiverSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */; }; > 7A3A6A8020CADB4700317AAE /* NSImageSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A3A6A7F20CADB4600317AAE /* NSImageSPI.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 */; }; >@@ -261,7 +260,6 @@ > 7A1656431F97B2B800BA3CE4 /* NSKeyedArchiverSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSKeyedArchiverSPI.h; sourceTree = "<group>"; }; > 7A3A6A7F20CADB4600317AAE /* NSImageSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSImageSPI.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>"; }; >@@ -364,7 +362,6 @@ > 0C2DA1241F3BEB4900DBC317 /* CoreTextSPI.h */, > 0C2DA1251F3BEB4900DBC317 /* DataDetectorsCoreSPI.h */, > 57F12517205787C8001AB8A6 /* DeviceIdentitySPI.h */, >- A10265861F56746100B4C844 /* FoundationSPI.h */, > 0C2DA1261F3BEB4900DBC317 /* IOPMLibSPI.h */, > 0C2DA1271F3BEB4900DBC317 /* IOPSLibSPI.h */, > 0C2DA1281F3BEB4900DBC317 /* IOReturnSPI.h */, >@@ -639,7 +636,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/audio/mac/AudioBusMac.mm b/Source/WebCore/platform/audio/mac/AudioBusMac.mm >index 703a67b7b3842c16297f893e946a8bc224c5d4a6..fc55134c823bcf57a46c7dce2c0c683a94545b57 100644 >--- a/Source/WebCore/platform/audio/mac/AudioBusMac.mm >+++ b/Source/WebCore/platform/audio/mac/AudioBusMac.mm >@@ -29,9 +29,6 @@ > #import "AudioBus.h" > > #import "AudioFileReader.h" >-#import <wtf/AutodrainedPool.h> >-#import <wtf/RefPtr.h> >-#import <Foundation/Foundation.h> > > @interface WebCoreAudioBundleClass : NSObject > @end >@@ -43,16 +40,12 @@ namespace WebCore { > > RefPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, float sampleRate) > { >- // This method can be called from other than the main thread, so we need an auto-release pool. >- AutodrainedPool pool; >- >- NSBundle *bundle = [NSBundle bundleForClass:[WebCoreAudioBundleClass class]]; >- NSURL *audioFileURL = [bundle URLForResource:[NSString stringWithUTF8String:name] withExtension:@"wav" subdirectory:@"audio"]; >- NSDataReadingOptions options = NSDataReadingMappedIfSafe; >- NSData *audioData = [NSData dataWithContentsOfURL:audioFileURL options:options error:nil]; >- >- if (audioData) >- return createBusFromInMemoryAudioFile([audioData bytes], [audioData length], false, sampleRate); >+ @autoreleasepool { >+ NSBundle *bundle = [NSBundle bundleForClass:[WebCoreAudioBundleClass class]]; >+ NSURL *audioFileURL = [bundle URLForResource:[NSString stringWithUTF8String:name] withExtension:@"wav" subdirectory:@"audio"]; >+ if (NSData *audioData = [NSData dataWithContentsOfURL:audioFileURL options:NSDataReadingMappedIfSafe error:nil]) >+ return createBusFromInMemoryAudioFile([audioData bytes], [audioData length], false, sampleRate); >+ } > > ASSERT_NOT_REACHED(); > return nullptr; >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/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm b/Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm >index 3d8f396d807c92a12565c9bacde15be722a6f91c..2bc541e4136d53b89902144c2af3cc3669ebc32b 100644 >--- a/Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm >+++ b/Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm >@@ -175,26 +175,28 @@ void ResourceResponse::platformLazyInit(InitLevel initLevel) > if (m_isNull || !m_nsResponse) > return; > >- AutodrainedPool pool; >+ @autoreleasepool { > >- NSHTTPURLResponse *httpResponse = [m_nsResponse.get() isKindOfClass:[NSHTTPURLResponse class]] ? (NSHTTPURLResponse *)m_nsResponse.get() : nullptr; >+ NSHTTPURLResponse *httpResponse = [m_nsResponse.get() isKindOfClass:[NSHTTPURLResponse class]] ? (NSHTTPURLResponse *)m_nsResponse.get() : nullptr; >+ >+ if (m_initLevel < CommonFieldsOnly) { >+ m_url = [m_nsResponse.get() URL]; >+ m_mimeType = [m_nsResponse.get() MIMEType]; >+ m_expectedContentLength = [m_nsResponse.get() expectedContentLength]; >+ // Stripping double quotes as a workaround for <rdar://problem/8757088>, can be removed once that is fixed. >+ m_textEncodingName = stripLeadingAndTrailingDoubleQuote([m_nsResponse.get() textEncodingName]); >+ m_httpStatusCode = httpResponse ? [httpResponse statusCode] : 0; >+ } >+ if (httpResponse) { >+ if (initLevel == AllFields) { >+ auto messageRef = CFURLResponseGetHTTPResponse([httpResponse _CFURLResponse]); >+ m_httpStatusText = extractHTTPStatusText(messageRef); >+ m_httpVersion = String(adoptCF(CFHTTPMessageCopyVersion(messageRef)).get()).convertToASCIIUppercase(); >+ initializeHTTPHeaders(OnlyCommonHeaders::No, httpResponse, m_httpHeaderFields); >+ } else >+ initializeHTTPHeaders(OnlyCommonHeaders::Yes, httpResponse, m_httpHeaderFields); >+ } > >- if (m_initLevel < CommonFieldsOnly) { >- m_url = [m_nsResponse.get() URL]; >- m_mimeType = [m_nsResponse.get() MIMEType]; >- m_expectedContentLength = [m_nsResponse.get() expectedContentLength]; >- // Stripping double quotes as a workaround for <rdar://problem/8757088>, can be removed once that is fixed. >- m_textEncodingName = stripLeadingAndTrailingDoubleQuote([m_nsResponse.get() textEncodingName]); >- m_httpStatusCode = httpResponse ? [httpResponse statusCode] : 0; >- } >- if (httpResponse) { >- if (initLevel == AllFields) { >- auto messageRef = CFURLResponseGetHTTPResponse([httpResponse _CFURLResponse]); >- m_httpStatusText = extractHTTPStatusText(messageRef); >- m_httpVersion = String(adoptCF(CFHTTPMessageCopyVersion(messageRef)).get()).convertToASCIIUppercase(); >- initializeHTTPHeaders(OnlyCommonHeaders::No, httpResponse, m_httpHeaderFields); >- } else >- initializeHTTPHeaders(OnlyCommonHeaders::Yes, httpResponse, m_httpHeaderFields); > } > > m_initLevel = initLevel; >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..13832e1a527feb0699bf0580ca8a7f99da52aeb8 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 >@@ -591,41 +591,34 @@ - (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) { >- WebHistoryItem *item = [[WebHistoryItem alloc] initFromDictionaryRepresentation:itemAsDictionary]; >- >- // item without URL is useless; data on disk must have been bad; ignore >- if ([item URLString]) { >- // Test against date limit. Since the items are ordered newest to oldest, we can stop comparing >- // once we've found the first item that's too old. >- if (!ageLimitPassed && [item lastVisitedTimeInterval] <= ageLimitDate) >- ageLimitPassed = YES; >- >- if (ageLimitPassed || itemLimitPassed) >- [discardedItems addObject:item]; >- else { >- if ([self addItem:item discardDuplicate:YES]) >- ++(*numberOfItemsLoaded); >- if (*numberOfItemsLoaded == itemCountLimit) >- itemLimitPassed = YES; >- >- // Draining the autorelease pool every 50 iterations was found by experimentation to be optimal >- if (*numberOfItemsLoaded % 50 == 0) { >- [pool drain]; >- pool = [[NSAutoreleasePool alloc] init]; >+ for (NSDictionary *itemAsDictionary in array) { >+ @autoreleasepool { >+ WebHistoryItem *item = [[WebHistoryItem alloc] initFromDictionaryRepresentation:itemAsDictionary]; >+ >+ // item without URL is useless; data on disk must have been bad; ignore >+ if ([item URLString]) { >+ // Test against date limit. Since the items are ordered newest to oldest, we can stop comparing >+ // once we've found the first item that's too old. >+ if (!ageLimitPassed && [item lastVisitedTimeInterval] <= ageLimitDate) >+ ageLimitPassed = YES; >+ >+ if (ageLimitPassed || itemLimitPassed) >+ [discardedItems addObject:item]; >+ else { >+ if ([self addItem:item discardDuplicate:YES]) >+ ++(*numberOfItemsLoaded); >+ if (*numberOfItemsLoaded == itemCountLimit) >+ itemLimitPassed = YES; > } > } >+ >+ [item release]; > } >- [item release]; > } >- [pool drain]; > > return YES; > } >diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm >index 0e2f7c27c118b1f3248ea6f001734c9dcb8e612f..4077e91ab12d7fb07b740cd0591e29b6fda81ad3 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm >@@ -7903,28 +7903,21 @@ - (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]; >+ 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]; >+ >+ @autoreleasepool { >+ // Convert rect to our coordinate system >+ r = [documentView convertRect:r toView:self]; >+ [result addObject:[NSValue valueWithRect:r]]; > } > } >- [pool drain]; > } >- >+ > 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