xref: /aosp_15_r20/external/skia/tools/AutoreleasePool.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 #ifndef SkAutoreleasePool_DEFINED
9 #define SkAutoreleasePool_DEFINED
10 
11 /*
12  * Helper class for managing an autorelease pool for Metal. On other platforms this will
13  * do nothing so there's no need to #ifdef it out.
14  */
15 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
16 class AutoreleasePool {
17 public:
18     AutoreleasePool();
19     ~AutoreleasePool();
20 
21     void drain();
22 
23 private:
24     void* fPool;
25 };
26 #else
27 class AutoreleasePool {
28 public:
AutoreleasePool()29     AutoreleasePool() {}
30     ~AutoreleasePool() = default;
31 
drain()32     void drain() {}
33 };
34 #endif
35 
36 #endif
37