dom/plugins/ipc/COMMessageFilter.cpp

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:abbccd51bf17
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #include "base/basictypes.h"
6
7 #include "COMMessageFilter.h"
8 #include "base/message_loop.h"
9 #include "mozilla/plugins/PluginModuleChild.h"
10
11 #include <stdio.h>
12
13 namespace mozilla {
14 namespace plugins {
15
16 HRESULT
17 COMMessageFilter::QueryInterface(REFIID riid, void** ppv)
18 {
19 if (riid == IID_IUnknown || riid == IID_IMessageFilter) {
20 *ppv = static_cast<IMessageFilter*>(this);
21 AddRef();
22 return S_OK;
23 }
24 return E_NOINTERFACE;
25 }
26
27 DWORD COMMessageFilter::AddRef()
28 {
29 ++mRefCnt;
30 return mRefCnt;
31 }
32
33 DWORD COMMessageFilter::Release()
34 {
35 DWORD r = --mRefCnt;
36 if (0 == r)
37 delete this;
38 return r;
39 }
40
41 DWORD
42 COMMessageFilter::HandleInComingCall(DWORD dwCallType,
43 HTASK htaskCaller,
44 DWORD dwTickCount,
45 LPINTERFACEINFO lpInterfaceInfo)
46 {
47 if (mPreviousFilter)
48 return mPreviousFilter->HandleInComingCall(dwCallType, htaskCaller,
49 dwTickCount, lpInterfaceInfo);
50 return SERVERCALL_ISHANDLED;
51 }
52
53 DWORD
54 COMMessageFilter::RetryRejectedCall(HTASK htaskCallee,
55 DWORD dwTickCount,
56 DWORD dwRejectType)
57 {
58 if (mPreviousFilter)
59 return mPreviousFilter->RetryRejectedCall(htaskCallee, dwTickCount,
60 dwRejectType);
61 return -1;
62 }
63
64 DWORD
65 COMMessageFilter::MessagePending(HTASK htaskCallee,
66 DWORD dwTickCount,
67 DWORD dwPendingType)
68 {
69 mPlugin->FlushPendingInterruptQueue();
70 if (mPreviousFilter)
71 return mPreviousFilter->MessagePending(htaskCallee, dwTickCount,
72 dwPendingType);
73 return PENDINGMSG_WAITNOPROCESS;
74 }
75
76 void
77 COMMessageFilter::Initialize(PluginModuleChild* module)
78 {
79 nsRefPtr<COMMessageFilter> f = new COMMessageFilter(module);
80 ::CoRegisterMessageFilter(f, getter_AddRefs(f->mPreviousFilter));
81 }
82
83 } // namespace plugins
84 } // namespace mozilla

mercurial