mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to m-i
This commit is contained in:
commit
944bbe6042
84
dom/plugins/ipc/COMMessageFilter.cpp
Normal file
84
dom/plugins/ipc/COMMessageFilter.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "base/basictypes.h"
|
||||
|
||||
#include "COMMessageFilter.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "mozilla/plugins/PluginModuleChild.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
||||
HRESULT
|
||||
COMMessageFilter::QueryInterface(REFIID riid, void** ppv)
|
||||
{
|
||||
if (riid == IID_IUnknown || riid == IID_IMessageFilter) {
|
||||
*ppv = static_cast<IMessageFilter*>(this);
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
DWORD COMMessageFilter::AddRef()
|
||||
{
|
||||
++mRefCnt;
|
||||
return mRefCnt;
|
||||
}
|
||||
|
||||
DWORD COMMessageFilter::Release()
|
||||
{
|
||||
DWORD r = --mRefCnt;
|
||||
if (0 == r)
|
||||
delete this;
|
||||
return r;
|
||||
}
|
||||
|
||||
DWORD
|
||||
COMMessageFilter::HandleInComingCall(DWORD dwCallType,
|
||||
HTASK htaskCaller,
|
||||
DWORD dwTickCount,
|
||||
LPINTERFACEINFO lpInterfaceInfo)
|
||||
{
|
||||
if (mPreviousFilter)
|
||||
return mPreviousFilter->HandleInComingCall(dwCallType, htaskCaller,
|
||||
dwTickCount, lpInterfaceInfo);
|
||||
return SERVERCALL_ISHANDLED;
|
||||
}
|
||||
|
||||
DWORD
|
||||
COMMessageFilter::RetryRejectedCall(HTASK htaskCallee,
|
||||
DWORD dwTickCount,
|
||||
DWORD dwRejectType)
|
||||
{
|
||||
if (mPreviousFilter)
|
||||
return mPreviousFilter->RetryRejectedCall(htaskCallee, dwTickCount,
|
||||
dwRejectType);
|
||||
return -1;
|
||||
}
|
||||
|
||||
DWORD
|
||||
COMMessageFilter::MessagePending(HTASK htaskCallee,
|
||||
DWORD dwTickCount,
|
||||
DWORD dwPendingType)
|
||||
{
|
||||
mPlugin->FlushPendingInterruptQueue();
|
||||
if (mPreviousFilter)
|
||||
return mPreviousFilter->MessagePending(htaskCallee, dwTickCount,
|
||||
dwPendingType);
|
||||
return PENDINGMSG_WAITNOPROCESS;
|
||||
}
|
||||
|
||||
void
|
||||
COMMessageFilter::Initialize(PluginModuleChild* module)
|
||||
{
|
||||
nsRefPtr<COMMessageFilter> f = new COMMessageFilter(module);
|
||||
::CoRegisterMessageFilter(f, getter_AddRefs(f->mPreviousFilter));
|
||||
}
|
||||
|
||||
} // namespace plugins
|
||||
} // namespace mozilla
|
50
dom/plugins/ipc/COMMessageFilter.h
Normal file
50
dom/plugins/ipc/COMMessageFilter.h
Normal file
@ -0,0 +1,50 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_plugins_COMMessageFilter_h
|
||||
#define mozilla_plugins_COMMessageFilter_h
|
||||
|
||||
#include <objidl.h>
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace plugins {
|
||||
|
||||
class PluginModuleChild;
|
||||
|
||||
class COMMessageFilter final : public IMessageFilter
|
||||
{
|
||||
public:
|
||||
static void Initialize(PluginModuleChild* plugin);
|
||||
|
||||
COMMessageFilter(PluginModuleChild* plugin)
|
||||
: mPlugin(plugin)
|
||||
{ }
|
||||
|
||||
HRESULT WINAPI QueryInterface(REFIID riid, void** ppv);
|
||||
DWORD WINAPI AddRef();
|
||||
DWORD WINAPI Release();
|
||||
|
||||
DWORD WINAPI HandleInComingCall(DWORD dwCallType,
|
||||
HTASK htaskCaller,
|
||||
DWORD dwTickCount,
|
||||
LPINTERFACEINFO lpInterfaceInfo);
|
||||
DWORD WINAPI RetryRejectedCall(HTASK htaskCallee,
|
||||
DWORD dwTickCount,
|
||||
DWORD dwRejectType);
|
||||
DWORD WINAPI MessagePending(HTASK htaskCallee,
|
||||
DWORD dwTickCount,
|
||||
DWORD dwPendingType);
|
||||
|
||||
private:
|
||||
nsAutoRefCnt mRefCnt;
|
||||
PluginModuleChild* mPlugin;
|
||||
nsRefPtr<IMessageFilter> mPreviousFilter;
|
||||
};
|
||||
|
||||
} // namespace plugins
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // COMMessageFilter_h
|
@ -42,6 +42,7 @@
|
||||
#include "nsNPAPIPlugin.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "COMMessageFilter.h"
|
||||
#include "nsWindowsDllInterceptor.h"
|
||||
#include "mozilla/widget/AudioSession.h"
|
||||
#endif
|
||||
@ -263,6 +264,10 @@ PluginModuleChild::InitForChrome(const std::string& aPluginFilename,
|
||||
MessageLoop* aIOLoop,
|
||||
IPC::Channel* aChannel)
|
||||
{
|
||||
#ifdef XP_WIN
|
||||
COMMessageFilter::Initialize(this);
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(aChannel, "need a channel");
|
||||
|
||||
if (!InitGraphics())
|
||||
|
Loading…
Reference in New Issue
Block a user