WebKit Bugzilla
Attachment 342360 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-20180608222535.patch (text/plain), 56.09 KB, created by
Darin Adler
on 2018-06-08 22:25:35 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Darin Adler
Created:
2018-06-08 22:25:35 PDT
Size:
56.09 KB
patch
obsolete
>Subversion Revision: 232647 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index adab4a299aff737cbc03ecd43a5a0106980f20b6..69140784297391a817ad61e35203858cd25ffbe9 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,13 @@ >+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. >+ >+ * heap/Heap.cpp: Include FoundationSPI.h rather than directly including >+ objc-internal.h and explicitly declaring the alternative. >+ > 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/WTF/ChangeLog b/Source/WTF/ChangeLog >index 438129062e179ef9c3bddff230ce4f5b5fb5862f..969cb49cdab6c372a16e95457e033120d1e81c6a 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,25 @@ >+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/PlatformMac.cmake: Added FoundationSPI.h. >+ >+ * wtf/cocoa/AutodrainedPool.cpp: Moved here from AutodrainedPoolMac.mm. >+ (WTF::AutodrainedPool::AutodrainedPool): Use objc_autoreleasePoolPush/Pop instead of >+ the NSAutoreleasePool class. >+ (WTF::AutodrainedPool::~AutodrainedPool): Ditto. >+ >+ * wtf/spi/cocoa/FoundationSPI.h: Moved from Source/WebCore/PAL/pal/spi/cocoa/FoundationSPI.h. >+ Changed both include and declarations so it's the objc_autoreleasePoolPush/Pop instead >+ of the higher level NS functionst that call them. >+ > 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 fea74db8dd92bc5e39cd16c4c5bca660d88f8ccf..87b98e1f57ab8dd12ec9a0c62dd0f69208a50f3b 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 objc_autoreleasePoolPush. 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 objc_autoreleasePoolPush instead of >+ NSAutoreleasePool class. >+ (ObjcInstance::virtualEnd): Use objc_autoreleasePoolPop. >+ >+ * 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 Darin Adler <darin@apple.com> > > Fix iOS build. >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index fbd744b006f66019fb4434ac64e894207b72f2d5..935c68110e22b2ea413bcf855b21a39d12fbc3ae 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 Darin Adler <darin@apple.com> > > [Cocoa] Make more of our soft linking ARC-compatible >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 2b3ae50da359b18c5ceb7f0a463aed98c47a0330..0b88d920e0551afe996163b9dc850991d109d539 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,23 @@ >+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. >+ (getNSAutoreleasePoolCount): Use objc_autoreleasePoolPush/Pop. >+ (WebInitForCarbon): Use objc_autoreleasePoolPush/Pop 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/JavaScriptCore/heap/Heap.cpp b/Source/JavaScriptCore/heap/Heap.cpp >index 9c66bbc053e73bd66f452157474fc03659ba9a8f..63d8001d388a4e1db5e75f4a2428725b7f9c5486 100644 >--- a/Source/JavaScriptCore/heap/Heap.cpp >+++ b/Source/JavaScriptCore/heap/Heap.cpp >@@ -62,10 +62,10 @@ > #include "SamplingProfiler.h" > #include "ShadowChicken.h" > #include "SpaceTimeMutatorScheduler.h" >-#include "SubspaceInlines.h" >-#include "SuperSampler.h" > #include "StochasticSpaceTimeMutatorScheduler.h" > #include "StopIfNecessaryTimer.h" >+#include "SubspaceInlines.h" >+#include "SuperSampler.h" > #include "SweepingScope.h" > #include "SynchronousStopTheWorldMutatorScheduler.h" > #include "TypeProfiler.h" >@@ -77,9 +77,6 @@ > #include "WeakMapImplInlines.h" > #include "WeakSetInlines.h" > #include <algorithm> >-#if PLATFORM(IOS) >-#include <bmalloc/bmalloc.h> >-#endif > #include <wtf/ListDump.h> > #include <wtf/MainThread.h> > #include <wtf/ParallelVectorIterator.h> >@@ -88,14 +85,13 @@ > #include <wtf/SimpleStats.h> > #include <wtf/Threading.h> > >+#if PLATFORM(IOS) >+#include <bmalloc/bmalloc.h> >+#endif >+ > #if USE(FOUNDATION) >-#if __has_include(<objc/objc-internal.h>) >-#include <objc/objc-internal.h> >-#else >-extern "C" void* objc_autoreleasePoolPush(void); >-extern "C" void objc_autoreleasePoolPop(void *context); >+#include <wtf/spi/cocoa/FoundationSPI.h> > #endif >-#endif // USE(FOUNDATION) > > #if USE(GLIB) > #include "JSCGLibWrapperObject.h" >diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj >index fb2ee7e1a089734412487580f8dfbc20973ca70b..ef1b33b7fe0782f1d87405993f6f4106b1066e20 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.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1469419B16EAB10A0024E146 /* AutodrainedPool.cpp */; }; > 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.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutodrainedPool.cpp; 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.cpp */, > 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.cpp 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..b667f8e43258dc345d2e6d6d40986881fef9d912 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,38 @@ > * 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; >+#ifdef __OBJC__ >+#error Please use @autoreleasepool instead of AutodrainedPool. > #endif > >+#include <wtf/Noncopyable.h> >+ > 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() { } > #endif >- >+ > private: > #if USE(FOUNDATION) >- id m_pool; >+ void* m_autoreleasePool; > #endif > }; > > } // namespace WTF > > using WTF::AutodrainedPool; >- >-#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.cpp b/Source/WTF/wtf/cocoa/AutodrainedPool.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..9d7996d60451627a8f90b025fd662871c048b1ed >--- /dev/null >+++ b/Source/WTF/wtf/cocoa/AutodrainedPool.cpp >@@ -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 { objc_autoreleasePoolPush() } >+{ >+} >+ >+AutodrainedPool::~AutodrainedPool() >+{ >+ objc_autoreleasePoolPop(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..576ae0f8fd5bc81c4b9b1e660eb91eba28b4b441 >--- /dev/null >+++ b/Source/WTF/wtf/spi/cocoa/FoundationSPI.h >@@ -0,0 +1,41 @@ >+/* >+ * Copyright (C) 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. >+ * >+ * 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 <objc/objc-internal.h> >+ >+#else >+ >+WTF_EXTERN_C_BEGIN >+ >+void* objc_autoreleasePoolPush(void); >+void objc_autoreleasePoolPop(void *context); >+ >+WTF_EXTERN_C_END >+ >+#endif >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..0a1124722bf6213b220f1ca6b40dc6e05c89bfba 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 = objc_autoreleasePoolPush(); > _beginCount++; > } > >@@ -143,8 +141,9 @@ void ObjcInstance::virtualEnd() > _beginCount--; > ASSERT(_beginCount >= 0); > if (!_beginCount) { >- [_pool drain]; >- _pool = 0; >+ ASSERT(m_autoreleasePool); >+ objc_autoreleasePoolPop(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..43bb32a930a2145921f05c2c7fc2202f81934348 100644 >--- a/Source/WebCore/platform/ios/wak/WebCoreThread.mm >+++ b/Source/WebCore/platform/ios/wak/WebCoreThread.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. >+ * Copyright (C) 2006-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,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,21 +81,11 @@ - (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; > >-static NSAutoreleasePoolMark autoreleasePoolMark; >+static void* autoreleasePoolMark; > static CFRunLoopRef webThreadRunLoop; > static NSRunLoop* webThreadNSRunLoop; > static pthread_t webThread; >@@ -104,7 +93,7 @@ static BOOL isWebThreadLocked; > static BOOL webThreadStarted; > static unsigned webThreadLockCount; > >-static NSAutoreleasePoolMark savedAutoreleasePoolMark; >+static void* savedAutoreleasePoolMark; > static BOOL isNestedWebThreadRunLoop; > typedef enum { > PushOrPopAutoreleasePool, >@@ -465,7 +454,7 @@ static void WebRunLoopLockInternal(AutoreleasePoolOperation poolOperation) > { > _WebThreadLock(); > if (poolOperation == PushOrPopAutoreleasePool) >- autoreleasePoolMark = NSPushAutoreleasePool(0); >+ autoreleasePoolMark = objc_autoreleasePoolPush(); > isWebThreadLocked = YES; > } > >@@ -479,7 +468,7 @@ static void WebRunLoopUnlockInternal(AutoreleasePoolOperation poolOperation) > } > > if (poolOperation == PushOrPopAutoreleasePool) >- NSPopAutoreleasePool(autoreleasePoolMark); >+ objc_autoreleasePoolPop(autoreleasePoolMark); > > _WebThreadUnlock(); > isWebThreadLocked = NO; >diff --git a/Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm b/Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm >index 3d8f396d807c92a12565c9bacde15be722a6f91c..301da1edd7e65ecd145386fe66f0cf99462c39b6 100644 >--- a/Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm >+++ b/Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm >@@ -33,7 +33,6 @@ > #import <Foundation/Foundation.h> > #import <limits> > #import <pal/spi/cf/CFNetworkSPI.h> >-#import <wtf/AutodrainedPool.h> > #import <wtf/NeverDestroyed.h> > #import <wtf/StdLibExtras.h> > #import <wtf/cf/TypeCastsCF.h> >@@ -175,26 +174,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..ff14b3c0ff07881d0ba4ce46fae02173b8ac3c03 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 void* sPool; > static unsigned numPools; > static EventLoopRef poolLoop; > >@@ -43,9 +43,9 @@ > > static unsigned getNSAutoreleasePoolCount(void) > { >- void* v = NSPushAutoreleasePool(0); >+ void* v = objc_autoreleasePoolPush(); > uintptr_t numPools = (uintptr_t)v; >- NSPopAutoreleasePool(v); >+ objc_autoreleasePoolPop(v); > return numPools; > } > >@@ -63,7 +63,7 @@ static unsigned getNSAutoreleasePoolCount(void) > GetCurrentProcess( &process ); > NSApplicationLoad(); > >- sPool = [[NSAutoreleasePool allocWithZone:NULL] init]; >+ sPool = objc_autoreleasePoolPush(); > 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]; >+ objc_autoreleasePoolPop(sPool); >+ sPool = objc_autoreleasePoolPush(); > 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); > >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 14b806ec9f3d3537ccc3d3e4105cd568878fd846..5624136ec70757f68fdd8530574160eb5e887f4e 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,18 @@ >+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. >+ >+ * TestWebKitAPI/Tests/WebKitObjC/CustomProtocolsTest.mm: >+ (TestWebKitAPI::WebKit2CustomProtocolsTest_ProcessPoolDestroyedDuringLoading): >+ Use @autoreleasepool. >+ * TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm: >+ (TestWebKitAPI::buildAndPerformTest): Ditto. >+ * TestWebKitAPI/Tests/mac/StopLoadingFromDidFinishLoading.mm: >+ (TestWebKitAPI::WebKitLegacy_StopLoadingFromDidFinishLoading): Ditto. >+ > 2018-06-08 Alicia Boya GarcÃa <aboya@igalia.com> > > [GTK] Update to libva-2.1.0 in jhbuild >diff --git a/Tools/TestWebKitAPI/Tests/WebKitObjC/CustomProtocolsTest.mm b/Tools/TestWebKitAPI/Tests/WebKitObjC/CustomProtocolsTest.mm >index a6ee166efc016f7580b1f89de52a952b883f12a5..589c3d04edabdf855a0e823853970089862bdf07 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitObjC/CustomProtocolsTest.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitObjC/CustomProtocolsTest.mm >@@ -34,7 +34,6 @@ > #import "TestProtocol.h" > #import <WebKit/WKContextPrivate.h> > #import <WebKit/WKProcessGroupPrivate.h> >-#import <wtf/AutodrainedPool.h> > #import <wtf/RetainPtr.h> > > #if WK_API_ENABLED && PLATFORM(MAC) >@@ -171,8 +170,7 @@ TEST(WebKit2CustomProtocolsTest, ProcessPoolDestroyedDuringLoading) > { > [ProcessPoolDestroyedDuringLoadingProtocol registerWithScheme:@"custom"]; > >- { >- AutodrainedPool pool; >+ @autoreleasepool { > auto browsingContextGroup = adoptNS([[WKBrowsingContextGroup alloc] initWithIdentifier:@"TestIdentifier"]); > auto processGroup = adoptNS([[WKProcessGroup alloc] init]); > auto wkView = adoptNS([[WKView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) processGroup:processGroup.get() browsingContextGroup:browsingContextGroup.get()]); >diff --git a/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm b/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm >index 700254e4dafcb72fcb6644099ba5ea7f3843eed0..c91b09f72b9471d658425a307c0e35f0edee53a8 100644 >--- a/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm >+++ b/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm >@@ -29,7 +29,6 @@ > #import <Carbon/Carbon.h> // For GetCurrentEventTime > #import <WebCore/PlatformEventFactoryMac.h> > #import <pal/spi/mac/NSMenuSPI.h> >-#import <wtf/AutodrainedPool.h> > #import <wtf/RetainPtr.h> > #import <wtf/mac/AppKitCompatibilityDeclarations.h> > >@@ -42,25 +41,26 @@ static bool canCallMenuTypeForEvent() > > static void buildAndPerformTest(NSEventType buttonEvent, NSEventModifierFlags modifierFlags, WebCore::MouseButton expectedButton, NSMenuType expectedMenu) > { >- AutodrainedPool pool; >- RetainPtr<WebView> webView = adoptNS([[WebView alloc] init]); >- NSEvent *event = [NSEvent mouseEventWithType:buttonEvent >- location:NSMakePoint(100, 100) >- modifierFlags:modifierFlags >- timestamp:GetCurrentEventTime() >- windowNumber:[[webView window] windowNumber] >- context:[NSGraphicsContext currentContext] >- eventNumber:0 >- clickCount:0 >- pressure:0]; >- >- auto pme = WebCore::PlatformEventFactory::createPlatformMouseEvent(event, nil, webView.get()); >- >- EXPECT_EQ(expectedButton, pme.button()); >- EXPECT_TRUE(!modifierFlags || pme.modifierFlags() & modifierFlags); >- EXPECT_EQ(expectedMenu, pme.menuTypeForEvent()); >- if (canCallMenuTypeForEvent()) >- EXPECT_EQ(expectedMenu, [NSMenu menuTypeForEvent:event]); >+ @autoreleasepool { >+ auto webView = adoptNS([[WebView alloc] init]); >+ NSEvent *event = [NSEvent mouseEventWithType:buttonEvent >+ location:NSMakePoint(100, 100) >+ modifierFlags:modifierFlags >+ timestamp:GetCurrentEventTime() >+ windowNumber:[[webView window] windowNumber] >+ context:[NSGraphicsContext currentContext] >+ eventNumber:0 >+ clickCount:0 >+ pressure:0]; >+ >+ auto pme = WebCore::PlatformEventFactory::createPlatformMouseEvent(event, nil, webView.get()); >+ >+ EXPECT_EQ(expectedButton, pme.button()); >+ EXPECT_TRUE(!modifierFlags || pme.modifierFlags() & modifierFlags); >+ EXPECT_EQ(expectedMenu, pme.menuTypeForEvent()); >+ if (canCallMenuTypeForEvent()) >+ EXPECT_EQ(expectedMenu, [NSMenu menuTypeForEvent:event]); >+ } > } > > TEST(WebKitLegacy, MenuAndButtonForNormalLeftClick) >diff --git a/Tools/TestWebKitAPI/Tests/mac/StopLoadingFromDidFinishLoading.mm b/Tools/TestWebKitAPI/Tests/mac/StopLoadingFromDidFinishLoading.mm >index 08dc660eca62872bfd7412faaff4bc0722e2a8c4..c0e23cac1681afbb7d1a6a7563efe4a2a0236ed7 100644 >--- a/Tools/TestWebKitAPI/Tests/mac/StopLoadingFromDidFinishLoading.mm >+++ b/Tools/TestWebKitAPI/Tests/mac/StopLoadingFromDidFinishLoading.mm >@@ -24,12 +24,11 @@ > */ > > #import "config.h" >+ > #import "PlatformUtilities.h" >-#import <wtf/AutodrainedPool.h> > #import <wtf/RetainPtr.h> > >-@interface StopLoadingFromDidFinishLoadingDelegate : NSObject <WebResourceLoadDelegate> { >-} >+@interface StopLoadingFromDidFinishLoadingDelegate : NSObject <WebResourceLoadDelegate> > @end > > static bool finished = false; >@@ -48,12 +47,12 @@ namespace TestWebKitAPI { > > TEST(WebKitLegacy, StopLoadingFromDidFinishLoading) > { >- AutodrainedPool pool; >- RetainPtr<WebView> webView = adoptNS([[WebView alloc] init]); >- RetainPtr<StopLoadingFromDidFinishLoadingDelegate> delegate = adoptNS([[StopLoadingFromDidFinishLoadingDelegate alloc] init]); >- webView.get().resourceLoadDelegate = delegate.get(); >- [webView.get().mainFrame loadHTMLString:@"Hello, World!" baseURL:[NSURL URLWithString:@""]]; >- Util::run(&finished); >+ @autoreleasepool { >+ auto webView = adoptNS([[WebView alloc] init]); >+ webView.get().resourceLoadDelegate = adoptNS([[StopLoadingFromDidFinishLoadingDelegate alloc] init]).get(); >+ [webView.get().mainFrame loadHTMLString:@"Hello, World!" baseURL:[NSURL URLWithString:@""]]; >+ Util::run(&finished); >+ } > // No crash means the test passed. > } >
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