Skip to content

Commit 56bad11

Browse files
ScriptEditor: Remove obsolete completion cache
1 parent e37c626 commit 56bad11

File tree

4 files changed

+0
-85
lines changed

4 files changed

+0
-85
lines changed

core/object/script_language.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,6 @@ Vector<Ref<ScriptBacktrace>> ScriptServer::capture_script_backtraces(bool p_incl
548548

549549
////////////////////
550550

551-
ScriptCodeCompletionCache *ScriptCodeCompletionCache::singleton = nullptr;
552-
ScriptCodeCompletionCache::ScriptCodeCompletionCache() {
553-
singleton = this;
554-
}
555-
556551
void ScriptLanguage::get_core_type_words(List<String> *p_core_type_words) const {
557552
p_core_type_words->push_back("String");
558553
p_core_type_words->push_back("Vector2");

core/object/script_language.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,6 @@ class Script : public Resource {
196196
Script() {}
197197
};
198198

199-
class ScriptCodeCompletionCache {
200-
static ScriptCodeCompletionCache *singleton;
201-
202-
public:
203-
static ScriptCodeCompletionCache *get_singleton() { return singleton; }
204-
205-
ScriptCodeCompletionCache();
206-
207-
virtual ~ScriptCodeCompletionCache() {}
208-
};
209-
210199
class ScriptLanguage : public Object {
211200
GDCLASS(ScriptLanguage, Object)
212201

editor/plugins/script_editor_plugin.cpp

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -330,67 +330,6 @@ void ScriptEditorBase::_bind_methods() {
330330
ADD_SIGNAL(MethodInfo("go_to_method", PropertyInfo(Variant::OBJECT, "script"), PropertyInfo(Variant::STRING, "method")));
331331
}
332332

333-
class EditorScriptCodeCompletionCache : public ScriptCodeCompletionCache {
334-
struct Cache {
335-
uint64_t time_loaded = 0;
336-
Ref<Resource> cache;
337-
};
338-
339-
HashMap<String, Cache> cached;
340-
341-
public:
342-
uint64_t max_time_cache = 5 * 60 * 1000; //minutes, five
343-
uint32_t max_cache_size = 128;
344-
345-
void cleanup() {
346-
List<String> to_clean;
347-
348-
HashMap<String, Cache>::Iterator I = cached.begin();
349-
while (I) {
350-
if ((OS::get_singleton()->get_ticks_msec() - I->value.time_loaded) > max_time_cache) {
351-
to_clean.push_back(I->key);
352-
}
353-
++I;
354-
}
355-
356-
while (to_clean.front()) {
357-
cached.erase(to_clean.front()->get());
358-
to_clean.pop_front();
359-
}
360-
}
361-
362-
virtual Ref<Resource> get_cached_resource(const String &p_path) {
363-
HashMap<String, Cache>::Iterator E = cached.find(p_path);
364-
if (!E) {
365-
Cache c;
366-
c.cache = ResourceLoader::load(p_path);
367-
E = cached.insert(p_path, c);
368-
}
369-
370-
E->value.time_loaded = OS::get_singleton()->get_ticks_msec();
371-
372-
if (cached.size() > max_cache_size) {
373-
uint64_t older;
374-
HashMap<String, Cache>::Iterator O = cached.begin();
375-
older = O->value.time_loaded;
376-
HashMap<String, Cache>::Iterator I = O;
377-
while (I) {
378-
if (I->value.time_loaded < older) {
379-
older = I->value.time_loaded;
380-
O = I;
381-
}
382-
++I;
383-
}
384-
385-
if (O != E) { //should never happen..
386-
cached.remove(O);
387-
}
388-
}
389-
390-
return E->value.cache;
391-
}
392-
};
393-
394333
void ScriptEditorQuickOpen::popup_dialog(const Vector<String> &p_functions, bool p_dontclear) {
395334
popup_centered_ratio(0.6);
396335
if (p_dontclear) {
@@ -4170,7 +4109,6 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
41704109
script_editor_cache.instantiate();
41714110
script_editor_cache->load(EditorPaths::get_singleton()->get_project_settings_dir().path_join("script_editor_cache.cfg"));
41724111

4173-
completion_cache = memnew(EditorScriptCodeCompletionCache);
41744112
restoring_layout = false;
41754113
waiting_update_names = false;
41764114
pending_auto_reload = false;
@@ -4540,10 +4478,6 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
45404478
_update_online_doc();
45414479
}
45424480

4543-
ScriptEditor::~ScriptEditor() {
4544-
memdelete(completion_cache);
4545-
}
4546-
45474481
void ScriptEditorPlugin::_focus_another_editor() {
45484482
if (window_wrapper->get_window_enabled()) {
45494483
ERR_FAIL_COND(last_editor.is_empty());

editor/plugins/script_editor_plugin.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,6 @@ class ScriptEditor : public PanelContainer {
416416

417417
void _update_selected_editor_menu();
418418

419-
EditorScriptCodeCompletionCache *completion_cache = nullptr;
420-
421419
void _editor_stop();
422420

423421
int edit_pass;
@@ -601,7 +599,6 @@ class ScriptEditor : public PanelContainer {
601599
static void register_create_script_editor_function(CreateScriptEditorFunc p_func);
602600

603601
ScriptEditor(WindowWrapper *p_wrapper);
604-
~ScriptEditor();
605602
};
606603

607604
class ScriptEditorPlugin : public EditorPlugin {

0 commit comments

Comments
 (0)