From 78f8d4b9e8fdb09055c04e82e30b6a0290795339 Mon Sep 17 00:00:00 2001 From: Yonit Halperin Date: Sun, 8 Nov 2009 16:34:12 +0200 Subject: spice client: creating a general process loop. The process loop is responsible for: 1) waiting for events 2) timers 3) events queue for actions that should be performed in the context of the thread and are pushed from other threads. The benefits: 1) remove duplicity: till now, there was one implementaion of events loop for the channels and another one for the main thread. 2) timers can be executed on each thread and not only on the main thread. 3) events can be pushed to each thread and not only to the main thread. In this commit, only the main thread was modified to use the new process loop. --- client/display_channel.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'client/display_channel.cpp') diff --git a/client/display_channel.cpp b/client/display_channel.cpp index 2e2e4f56..e9d4f192 100644 --- a/client/display_channel.cpp +++ b/client/display_channel.cpp @@ -54,11 +54,12 @@ public: { } - virtual void do_responce(Application& application) + virtual void do_response(AbstractProcessLoop& events_loop) { + Application* app = (Application*)events_loop.get_owner(); _channel.destroy_canvas(); _channel.screen()->set_mode(_width, _height, _depth); - _channel.create_canvas(application.get_canvas_types(), _width, _height, _depth); + _channel.create_canvas(app->get_canvas_types(), _width, _height, _depth); } private: @@ -75,9 +76,9 @@ public: { } - virtual void responce(Application& application) + virtual void response(AbstractProcessLoop& events_loop) { - application.hide_splash(_screen_id); + static_cast(events_loop.get_owner())->hide_splash(_screen_id); } private: @@ -831,7 +832,7 @@ public: ASSERT(_timer == INVALID_TIMER); } - virtual void do_responce(Application& application) + virtual void do_response(AbstractProcessLoop& events_loop) { if ((_timer = Platform::create_interval_timer(_proc, _user_data)) == INVALID_TIMER) { THROW("create timer failed"); @@ -850,7 +851,7 @@ class DestroyTimerEvent: public Event { public: DestroyTimerEvent(TimerID timer) : _timer (timer) {} - virtual void responce(Application& application) + virtual void response(AbstractProcessLoop& events_loop) { Platform::destroy_interval_timer(_timer); } @@ -866,7 +867,7 @@ public: { } - virtual void responce(Application& application) + virtual void response(AbstractProcessLoop& events_loop) { _channel.activate_streams_timer(); } -- cgit