michael@0: // Copyright (c) 2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #include "base/scoped_nsautorelease_pool.h" michael@0: michael@0: #import michael@0: michael@0: #include "base/logging.h" michael@0: michael@0: namespace base { michael@0: michael@0: ScopedNSAutoreleasePool::ScopedNSAutoreleasePool() michael@0: : autorelease_pool_([[NSAutoreleasePool alloc] init]) { michael@0: DCHECK(autorelease_pool_); michael@0: } michael@0: michael@0: ScopedNSAutoreleasePool::~ScopedNSAutoreleasePool() { michael@0: [autorelease_pool_ drain]; michael@0: } michael@0: michael@0: // Cycle the internal pool, allowing everything there to get cleaned up and michael@0: // start anew. michael@0: void ScopedNSAutoreleasePool::Recycle() { michael@0: [autorelease_pool_ drain]; michael@0: autorelease_pool_ = [[NSAutoreleasePool alloc] init]; michael@0: DCHECK(autorelease_pool_); michael@0: } michael@0: michael@0: } // namespace base