]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - wtf/wx/MainThreadWx.cpp
JavaScriptCore-721.26.tar.gz
[apple/javascriptcore.git] / wtf / wx / MainThreadWx.cpp
index bcd5f0591daa58eda557682996d468c9d896b244..e1d15c96f6eb447904b52e95d0fd4dc07d2af598 100644 (file)
 #include "config.h"
 #include "MainThread.h"
 
+#include <wx/defs.h>
+#include <wx/app.h>
+#include <wx/event.h>
+
+const wxEventType wxEVT_CALL_AFTER = wxNewEventType();
+
+class wxCallAfter : public wxEvtHandler
+{
+public:
+    wxCallAfter() 
+        : wxEvtHandler()
+        {
+            wxTheApp->Connect(-1, -1, wxEVT_CALL_AFTER, wxCommandEventHandler(wxCallAfter::OnCallback));
+            wxCommandEvent event(wxEVT_CALL_AFTER);
+            wxPostEvent(wxTheApp, event);
+        }
+        
+    void OnCallback(wxCommandEvent& event)
+    {
+        WTF::dispatchFunctionsFromMainThread();
+    }
+};
+
 namespace WTF {
 
 void initializeMainThreadPlatform()
@@ -37,6 +60,7 @@ void initializeMainThreadPlatform()
 
 void scheduleDispatchFunctionsOnMainThread()
 {
+    wxCallAfter();
 }
 
 } // namespace WTF