summaryrefslogtreecommitdiffstats
path: root/client/windows
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2009-11-08 16:34:12 +0200
committerYaniv Kamay <ykamay@redhat.com>2009-11-09 14:39:33 +0200
commit8d5b738ba169c44d223ab6d99ec12e763ce5bc8e (patch)
tree3c1d4dd1b3c32f9a03dd456ea921a66ed7f6c7fd /client/windows
parent082934699611d5985ecf3386259d270d75e41c12 (diff)
downloadspice-8d5b738ba169c44d223ab6d99ec12e763ce5bc8e.tar.gz
spice-8d5b738ba169c44d223ab6d99ec12e763ce5bc8e.tar.xz
spice-8d5b738ba169c44d223ab6d99ec12e763ce5bc8e.zip
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.
Diffstat (limited to 'client/windows')
-rw-r--r--client/windows/event_sources_p.cpp209
-rw-r--r--client/windows/event_sources_p.h52
-rw-r--r--client/windows/events_loop_p.h8
-rw-r--r--client/windows/named_pipe.cpp33
-rw-r--r--client/windows/named_pipe.h20
-rw-r--r--client/windows/platform.cpp227
-rw-r--r--client/windows/redc.vcproj20
-rw-r--r--client/windows/win_platform.h16
8 files changed, 362 insertions, 223 deletions
diff --git a/client/windows/event_sources_p.cpp b/client/windows/event_sources_p.cpp
new file mode 100644
index 00000000..4a11b779
--- /dev/null
+++ b/client/windows/event_sources_p.cpp
@@ -0,0 +1,209 @@
+/*
+ Copyright (C) 2009 Red Hat, Inc.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "common.h"
+#include "event_sources.h"
+#include "debug.h"
+#include "utils.h"
+
+bool EventSources_p::process_system_events()
+{
+ MSG msg;
+ while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
+
+ if (msg.message == WM_QUIT) {
+ return true;
+ }
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ return false;
+}
+
+void EventSources_p::add_event(HANDLE event, EventSource* source)
+{
+ int size = _events.size();
+ _events.resize(size + 1);
+ _handles.resize(size + 1);
+ _events[size] = source;
+ _handles[size] = event;
+}
+
+void EventSources_p::remove_event(EventSource* source)
+{
+ int size = _events.size();
+ for (int i = 0; i < size; i++) {
+ if (_events[i] == source) {
+ for (i++; i < size; i++) {
+ _events[i - 1] = _events[i];
+ _handles[i - 1] = _handles[i];
+ }
+ _events.resize(size - 1);
+ _handles.resize(size - 1);
+ return;
+ }
+ }
+ THROW("event not found");
+}
+
+EventSources::EventSources()
+{
+}
+
+EventSources::~EventSources()
+{
+}
+
+bool EventSources::wait_events(int timeout_ms)
+{
+ if (_handles.empty()) {
+ if (WaitMessage()) {
+ return process_system_events();
+ } else {
+ THROW("wait failed %d", GetLastError());
+ }
+ }
+
+ DWORD wait_res = MsgWaitForMultipleObjectsEx(_handles.size(), &_handles[0], timeout_ms,
+ QS_ALLINPUT, 0);
+ if (wait_res == WAIT_TIMEOUT) {
+ return false;
+ }
+
+ if (wait_res == WAIT_FAILED) {
+ THROW("wait failed %d", GetLastError());
+ }
+
+ int event_index = wait_res - WAIT_OBJECT_0;
+ if (event_index == _handles.size()) {
+ return process_system_events();
+ } else if ((event_index >= 0) && (event_index < (int)_handles.size())) {
+ _events[event_index]->action();
+ return false;
+ } else {
+ THROW("invalid event id");
+ }
+}
+
+void EventSources::add_socket(Socket& socket)
+{
+ HANDLE event = CreateEvent(NULL, FALSE, FALSE, NULL);
+ if (!event) {
+ THROW("create event failed");
+ }
+ if (WSAEventSelect(socket.get_socket(), event,
+ FD_READ | FD_WRITE | FD_CLOSE) == SOCKET_ERROR) {
+ CloseHandle(event);
+ THROW("event select failed");
+ }
+ add_event(event, &socket);
+}
+
+void EventSources::remove_socket(Socket& socket)
+{
+ int size = _events.size();
+ for (int i = 0; i < size; i++) {
+ if (_events[i] == &socket) {
+ if (WSAEventSelect(socket.get_socket(), NULL, 0) == SOCKET_ERROR) {
+ THROW("event select failed");
+ }
+ u_long arg = 0;
+ if (ioctlsocket(socket.get_socket(), FIONBIO, &arg) == SOCKET_ERROR) {
+ THROW("set blocking mode failed");
+ }
+ CloseHandle(_handles[i]);
+ for (i++; i < size; i++) {
+ _events[i - 1] = _events[i];
+ _handles[i - 1] = _handles[i];
+ }
+ _events.resize(size - 1);
+ _handles.resize(size - 1);
+ return;
+ }
+ }
+ THROW("socket not found");
+}
+
+void EventSources::add_handle(Handle& handle)
+{
+ add_event(handle.get_handle(), &handle);
+}
+
+void EventSources::remove_handle(Handle& handle)
+{
+ remove_event(&handle);
+}
+
+Handle_p::Handle_p()
+{
+ if (!(_event = CreateEvent(NULL, FALSE, FALSE, NULL))) {
+ THROW("create event failed");
+ }
+}
+
+Handle_p::~Handle_p()
+{
+ CloseHandle(_event);
+}
+
+void EventSources::add_trigger(Trigger& trigger)
+{
+ add_event(trigger.get_handle(), &trigger);
+}
+
+void EventSources::remove_trigger(Trigger& trigger)
+{
+ remove_event(&trigger);
+}
+
+
+EventSources::Trigger::Trigger()
+{
+}
+
+EventSources::Trigger::~Trigger()
+{
+}
+
+
+void EventSources::Trigger::trigger()
+{
+ if (!SetEvent(_event)) {
+ THROW("set event failed");
+ }
+}
+
+void EventSources::Trigger::reset()
+{
+ if (!ResetEvent(_event)) {
+ THROW("set event failed");
+ }
+}
+
+void EventSources::Trigger::action()
+{
+ on_event();
+}
+
+void EventSources::add_file(File& file)
+{
+}
+
+void EventSources::remove_file(File& file)
+{
+}
+
diff --git a/client/windows/event_sources_p.h b/client/windows/event_sources_p.h
new file mode 100644
index 00000000..3477605e
--- /dev/null
+++ b/client/windows/event_sources_p.h
@@ -0,0 +1,52 @@
+/*
+ Copyright (C) 2009 Red Hat, Inc.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _H_EVENT_SOURCES_P
+#define _H_EVENT_SOURCES_P
+
+#include "common.h"
+
+#include <vector>
+
+class EventSource;
+class Handle_p;
+
+class EventSources_p {
+protected:
+ /* return true if quit should be performed */
+ bool process_system_events();
+ void add_event(HANDLE event, EventSource* source);
+ void remove_event(EventSource* source);
+public:
+ std::vector<EventSource*> _events;
+ std::vector<HANDLE> _handles;
+};
+
+class Handle_p {
+public:
+ Handle_p();
+ virtual ~Handle_p();
+ HANDLE get_handle() { return _event;}
+protected:
+ HANDLE _event;
+};
+
+class Trigger_p: public Handle_p {
+};
+
+#endif
+
diff --git a/client/windows/events_loop_p.h b/client/windows/events_loop_p.h
index 8361398d..6bac7b94 100644
--- a/client/windows/events_loop_p.h
+++ b/client/windows/events_loop_p.h
@@ -22,15 +22,17 @@
#include <vector>
-class EventSource;
+class EventSourceOld;
class EventsLoop_p {
public:
- std::vector<EventSource*> _events;
+ class Trigger_p;
+public:
+ std::vector<EventSourceOld*> _events;
std::vector<HANDLE> _handles;
};
-class Trigger_p {
+class EventsLoop_p::Trigger_p {
public:
HANDLE get_handle() { return event;}
diff --git a/client/windows/named_pipe.cpp b/client/windows/named_pipe.cpp
index f33c476e..44459fab 100644
--- a/client/windows/named_pipe.cpp
+++ b/client/windows/named_pipe.cpp
@@ -20,23 +20,22 @@
#include "utils.h"
#include "debug.h"
-PipeBuffer::PipeBuffer(HANDLE pipe)
+PipeBuffer::PipeBuffer(HANDLE pipe, ProcessLoop& process_loop)
: _handler (NULL)
, _pipe (pipe)
, _start (0)
, _end (0)
, _pending (false)
+ , _process_loop(process_loop)
{
ZeroMemory(&_overlap, sizeof(_overlap));
- _overlap.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- _event_handle = _overlap.hEvent;
- WinPlatform::add_event(*this);
+ _overlap.hEvent = this->get_handle();
+ _process_loop.add_handle(*this);
}
PipeBuffer::~PipeBuffer()
{
- WinPlatform::remove_event(*this);
- CloseHandle(_event_handle);
+ _process_loop.remove_handle(*this);
}
DWORD PipeBuffer::get_overlapped_bytes()
@@ -127,10 +126,10 @@ void PipeWriter::on_event()
}
}
-WinConnection::WinConnection(HANDLE pipe)
+WinConnection::WinConnection(HANDLE pipe, ProcessLoop& process_loop)
: _pipe (pipe)
- , _writer (pipe)
- , _reader (pipe)
+ , _writer (pipe, process_loop)
+ , _reader (pipe, process_loop)
{
}
@@ -158,24 +157,24 @@ void WinConnection::set_handler(NamedPipe::ConnectionInterface* handler)
_writer.set_handler(handler);
}
-WinListener::WinListener(const char *name, NamedPipe::ListenerInterface &listener_interface)
+WinListener::WinListener(const char *name, NamedPipe::ListenerInterface &listener_interface,
+ ProcessLoop& process_loop)
: _listener_interface (listener_interface)
, _pipe (0)
+ , _process_loop (process_loop)
{
_pipename = new TCHAR[PIPE_MAX_NAME_LEN];
swprintf_s(_pipename, PIPE_MAX_NAME_LEN, L"%s%S", PIPE_PREFIX, name);
ZeroMemory(&_overlap, sizeof(_overlap));
- _overlap.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- _event_handle = _overlap.hEvent;
- WinPlatform::add_event(*this);
+ _overlap.hEvent = this->get_handle();
+ _process_loop.add_handle(*this);
create_pipe();
}
WinListener::~WinListener()
{
CancelIo(_pipe);
- WinPlatform::remove_event(*this);
- CloseHandle(_event_handle);
+ _process_loop.remove_handle(*this);
delete[] _pipename;
}
@@ -188,7 +187,7 @@ void WinListener::on_event()
return;
}
DBG(0, "Pipe connected 0x%p", _pipe);
- WinConnection *con = new WinConnection(_pipe);
+ WinConnection *con = new WinConnection(_pipe, _process_loop);
NamedPipe::ConnectionInterface &con_interface = _listener_interface.create();
con->set_handler(&con_interface);
con_interface.bind((NamedPipe::ConnectionRef)con);
@@ -213,7 +212,7 @@ void WinListener::create_pipe()
break;
case ERROR_PIPE_CONNECTED: {
DBG(0, "Pipe already connected");
- WinConnection *con = new WinConnection(_pipe);
+ WinConnection *con = new WinConnection(_pipe, _process_loop);
NamedPipe::ConnectionInterface &con_interface = _listener_interface.create();
con->set_handler(&con_interface);
con_interface.bind((NamedPipe::ConnectionRef)con);
diff --git a/client/windows/named_pipe.h b/client/windows/named_pipe.h
index 578c34d2..fcdc0dd7 100644
--- a/client/windows/named_pipe.h
+++ b/client/windows/named_pipe.h
@@ -19,8 +19,9 @@
#define _H_NAMED_PIPE
#include <windows.h>
+#include "process_loop.h"
+#include "event_sources.h"
#include "platform.h"
-#include "win_platform.h"
#define PIPE_TIMEOUT 5000
#define PIPE_BUF_SIZE 8192
@@ -29,9 +30,9 @@
class WinConnection;
-class PipeBuffer: public EventOwner {
+class PipeBuffer: public EventSources::Handle {
public:
- PipeBuffer(HANDLE pipe);
+ PipeBuffer(HANDLE pipe, ProcessLoop& process_loop);
~PipeBuffer();
void set_handler(NamedPipe::ConnectionInterface* handler) { _handler = handler;}
DWORD get_overlapped_bytes();
@@ -44,25 +45,26 @@ protected:
uint32_t _end;
uint8_t _data[PIPE_BUF_SIZE];
bool _pending;
+ ProcessLoop& _process_loop;
};
class PipeReader: public PipeBuffer {
public:
- PipeReader(HANDLE pipe) : PipeBuffer(pipe) {}
+ PipeReader(HANDLE pipe, ProcessLoop& process_loop) : PipeBuffer(pipe, process_loop) {}
int32_t read(uint8_t *buf, int32_t size);
void on_event();
};
class PipeWriter: public PipeBuffer {
public:
- PipeWriter(HANDLE pipe) : PipeBuffer(pipe) {}
+ PipeWriter(HANDLE pipe, ProcessLoop& process_loop) : PipeBuffer(pipe, process_loop) {}
int32_t write(const uint8_t *buf, int32_t size);
void on_event();
};
class WinConnection {
public:
- WinConnection(HANDLE pipe);
+ WinConnection(HANDLE pipe, ProcessLoop& process_loop);
~WinConnection();
int32_t read(uint8_t *buf, int32_t size);
int32_t write(const uint8_t *buf, int32_t size);
@@ -74,9 +76,10 @@ private:
PipeReader _reader;
};
-class WinListener: public EventOwner {
+class WinListener: public EventSources::Handle {
public:
- WinListener(const char *name, NamedPipe::ListenerInterface &listener_interface);
+ WinListener(const char *name, NamedPipe::ListenerInterface &listener_interface,
+ ProcessLoop& process_loop);
~WinListener();
void on_event();
@@ -88,6 +91,7 @@ private:
NamedPipe::ListenerInterface &_listener_interface;
OVERLAPPED _overlap;
HANDLE _pipe;
+ ProcessLoop& _process_loop;
};
#endif
diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index 773fa614..b5faf758 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -28,9 +28,6 @@
#include "cursor.h"
#include "named_pipe.h"
-#define WM_USER_WAKEUP WM_USER
-#define NUM_TIMERS 100
-
int gdi_handlers = 0;
extern HINSTANCE instance;
@@ -44,61 +41,17 @@ public:
static DefaultEventListener default_event_listener;
static Platform::EventListener* event_listener = &default_event_listener;
static HWND paltform_win;
-static HANDLE main_tread;
-
-struct Timer {
- TimerID id;
- timer_proc_t proc;
- void* opaque;
- Timer *next;
-};
-
-Timer timers[NUM_TIMERS];
-Timer* free_timers = NULL;
-Mutex timers_lock;
-
-static void free_timer(Timer* timer)
-{
- Lock lock(timers_lock);
- timer->proc = NULL;
- timer->next = free_timers;
- free_timers = timer;
-}
+static ProcessLoop* main_loop = NULL;
-static void init_timers()
-{
- for (int i = 0; i < NUM_TIMERS; i++) {
- timers[i].id = i;
- free_timer(&timers[i]);
- }
-}
-
-static Timer* alloc_timer()
+void Platform::send_quit_request()
{
- Timer* timer;
-
- Lock lock(timers_lock);
- if (!(timer = free_timers)) {
- return NULL;
- }
-
- free_timers = free_timers->next;
- return timer;
+ ASSERT(main_loop);
+ main_loop->quit(0);
}
static LRESULT CALLBACK PlatformWinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
- case WM_TIMER: {
- TimerID id = wParam - 1;
- ASSERT(id < NUM_TIMERS);
- Timer* timer = &timers[id];
- timer->proc(timer->opaque, id);
- break;
- }
- case WM_USER_WAKEUP: {
- break;
- }
case WM_ACTIVATEAPP:
if (wParam) {
event_listener->on_app_activated();
@@ -147,80 +100,21 @@ static void create_message_wind()
paltform_win = window;
}
-void Platform::send_quit_request()
-{
- ASSERT(GetCurrentThread() == main_tread);
- PostQuitMessage(0);
-}
-
-static std::vector<HANDLE> events;
-static std::vector<EventOwner*> events_owners;
-
-void WinPlatform::add_event(EventOwner& event_owner)
-{
- ASSERT(main_tread == GetCurrentThread());
- int size = events.size();
- if (size == MAXIMUM_WAIT_OBJECTS - 1) {
- THROW("reached maximum allowed events to wait for");
- }
- events.resize(size + 1);
- events_owners.resize(size + 1);
- events[size] = event_owner.get_event_handle();
- events_owners[size] = &event_owner;
-}
-
-void WinPlatform::remove_event(EventOwner& event_owner)
-{
- ASSERT(main_tread == GetCurrentThread());
- int size = events.size();
- for (int i = 0; i < size; i++) {
- if (events_owners[i] == &event_owner) {
- for (i++; i < size; i++) {
- events[i - 1] = events[i];
- events_owners[i - 1] = events_owners[i];
- }
- events.resize(size - 1);
- events_owners.resize(size - 1);
- return;
- }
- }
- THROW("event owner not found");
-}
-
-void Platform::wait_events()
-{
- if (!events.size()) {
- if (!WaitMessage()) {
- THROW("wait failed %d", GetLastError());
- }
- return;
- }
-
- DWORD r = MsgWaitForMultipleObjectsEx(events.size(), &events[0], INFINITE, QS_ALLINPUT, 0);
- if (r == WAIT_OBJECT_0 + events.size()) {
- return;
- }
- if (r >= WAIT_OBJECT_0 && r <= WAIT_OBJECT_0 + events.size() - 1) {
- events_owners[r - WAIT_OBJECT_0]->on_event();
- } else if (r == WAIT_FAILED) {
- THROW("wait multiple failed %d", GetLastError());
- } else {
- THROW("unexpected wait return %u", r);
- }
-}
-
NamedPipe::ListenerRef NamedPipe::create(const char *name, ListenerInterface& listener_interface)
{
- return (ListenerRef)(new WinListener(name, listener_interface));
+ ASSERT(main_loop && main_loop->is_same_thread(pthread_self()));
+ return (ListenerRef)(new WinListener(name, listener_interface, *main_loop));
}
void NamedPipe::destroy(ListenerRef listener_ref)
{
+ ASSERT(main_loop && main_loop->is_same_thread(pthread_self()));
delete (WinListener *)listener_ref;
}
void NamedPipe::destroy_connection(ConnectionRef conn_ref)
{
+ ASSERT(main_loop && main_loop->is_same_thread(pthread_self()));
delete (WinConnection *)conn_ref;
}
@@ -234,26 +128,6 @@ int32_t NamedPipe::write(ConnectionRef conn_ref, const uint8_t *buf, int32_t siz
return ((WinConnection *)conn_ref)->write(buf, size);
}
-void Platform::wakeup()
-{
- if (!PostMessage(paltform_win, WM_USER_WAKEUP, 0, 0)) {
- THROW("post failed %d", GetLastError());
- }
-}
-
-bool Platform::process_events()
-{
- MSG msg;
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
- if (msg.message == WM_QUIT) {
- return true;
- }
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return false;
-}
-
void Platform::msleep(unsigned int msec)
{
Sleep(msec);
@@ -302,48 +176,6 @@ void Platform::set_event_listener(EventListener* listener)
event_listener = listener ? listener : &default_event_listener;
}
-TimerID Platform::create_interval_timer(timer_proc_t proc, void* opaque)
-{
- Timer* timer = alloc_timer();
- if (!timer) {
- return INVALID_TIMER;
- }
- timer->proc = proc;
- timer->opaque = opaque;
- return timer->id;
-}
-
-bool Platform::activate_interval_timer(TimerID timer, unsigned int millisec)
-{
- if (timer >= NUM_TIMERS) {
- return false;
- }
-
- if (!SetTimer(paltform_win, timer + 1, millisec, NULL)) {
- return false;
- }
- return true;
-}
-
-bool Platform::deactivate_interval_timer(TimerID timer)
-{
- if (timer >= NUM_TIMERS) {
- return false;
- }
- KillTimer(paltform_win, timer + 1);
- return true;
-}
-
-void Platform::destroy_interval_timer(TimerID timer)
-{
- if (timer == INVALID_TIMER) {
- return;
- }
- ASSERT(timer < NUM_TIMERS);
- KillTimer(paltform_win, timer + 1);
- free_timer(&timers[timer]);
-}
-
uint64_t Platform::get_monolithic_time()
{
return uint64_t(GetTickCount()) * 1000 * 1000;
@@ -565,9 +397,12 @@ bool Platform::is_monitors_pos_valid()
void Platform::init()
{
- main_tread = GetCurrentThread();
create_message_wind();
- init_timers();
+}
+
+void Platform::set_process_loop(ProcessLoop& main_process_loop)
+{
+ main_loop = &main_process_loop;
}
WaveRecordAbstract* Platform::create_recorder(RecordClinet& client,
@@ -664,7 +499,7 @@ WinLocalCursor::WinLocalCursor(CursorData* cursor_data)
icon.yHotspot = header.hot_spot_y;
icon.hbmColor = icon.hbmMask = NULL;
HDC hdc = GetDC(NULL);
-
+
switch (header.type) {
case CURSOR_TYPE_ALPHA:
case CURSOR_TYPE_COLOR32:
@@ -784,3 +619,37 @@ Icon* Platform::load_icon(int id)
return new WinIcon(icon);
}
+class PlatformTimer: public Timer {
+public:
+ PlatformTimer(timer_proc_t proc, void* opaque) : _proc (proc), _opaque (opaque) {}
+ void response(AbstractProcessLoop& events_loop) {_proc(_opaque, (TimerID)this);}
+
+private:
+ timer_proc_t _proc;
+ void* _opaque;
+};
+
+TimerID Platform::create_interval_timer(timer_proc_t proc, void* opaque)
+{
+ return (TimerID)(new PlatformTimer(proc, opaque));
+}
+
+bool Platform::activate_interval_timer(TimerID timer, unsigned int millisec)
+{
+ ASSERT(main_loop);
+ main_loop->activate_interval_timer((PlatformTimer*)timer, millisec);
+ return true;
+}
+
+bool Platform::deactivate_interval_timer(TimerID timer)
+{
+ ASSERT(main_loop);
+ main_loop->deactivate_interval_timer((PlatformTimer*)timer);
+ return true;
+}
+
+void Platform::destroy_interval_timer(TimerID timer)
+{
+ deactivate_interval_timer(timer);
+ ((PlatformTimer*)timer)->unref();
+}
diff --git a/client/windows/redc.vcproj b/client/windows/redc.vcproj
index f65e3a2f..c63e1f1c 100644
--- a/client/windows/redc.vcproj
+++ b/client/windows/redc.vcproj
@@ -225,6 +225,10 @@
>
</File>
<File
+ RelativePath=".\event_sources_p.cpp"
+ >
+ </File>
+ <File
RelativePath=".\events_loop_p.cpp"
>
</File>
@@ -311,6 +315,10 @@
>
</File>
<File
+ RelativePath="..\process_loop.cpp"
+ >
+ </File>
+ <File
RelativePath="..\quic.cpp"
>
</File>
@@ -437,6 +445,14 @@
>
</File>
<File
+ RelativePath="..\event_sources.h"
+ >
+ </File>
+ <File
+ RelativePath=".\event_sources_p.h"
+ >
+ </File>
+ <File
RelativePath="..\events_loop.h"
>
</File>
@@ -513,6 +529,10 @@
>
</File>
<File
+ RelativePath="..\process_loop.h"
+ >
+ </File>
+ <File
RelativePath=".\record.h"
>
</File>
diff --git a/client/windows/win_platform.h b/client/windows/win_platform.h
index ddd0cd59..a821f63d 100644
--- a/client/windows/win_platform.h
+++ b/client/windows/win_platform.h
@@ -20,22 +20,6 @@
#include "icon.h"
-class EventOwner {
-public:
- EventOwner() : _event_handle (0) {}
- HANDLE const get_event_handle() { return _event_handle;}
- virtual void on_event() = 0;
-
-protected:
- HANDLE _event_handle;
-};
-
-class WinPlatform {
-public:
- static void add_event(EventOwner& event_owner);
- static void remove_event(EventOwner& event_owner);
-};
-
class WinIcon: public Icon {
public:
WinIcon(HICON icon) : _icon (icon) {}