/* * Copyright 2016 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkAutoMalloc_DEFINED #define SkAutoMalloc_DEFINED #include "include/private/base/SkAlign.h" #include "include/private/base/SkAssert.h" #include "include/private/base/SkMalloc.h" #include "include/private/base/SkNoncopyable.h" #include <cstddef> #include <cstdint> #include <memory> /** * Manage an allocated block of heap memory. This object is the sole manager of * the lifetime of the block, so the caller must not call sk_free() or delete * on the block, unless release() was called. */ class SkAutoMalloc : SkNoncopyable { … }; /** * Manage an allocated block of memory. If the requested size is <= kSizeRequested (or slightly * more), then the allocation will come from the stack rather than the heap. This object is the * sole manager of the lifetime of the block, so the caller must not call sk_free() or delete on * the block. */ template <size_t kSizeRequested> class SkAutoSMalloc : SkNoncopyable { … }; // Can't guard the constructor because it's a template class. #endif