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 | #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 | #ifdef SK_METAL |
| 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: |
| 29 | AutoreleasePool() {} |
| 30 | ~AutoreleasePool() = default; |
| 31 | |
| 32 | void drain() {} |
| 33 | }; |
| 34 | #endif |
| 35 | |
| 36 | #endif |