blob: 6116115c11fe2f37808c06e88b40f8ab58a579c0 [file] [log] [blame]
Jim Van Verth8a9a3712019-05-31 10:49:12 -04001/*
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
13AutoreleasePool::AutoreleasePool() {
14 fPool = (void*)[[NSAutoreleasePool alloc] init];
15}
16
17AutoreleasePool::~AutoreleasePool() {
18 [(NSAutoreleasePool*)fPool release];
19 fPool = nullptr;
20}
21
22void AutoreleasePool::drain() {
23 [(NSAutoreleasePool*)fPool drain];
24 fPool = (void*)[[NSAutoreleasePool alloc] init];
25}