Title: [120693] trunk/Source/WebCore
- Revision
- 120693
- Author
- [email protected]
- Date
- 2012-06-19 01:45:40 -0700 (Tue, 19 Jun 2012)
Log Message
[Mac] Use AutodrainedPool instead of NSAutoreleasePool in AudioBus::loadPlatformResource()
https://bugs.webkit.org/show_bug.cgi?id=89427
Reviewed by Dan Bernstein.
loadPlatformResource() called -[NSAutoreleasePool release] at each of
its exit points, which is not only an error-prone pattern but is
incorrect in garbage-collected environments. AutodrainedPool solves
both these problems by automatically calling -[NSAutoreleasePool drain]
when going out of scope.
* platform/audio/mac/AudioBusMac.mm:
(WebCore::AudioBus::loadPlatformResource):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (120692 => 120693)
--- trunk/Source/WebCore/ChangeLog 2012-06-19 08:38:38 UTC (rev 120692)
+++ trunk/Source/WebCore/ChangeLog 2012-06-19 08:45:40 UTC (rev 120693)
@@ -1,3 +1,19 @@
+2012-06-19 Andy Estes <[email protected]>
+
+ [Mac] Use AutodrainedPool instead of NSAutoreleasePool in AudioBus::loadPlatformResource()
+ https://bugs.webkit.org/show_bug.cgi?id=89427
+
+ Reviewed by Dan Bernstein.
+
+ loadPlatformResource() called -[NSAutoreleasePool release] at each of
+ its exit points, which is not only an error-prone pattern but is
+ incorrect in garbage-collected environments. AutodrainedPool solves
+ both these problems by automatically calling -[NSAutoreleasePool drain]
+ when going out of scope.
+
+ * platform/audio/mac/AudioBusMac.mm:
+ (WebCore::AudioBus::loadPlatformResource):
+
2012-06-19 Mike West <[email protected]>
Compilation failure in StyleResolver.cpp
Modified: trunk/Source/WebCore/platform/audio/mac/AudioBusMac.mm (120692 => 120693)
--- trunk/Source/WebCore/platform/audio/mac/AudioBusMac.mm 2012-06-19 08:38:38 UTC (rev 120692)
+++ trunk/Source/WebCore/platform/audio/mac/AudioBusMac.mm 2012-06-19 08:45:40 UTC (rev 120693)
@@ -29,6 +29,7 @@
#import "AudioBus.h"
#import "AudioFileReader.h"
+#import "AutodrainedPool.h"
#import <wtf/OwnPtr.h>
#import <wtf/PassOwnPtr.h>
#import <Foundation/Foundation.h>
@@ -44,7 +45,7 @@
PassOwnPtr<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.
- NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ AutodrainedPool pool;
NSBundle *bundle = [NSBundle bundleForClass:[WebCoreAudioBundleClass class]];
NSURL *audioFileURL = [bundle URLForResource:[NSString stringWithUTF8String:name] withExtension:@"wav" subdirectory:@"audio"];
@@ -57,12 +58,10 @@
if (audioData) {
OwnPtr<AudioBus> bus(createBusFromInMemoryAudioFile([audioData bytes], [audioData length], false, sampleRate));
- [pool release];
return bus.release();
}
ASSERT_NOT_REACHED();
- [pool release];
return nullptr;
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes