Remove usage of MarkIndependent api
https://bugs.chromium.org/p/chromium/issues/detail?id=780749 Use Active/Not Active as indicator whether the Scavenger can drop wrappers
This commit is contained in:
Родитель
6a3d238b7e
Коммит
894c96f39f
|
@ -10,9 +10,7 @@
|
|||
|
||||
namespace mate {
|
||||
|
||||
WrappableBase::WrappableBase()
|
||||
: isolate_(nullptr), high_memory_(false) {
|
||||
}
|
||||
WrappableBase::WrappableBase() : isolate_(nullptr) {}
|
||||
|
||||
WrappableBase::~WrappableBase() {
|
||||
if (wrapper_.IsEmpty())
|
||||
|
@ -38,9 +36,6 @@ void WrappableBase::InitWith(v8::Isolate* isolate,
|
|||
wrapper_.Reset(isolate, wrapper);
|
||||
wrapper_.SetWeak(this, FirstWeakCallback, v8::WeakCallbackType::kParameter);
|
||||
|
||||
if (high_memory_)
|
||||
wrapper_.MarkIndependent();
|
||||
|
||||
// Call object._init if we have one.
|
||||
v8::Local<v8::Function> init;
|
||||
if (Dictionary(isolate, wrapper).Get("_init", &init))
|
||||
|
@ -49,22 +44,12 @@ void WrappableBase::InitWith(v8::Isolate* isolate,
|
|||
AfterInit(isolate);
|
||||
}
|
||||
|
||||
void WrappableBase::MarkHighMemoryUsage() {
|
||||
high_memory_ = true;
|
||||
if (!wrapper_.IsEmpty())
|
||||
wrapper_.MarkIndependent();
|
||||
}
|
||||
|
||||
// static
|
||||
void WrappableBase::FirstWeakCallback(
|
||||
const v8::WeakCallbackInfo<WrappableBase>& data) {
|
||||
WrappableBase* wrappable = data.GetParameter();
|
||||
wrappable->wrapper_.Reset();
|
||||
if (wrappable->high_memory_) {
|
||||
delete wrappable;
|
||||
} else {
|
||||
data.SetSecondPassCallback(SecondWeakCallback);
|
||||
}
|
||||
data.SetSecondPassCallback(SecondWeakCallback);
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -44,10 +44,6 @@ class WrappableBase {
|
|||
// This method should only be called by classes using Constructor.
|
||||
virtual void InitWith(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
|
||||
|
||||
// Marks wrapped object as high memory usage
|
||||
// Deletes the wrapped object on the first round of GC callbacks
|
||||
virtual void MarkHighMemoryUsage();
|
||||
|
||||
private:
|
||||
friend struct internal::Destroyable;
|
||||
|
||||
|
@ -58,7 +54,6 @@ class WrappableBase {
|
|||
|
||||
v8::Isolate* isolate_;
|
||||
v8::Global<v8::Object> wrapper_; // Weak
|
||||
bool high_memory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WrappableBase);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче