-
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathDisposerPHV.mm
More file actions
44 lines (39 loc) · 1.25 KB
/
DisposerPHV.mm
File metadata and controls
44 lines (39 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// DisposerPHV.cpp
// NativeScript
//
// Created by Eduardo Speroni on 2/25/23.
// Copyright © 2023 Progress. All rights reserved.
//
#include "DisposerPHV.h"
#include "Constants.h"
#include "Helpers.h"
#include "ObjectManager.h"
using namespace tns;
void DisposerPHV::VisitPersistentHandle(
v8::Persistent<v8::Value>* value,
uint16_t class_id) {
// delete persistent handles on isolate disposal.
switch (class_id) {
case Constants::ClassTypes::DataWrapper: {
v8::HandleScope scope(isolate_);
// use ObjectManager anyway, as it handles a bigger variety of wrappers
ObjectManager::DisposeValue(isolate_, value->Get(isolate_), true);
break;
}
case Constants::ClassTypes::ObjectManagedValue: {
v8::HandleScope scope(isolate_);
ObjectManager::DisposeValue(isolate_, value->Get(isolate_), true);
if (value->IsWeak()) {
ObjectWeakCallbackState* state = value->ClearWeak<ObjectWeakCallbackState>();
state->target_->Reset();
delete state;
};
break;
}
default:
break;
}
if ( class_id== Constants::ClassTypes::DataWrapper ) {
}
}