summaryrefslogtreecommitdiffstats
path: root/editor/debugger/editor_debugger_node.h
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2022-05-13 15:04:37 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-05-16 10:37:48 +0200
commit746dddc0673d7261f19b1e056e90e6e3a49ef33a (patch)
tree434b526eb286850ebccc6d2c998a7d90fdb8b5e2 /editor/debugger/editor_debugger_node.h
parent396def9b66c476f7834604adb7136ca903ed01be (diff)
downloadredot-engine-746dddc0673d7261f19b1e056e90e6e3a49ef33a.tar.gz
Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
Diffstat (limited to 'editor/debugger/editor_debugger_node.h')
-rw-r--r--editor/debugger/editor_debugger_node.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h
index b4fbb90301..40e9cf47f9 100644
--- a/editor/debugger/editor_debugger_node.h
+++ b/editor/debugger/editor_debugger_node.h
@@ -70,6 +70,14 @@ private:
String source;
int line = 0;
+ static uint32_t hash(const Breakpoint &p_val) {
+ uint32_t h = HashMapHasherDefault::hash(p_val.source);
+ return hash_djb2_one_32(p_val.line, h);
+ }
+ bool operator==(const Breakpoint &p_b) const {
+ return (line == p_b.line && source == p_b.source);
+ }
+
bool operator<(const Breakpoint &p_b) const {
if (line == p_b.line) {
return source < p_b.source;
@@ -102,9 +110,9 @@ private:
bool debug_with_external_editor = false;
bool hide_on_stop = true;
CameraOverride camera_override = OVERRIDE_NONE;
- Map<Breakpoint, bool> breakpoints;
+ HashMap<Breakpoint, bool, Breakpoint> breakpoints;
- Set<Ref<Script>> debugger_plugins;
+ RBSet<Ref<Script>> debugger_plugins;
ScriptEditorDebugger *_add_debugger();
EditorDebuggerRemoteObject *get_inspected_remote_object();