destroyable.h 767 B

123456789101112131415161718192021222324
  1. // Copyright (c) 2019 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_DESTROYABLE_H_
  5. #define ELECTRON_SHELL_COMMON_GIN_HELPER_DESTROYABLE_H_
  6. #include "v8/include/v8.h"
  7. namespace gin_helper {
  8. // Manage the native object wrapped in JS wrappers.
  9. struct Destroyable {
  10. // Determine whether the native object has been destroyed.
  11. static bool IsDestroyed(v8::Local<v8::Object> object);
  12. // Add "destroy" and "isDestroyed" to prototype chain.
  13. static void MakeDestroyable(v8::Isolate* isolate,
  14. v8::Local<v8::FunctionTemplate> prototype);
  15. };
  16. } // namespace gin_helper
  17. #endif // ELECTRON_SHELL_COMMON_GIN_HELPER_DESTROYABLE_H_