summaryrefslogtreecommitdiff
path: root/core/object/ref_counted.cpp
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2021-07-08 16:16:02 -0300
committerreduz <reduzio@gmail.com>2021-07-08 17:08:12 -0300
commit44691448911f1d29d4d79dbdd5553734761e57c4 (patch)
treee94aef364ad141c1e96cb775eec1788b03bd8301 /core/object/ref_counted.cpp
parentd4e5fe6c44cecccd4f925707ccd5bbe1511184e5 (diff)
Redo how instance bindings work
* The harcoded 8 slots are no more and impose limits in the new extension system. * New system is limitless, although it will impose small performance hit with a mutex. * Use a token to request the instance binding. **Warning**: Mono will most likely break as a result of this, will need to be modified to use the new system.
Diffstat (limited to 'core/object/ref_counted.cpp')
-rw-r--r--core/object/ref_counted.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/core/object/ref_counted.cpp b/core/object/ref_counted.cpp
index 9862624972..2833f774dc 100644
--- a/core/object/ref_counted.cpp
+++ b/core/object/ref_counted.cpp
@@ -65,13 +65,8 @@ bool RefCounted::reference() {
if (_get_extension() && _get_extension()->reference) {
_get_extension()->reference(_get_extension_instance());
}
- if (instance_binding_count.get() > 0 && !ScriptServer::are_languages_finished()) {
- for (int i = 0; i < MAX_SCRIPT_INSTANCE_BINDINGS; i++) {
- if (_script_instance_bindings[i]) {
- ScriptServer::get_language(i)->refcount_incremented_instance_binding(this);
- }
- }
- }
+
+ _instance_binding_reference(true);
}
return success;
@@ -89,14 +84,8 @@ bool RefCounted::unreference() {
if (_get_extension() && _get_extension()->unreference) {
_get_extension()->unreference(_get_extension_instance());
}
- if (instance_binding_count.get() > 0 && !ScriptServer::are_languages_finished()) {
- for (int i = 0; i < MAX_SCRIPT_INSTANCE_BINDINGS; i++) {
- if (_script_instance_bindings[i]) {
- bool script_ret = ScriptServer::get_language(i)->refcount_decremented_instance_binding(this);
- die = die && script_ret;
- }
- }
- }
+
+ die = die && _instance_binding_reference(false);
}
return die;