• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright 2019 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "tools/AutoreleasePool.h"
9
10#import <Foundation/NSAutoreleasePool.h>
11
12AutoreleasePool::AutoreleasePool() {
13    fPool = (void*)[[NSAutoreleasePool alloc] init];
14}
15
16AutoreleasePool::~AutoreleasePool() {
17    [(NSAutoreleasePool*)fPool release];
18    fPool = nullptr;
19}
20
21void AutoreleasePool::drain() {
22    [(NSAutoreleasePool*)fPool drain];
23    fPool = (void*)[[NSAutoreleasePool alloc] init];
24}
25