skia2/tools/AutoreleasePool.h
Jim Van Verth 8a9a371182 Reland "Added AutoreleasePool for managing pool memory in testing apps."
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>
2019-05-31 15:40:01 +00:00

37 lines
640 B
C++

/*
* Copyright 2019 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkAutoreleasePool_DEFINED
#define SkAutoreleasePool_DEFINED
/*
* Helper class for managing an autorelease pool for Metal. On other platforms this will
* do nothing so there's no need to #ifdef it out.
*/
#ifdef SK_METAL
class AutoreleasePool {
public:
AutoreleasePool();
~AutoreleasePool();
void drain();
private:
void* fPool;
};
#else
class AutoreleasePool {
public:
AutoreleasePool() {}
~AutoreleasePool() = default;
void drain() {}
};
#endif
#endif