AutoreleasePool.h 640 B

123456789101112131415161718192021222324252627282930313233343536
  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. #ifndef SkAutoreleasePool_DEFINED
  8. #define SkAutoreleasePool_DEFINED
  9. /*
  10. * Helper class for managing an autorelease pool for Metal. On other platforms this will
  11. * do nothing so there's no need to #ifdef it out.
  12. */
  13. #ifdef SK_METAL
  14. class AutoreleasePool {
  15. public:
  16. AutoreleasePool();
  17. ~AutoreleasePool();
  18. void drain();
  19. private:
  20. void* fPool;
  21. };
  22. #else
  23. class AutoreleasePool {
  24. public:
  25. AutoreleasePool() {}
  26. ~AutoreleasePool() = default;
  27. void drain() {}
  28. };
  29. #endif
  30. #endif