// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_FML_MEMORY_REF_PTR_INTERNAL_H_ #define FLUTTER_FML_MEMORY_REF_PTR_INTERNAL_H_ #include #include "flutter/fml/macros.h" namespace fml { template class RefPtr; template RefPtr AdoptRef(T* ptr); namespace internal { // This is a wrapper class that can be friended for a particular |T|, if you // want to make |T|'s constructor private, but still use |MakeRefCounted()| // (below). (You can't friend partial specializations.) See |MakeRefCounted()| // and |FML_FRIEND_MAKE_REF_COUNTED()|. template class MakeRefCountedHelper final { public: template static RefPtr MakeRefCounted(Args&&... args) { return AdoptRef(new T(std::forward(args)...)); } }; } // namespace internal } // namespace fml #endif // FLUTTER_FML_MEMORY_REF_PTR_INTERNAL_H_