diff options
3 files changed, 11 insertions, 13 deletions
diff --git a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm index 5fa32d4..1cf9160 100644 --- a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm +++ b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa_unittest.mm @@ -7,6 +7,7 @@ #import <Cocoa/Cocoa.h> #include "base/debug/debugger.h" +#include "base/mac/scoped_nsautorelease_pool.h" #include "base/memory/scoped_nsobject.h" #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" @@ -37,15 +38,13 @@ class ContentSettingBubbleControllerTest virtual ~ContentSettingBubbleControllerTest(); private: - NSAutoreleasePool* pool_; + base::mac::ScopedNSAutoreleasePool pool_; }; -ContentSettingBubbleControllerTest::ContentSettingBubbleControllerTest() - : pool_([[NSAutoreleasePool alloc] init]) { +ContentSettingBubbleControllerTest::ContentSettingBubbleControllerTest() { } ContentSettingBubbleControllerTest::~ContentSettingBubbleControllerTest() { - [pool_ drain]; } // Check that the bubble doesn't crash or leak for any settings type @@ -82,5 +81,3 @@ TEST_F(ContentSettingBubbleControllerTest, Init) { } } // namespace - - diff --git a/chrome/renderer/print_web_view_helper_mac.mm b/chrome/renderer/print_web_view_helper_mac.mm index 759cb6c..f3981a5 100644 --- a/chrome/renderer/print_web_view_helper_mac.mm +++ b/chrome/renderer/print_web_view_helper_mac.mm @@ -7,6 +7,7 @@ #import <AppKit/AppKit.h> #include "base/logging.h" +#include "base/mac/scoped_nsautorelease_pool.h" #include "chrome/common/print_messages.h" #include "printing/metafile.h" #include "printing/metafile_impl.h" @@ -109,9 +110,10 @@ void PrintWebViewHelper::RenderPage( // printPage can create autoreleased references to |context|. PDF contexts // don't write all their data until they are destroyed, so we need to make // certain that there are no lingering references. - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - frame->printPage(page_number, metafile->context()); - [pool release]; + { + base::mac::ScopedNSAutoreleasePool pool; + frame->printPage(page_number, metafile->context()); + } // Done printing. Close the device context to retrieve the compiled metafile. metafile->FinishPage(); diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index 840bbdd..f8ad17c 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -16,6 +16,7 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/mac/mac_util.h" +#include "base/mac/scoped_nsautorelease_pool.h" #include "base/memory/memory_debug.h" #include "base/message_loop.h" #include "base/path_service.h" @@ -395,9 +396,9 @@ void TestShell::TestFinished() { } - (void)run:(id)ignore { - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + base::mac::ScopedNSAutoreleasePool scoped_pool; - // check for debugger, just bail if so. We don't want the timeouts hitting + // Check for debugger, just bail if so. We don't want the timeouts hitting // when we're trying to track down an issue. if (base::debug::BeingDebugged()) return; @@ -422,8 +423,6 @@ void TestShell::TestFinished() { fflush(stdout); abort(); } - - [pool release]; } @end |