8a9a371182
This is a reland of a36e089065
This is only active when Metal is enabled.
Original change's description:
> Added AutoreleasePool for managing pool memory in testing apps.
>
> This is only active on MacOS and iOS -- on other platforms it
> will do nothing as they have no need for autorelease pools.
>
> Bug: skia:8243
> Change-Id: Ib74968dab6e3455a72e726429832101d0d410076
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217126
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:8243
Change-Id: I743a3dcc93b46387a6a330e855c2e8810b482544
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217379
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
26 lines
578 B
Plaintext
26 lines
578 B
Plaintext
/*
|
|
* Copyright 2019 Google LLC
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "include/core/SkTypes.h"
|
|
#include "tools/AutoreleasePool.h"
|
|
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
|
|
AutoreleasePool::AutoreleasePool() {
|
|
fPool = (void*)[[NSAutoreleasePool alloc] init];
|
|
}
|
|
|
|
AutoreleasePool::~AutoreleasePool() {
|
|
[(NSAutoreleasePool*)fPool release];
|
|
fPool = nullptr;
|
|
}
|
|
|
|
void AutoreleasePool::drain() {
|
|
[(NSAutoreleasePool*)fPool drain];
|
|
fPool = (void*)[[NSAutoreleasePool alloc] init];
|
|
}
|