// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef GIN_HANDLE_H_ #define GIN_HANDLE_H_ #include "base/memory/raw_ptr.h" #include "gin/converter.h" namespace gin { // You can use gin::Handle on the stack to retain a gin::Wrappable object. // Currently we don't have a mechanism for retaining a gin::Wrappable object // in the C++ heap because strong references from C++ to V8 can cause memory // leaks. template<typename T> class Handle { … }; Converter<gin::Handle<T>>; // This function is a convenient way to create a handle from a raw pointer // without having to write out the type of the object explicitly. template<typename T> gin::Handle<T> CreateHandle(v8::Isolate* isolate, T* object) { … } } // namespace gin #endif // GIN_HANDLE_H_