Jim Van Verth | 8a9a371 | 2019-05-31 10:49:12 -0400 | [diff] [blame] | 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 "include/core/SkTypes.h" |
| 9 | #include "tools/AutoreleasePool.h" |
| 10 | |
| 11 | #import <Foundation/NSAutoreleasePool.h> |
| 12 | |
| 13 | AutoreleasePool::AutoreleasePool() { |
| 14 | fPool = (void*)[[NSAutoreleasePool alloc] init]; |
| 15 | } |
| 16 | |
| 17 | AutoreleasePool::~AutoreleasePool() { |
| 18 | [(NSAutoreleasePool*)fPool release]; |
| 19 | fPool = nullptr; |
| 20 | } |
| 21 | |
| 22 | void AutoreleasePool::drain() { |
| 23 | [(NSAutoreleasePool*)fPool drain]; |
| 24 | fPool = (void*)[[NSAutoreleasePool alloc] init]; |
| 25 | } |