chore: remove native_mate (Part 1) (#20085)
* move Destroyable utilities out of native_mate * do not set "destroy" in ObjectTemplateBuilder * remove ObjectTemplateBuilder::MakeDestroyable * do not pollute gin namespace * add more comments * remove hack of Arguments
This commit is contained in:
parent
96b42bddb8
commit
b601f3a031
17 changed files with 108 additions and 42 deletions
24
shell/common/gin_helper/destroyable.h
Normal file
24
shell/common/gin_helper/destroyable.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright (c) 2019 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_COMMON_GIN_HELPER_DESTROYABLE_H_
|
||||
#define SHELL_COMMON_GIN_HELPER_DESTROYABLE_H_
|
||||
|
||||
#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
|
||||
|
||||
#endif // SHELL_COMMON_GIN_HELPER_DESTROYABLE_H_
|
Loading…
Add table
Add a link
Reference in a new issue