| 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 |
|
| 12 |
AutoreleasePool::AutoreleasePool() { |
| 13 |
fPool = (void*)[[NSAutoreleasePool alloc] init]; |
| 14 |
} |
| 15 |
|
| 16 |
AutoreleasePool::~AutoreleasePool() { |
| 17 |
[(NSAutoreleasePool*)fPool release]; |
| 18 |
fPool = nullptr; |
| 19 |
} |
| 20 |
|
| 21 |
void AutoreleasePool::drain() { |
| 22 |
[(NSAutoreleasePool*)fPool drain]; |
| 23 |
fPool = (void*)[[NSAutoreleasePool alloc] init]; |
| 24 |
} |