Commit 427a6f91 authored by Jean-Paul Saman's avatar Jean-Paul Saman

activex: implement async events handling for JavaScript

Events that do not originate from within the ActiveX JS context (which is a COM context)
cannot cross into ActiveX/COM context. All events received from libvlc are in a different
thread context then the ActiveX/COM code. Thus from a libvlc event handler callback it is
not possible to call into the ActiveX/COM context.

To solve this issue a seperate thread is created that manages sending of all events for
the ActiveX webplugin (including events from libvlc). All events are by default routed
through the GlobalInterfaceTable (GIT) which takes care ActiveX/COM calls that cross
different thread context in the ActiveX/COM world.
Signed-off-by: Jean-Paul Saman's avatarJean-Paul Saman <jean-paul.saman@m2x.nl>
parent b7d39d41
This diff is collapsed.
......@@ -2,8 +2,10 @@
* connectioncontainer.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
* Copyright (C) 2010 M2X BV
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
* Jean-Paul Saman <jpsaman@videolan.org>
*
* 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
......@@ -27,15 +29,15 @@
#include <vector>
#include <queue>
#include <map>
#include <cguid.h>
class VLCConnectionPoint : public IConnectionPoint
{
public:
VLCConnectionPoint(IConnectionPointContainer *p_cpc, REFIID iid) :
_iid(iid), _p_cpc(p_cpc) {};
virtual ~VLCConnectionPoint() {};
VLCConnectionPoint(IConnectionPointContainer *p_cpc, REFIID iid);
virtual ~VLCConnectionPoint();
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
......@@ -69,6 +71,7 @@ public:
private:
REFIID _iid;
IGlobalInterfaceTable *m_pGIT;
IConnectionPointContainer *_p_cpc;
std::map<DWORD, LPUNKNOWN> _connections;
};
......@@ -121,14 +124,20 @@ public:
void fireEvent(DISPID, DISPPARAMS*);
void firePropChangedEvent(DISPID dispId);
private:
public:
CRITICAL_SECTION csEvents;
HANDLE sEvents;
VLCPlugin *_p_instance;
BOOL _b_freeze;
BOOL isRunning;
BOOL freeze;
VLCConnectionPoint *_p_events;
VLCConnectionPoint *_p_props;
std::vector<LPCONNECTIONPOINT> _v_cps;
std::queue<class VLCDispatchEvent *> _q_events;
private:
HANDLE hThread;
};
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment