2019-09-04 02:14:16 +00:00
|
|
|
// Copyright (c) 2019 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_DESTROYABLE_H_
|
|
|
|
#define ELECTRON_SHELL_COMMON_GIN_HELPER_DESTROYABLE_H_
|
2019-09-04 02:14:16 +00:00
|
|
|
|
|
|
|
#include "v8/include/v8.h"
|
|
|
|
|
|
|
|
namespace gin_helper {
|
|
|
|
|
|
|
|
// Manage the native object wrapped in JS wrappers.
|
|
|
|
struct Destroyable {
|
|
|
|
// Determine whether the native object has been destroyed.
|
|
|
|
static bool IsDestroyed(v8::Local<v8::Object> object);
|
|
|
|
|
|
|
|
// Add "destroy" and "isDestroyed" to prototype chain.
|
|
|
|
static void MakeDestroyable(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::FunctionTemplate> prototype);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gin_helper
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_COMMON_GIN_HELPER_DESTROYABLE_H_
|