[vlc-commits] ActiveX: removed IGlobalInterfaceTable from VLCConnectionPoint.

Sergey Radionov git at videolan.org
Thu Mar 22 18:28:47 CET 2012


npapi-vlc | branch: master | Sergey Radionov <rsatom at gmail.com> | Thu Mar 22 09:21:19 2012 +0700| [c06b7f1dce8d70c1d482e6fdbcc2dfdbac6d8b29] | committer: Jean-Baptiste Kempf

ActiveX: removed IGlobalInterfaceTable from VLCConnectionPoint.

It's excess with event notify system based on windows messages (see EventSystemProxyWnd).

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=c06b7f1dce8d70c1d482e6fdbcc2dfdbac6d8b29
---

 activex/connectioncontainer.cpp |   58 +++++++++++---------------------------
 activex/connectioncontainer.h   |    1 -
 2 files changed, 17 insertions(+), 42 deletions(-)

diff --git a/activex/connectioncontainer.cpp b/activex/connectioncontainer.cpp
index 15f3e0a..a8bd423 100644
--- a/activex/connectioncontainer.cpp
+++ b/activex/connectioncontainer.cpp
@@ -256,11 +256,6 @@ void EventSystemProxyWnd::ProcessNotify()
 VLCConnectionPoint::VLCConnectionPoint(IConnectionPointContainer *p_cpc, REFIID iid) :
         _iid(iid), _p_cpc(p_cpc)
 {
-    // Get the Global Interface Table per-process singleton:
-    CoCreateInstance(CLSID_StdGlobalInterfaceTable, 0,
-                          CLSCTX_INPROC_SERVER,
-                          IID_IGlobalInterfaceTable,
-                          reinterpret_cast<void**>(&m_pGIT));
 };
 
 VLCConnectionPoint::~VLCConnectionPoint()
@@ -271,10 +266,10 @@ VLCConnectionPoint::~VLCConnectionPoint()
 
     while( iter != end )
     {
-        m_pGIT->RevokeInterfaceFromGlobal((DWORD)iter->second);
+        iter->second->Release();
         ++iter;
     }
-    m_pGIT->Release();
+    _connections.clear();
 };
 
 STDMETHODIMP VLCConnectionPoint::GetConnectionInterface(IID *iid)
@@ -307,14 +302,8 @@ STDMETHODIMP VLCConnectionPoint::Advise(IUnknown *pUnk, DWORD *pdwCookie)
     hr = pUnk->QueryInterface(_iid, (LPVOID *)&pUnk);
     if( SUCCEEDED(hr) )
     {
-        DWORD dwGITCookie;
-        hr = m_pGIT->RegisterInterfaceInGlobal( pUnk, _iid, &dwGITCookie );
-        if( SUCCEEDED(hr) )
-        {
-            *pdwCookie = ++dwCookieCounter;
-            _connections[*pdwCookie] = (LPUNKNOWN) dwGITCookie;
-        }
-        pUnk->Release();
+        *pdwCookie = ++dwCookieCounter;
+        _connections[*pdwCookie] = pUnk;
     }
     return hr;
 };
@@ -324,8 +313,8 @@ STDMETHODIMP VLCConnectionPoint::Unadvise(DWORD pdwCookie)
     map<DWORD,LPUNKNOWN>::iterator pcd = _connections.find((DWORD)pdwCookie);
     if( pcd != _connections.end() )
     {
-        m_pGIT->RevokeInterfaceFromGlobal((DWORD)pcd->second);
-        _connections.erase(pdwCookie);
+        pcd->second->Release();
+        _connections.erase(pcd);
         return S_OK;
     }
     return CONNECT_E_NOCONNECTION;
@@ -350,22 +339,15 @@ void VLCConnectionPoint::fireEvent(DISPID dispId, DISPPARAMS *pDispParams)
 
     while( iter != end )
     {
-        DWORD dwCookie = (DWORD)iter->second;
-        LPUNKNOWN pUnk;
+        LPUNKNOWN pUnk = iter->second;
 
-        hr = m_pGIT->GetInterfaceFromGlobal( dwCookie, _iid,
-                                             reinterpret_cast<void **>(&pUnk) );
+        IDispatch *pDisp;
+        hr = pUnk->QueryInterface(_iid, (LPVOID *)&pDisp);
         if( SUCCEEDED(hr) )
         {
-            IDispatch *pDisp;
-            hr = pUnk->QueryInterface(_iid, (LPVOID *)&pDisp);
-            if( SUCCEEDED(hr) )
-            {
-                pDisp->Invoke(dispId, IID_NULL, LOCALE_USER_DEFAULT,
-                              DISPATCH_METHOD, pDispParams, NULL, NULL, NULL);
-                pDisp->Release();
-            }
-            pUnk->Release();
+            pDisp->Invoke(dispId, IID_NULL, LOCALE_USER_DEFAULT,
+                          DISPATCH_METHOD, pDispParams, NULL, NULL, NULL);
+            pDisp->Release();
         }
         ++iter;
     }
@@ -378,21 +360,15 @@ void VLCConnectionPoint::firePropChangedEvent(DISPID dispId)
 
     while( iter != end )
     {
-        LPUNKNOWN pUnk;
+        LPUNKNOWN pUnk = iter->second;
         HRESULT hr;
 
-        hr = m_pGIT->GetInterfaceFromGlobal( (DWORD)iter->second, IID_IUnknown,
-                                              reinterpret_cast<void **>(&pUnk) );
+        IPropertyNotifySink *pPropSink;
+        hr = pUnk->QueryInterface( IID_IPropertyNotifySink, (LPVOID *)&pPropSink );
         if( SUCCEEDED(hr) )
         {
-            IPropertyNotifySink *pPropSink;
-            hr = pUnk->QueryInterface( IID_IPropertyNotifySink, (LPVOID *)&pPropSink );
-            if( SUCCEEDED(hr) )
-            {
-                pPropSink->OnChanged(dispId);
-                pPropSink->Release();
-            }
-            pUnk->Release();
+            pPropSink->OnChanged(dispId);
+            pPropSink->Release();
         }
         ++iter;
     }
diff --git a/activex/connectioncontainer.h b/activex/connectioncontainer.h
index 4f22504..e1b492f 100644
--- a/activex/connectioncontainer.h
+++ b/activex/connectioncontainer.h
@@ -71,7 +71,6 @@ public:
 private:
 
     REFIID _iid;
-    IGlobalInterfaceTable *m_pGIT;
     IConnectionPointContainer *_p_cpc;
     std::map<DWORD, LPUNKNOWN> _connections;
 };



More information about the vlc-commits mailing list