AutoreleasePool.mm 578 B

12345678910111213141516171819202122232425
  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. #include "include/core/SkTypes.h"
  8. #include "tools/AutoreleasePool.h"
  9. #import <Foundation/NSAutoreleasePool.h>
  10. AutoreleasePool::AutoreleasePool() {
  11. fPool = (void*)[[NSAutoreleasePool alloc] init];
  12. }
  13. AutoreleasePool::~AutoreleasePool() {
  14. [(NSAutoreleasePool*)fPool release];
  15. fPool = nullptr;
  16. }
  17. void AutoreleasePool::drain() {
  18. [(NSAutoreleasePool*)fPool drain];
  19. fPool = (void*)[[NSAutoreleasePool alloc] init];
  20. }