aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/c_src/wxe_helpers.h
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2015-04-13 15:58:22 +0200
committerDan Gudmundsson <[email protected]>2015-05-05 09:30:10 +0200
commit3e12120327654e7e66f7ae09cd3929cb1132766c (patch)
treed78edae0bb4e36028b8c87aba690ea50933975ef /lib/wx/c_src/wxe_helpers.h
parentec794a22a3d5837c0dca35badf8af7bf841130ba (diff)
downloadotp-3e12120327654e7e66f7ae09cd3929cb1132766c.tar.gz
otp-3e12120327654e7e66f7ae09cd3929cb1132766c.tar.bz2
otp-3e12120327654e7e66f7ae09cd3929cb1132766c.zip
wx: Optimize command queues
Remove allocations
Diffstat (limited to 'lib/wx/c_src/wxe_helpers.h')
-rw-r--r--lib/wx/c_src/wxe_helpers.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/wx/c_src/wxe_helpers.h b/lib/wx/c_src/wxe_helpers.h
index 659bc666c6..ec3a5debdb 100644
--- a/lib/wx/c_src/wxe_helpers.h
+++ b/lib/wx/c_src/wxe_helpers.h
@@ -39,14 +39,14 @@ class wxeMetaCommand : public wxEvent
ErlDrvPDL pdl;
};
-class wxeCommand : public wxObject
+class wxeCommand
{
public:
- wxeCommand(int fc,char * cbuf,int buflen, wxe_data *);
+ wxeCommand();
virtual ~wxeCommand(); // Use Delete()
- wxeCommand * Save() {ref_count++; return this; };
- void Delete() {if(--ref_count < 1) delete this;};
+ wxeCommand * Save() { return this; };
+ void Delete();
ErlDrvTermData caller;
ErlDrvTermData port;
@@ -54,7 +54,27 @@ class wxeCommand : public wxObject
char * buffer;
int len;
int op;
- int ref_count;
+ char c_buf[64]; // 64b covers 90% of usage
+};
+
+class wxeFifo {
+ public:
+ wxeFifo(unsigned int size);
+ virtual ~wxeFifo();
+
+ void Add(int fc, char * cbuf,int buflen, wxe_data *);
+ void Append(wxeCommand *Other);
+
+ wxeCommand * Get();
+
+ void Realloc();
+
+ unsigned int m_max;
+ unsigned int m_first;
+ unsigned int m_n;
+ unsigned int m_orig_sz;
+ wxeCommand *m_q;
+ wxeCommand *m_old;
};
class intListElement {