Bug 558986 - Backout of fix for crashes in TSF with Flash/Silverlight on tablets. CLOSED TREE

This commit is contained in:
Jim Mathies 2010-05-17 14:36:43 -05:00
parent 695ab55828
commit e9cf1d1dad
8 changed files with 12 additions and 265 deletions

View File

@ -1,114 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Firefox.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation <http://www.mozilla.org/>.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#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->FlushPendingRPCQueue();
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

View File

@ -1,82 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Firefox.
*
* The Initial Developer of the Original Code is
* the Mozilla Foundation <http://www.mozilla.org/>.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#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 : 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

View File

@ -113,10 +113,6 @@ CPPSRCS = \
PluginStreamParent.cpp \
$(NULL)
ifeq (WINNT,$(OS_ARCH))
CPPSRCS += COMMessageFilter.cpp
endif
LOCAL_INCLUDES = \
-I$(topsrcdir)/modules/plugin/base/public/ \
-I$(topsrcdir)/modules/plugin/base/src/ \

View File

@ -63,10 +63,6 @@
#include "nsNPAPIPlugin.h"
#ifdef XP_WIN
#include "COMMessageFilter.h"
#endif
using namespace mozilla::plugins;
#if defined(XP_WIN)
@ -128,8 +124,6 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
{
PLUGIN_LOG_DEBUG_METHOD;
COMMessageFilter::Initialize(this);
NS_ASSERTION(aChannel, "need a channel");
if (!mObjectMap.Init()) {

View File

@ -97,10 +97,6 @@ void MessagePumpForUI::ScheduleWork() {
// Make sure the MessagePump does some work for us.
PostMessage(message_hwnd_, kMsgHaveWork, reinterpret_cast<WPARAM>(this), 0);
// In order to wake up any cross-process COM calls which may currently be
// pending on the main thread, we also have to post a UI message.
PostMessage(message_hwnd_, WM_NULL, NULL, 0);
}
void MessagePumpForUI::ScheduleDelayedWork(const Time& delayed_work_time) {

View File

@ -315,14 +315,14 @@ RPCChannel::Call(Message* msg, Message* reply)
return true;
}
bool
void
RPCChannel::MaybeProcessDeferredIncall()
{
AssertWorkerThread();
mMutex.AssertCurrentThreadOwns();
if (mDeferred.empty())
return false;
return;
size_t stackDepth = StackDepth();
@ -331,7 +331,7 @@ RPCChannel::MaybeProcessDeferredIncall()
"fatal logic error");
if (mDeferred.top().rpc_remote_stack_depth_guess() < stackDepth)
return false;
return;
// time to process this message
Message call = mDeferred.top();
@ -348,7 +348,6 @@ RPCChannel::MaybeProcessDeferredIncall()
CxxStackFrame f(*this, IN_MESSAGE, &call);
Incall(call, stackDepth);
return true;
}
void
@ -372,28 +371,6 @@ RPCChannel::EnqueuePendingMessages()
}
void
RPCChannel::FlushPendingRPCQueue()
{
AssertWorkerThread();
mMutex.AssertNotCurrentThreadOwns();
{
MutexAutoLock lock(mMutex);
if (mDeferred.empty()) {
if (mPending.empty())
return;
const Message& last = mPending.back();
if (!last.is_rpc() || last.is_reply())
return;
}
}
while (OnMaybeDequeueOne());
}
bool
RPCChannel::OnMaybeDequeueOne()
{
// XXX performance tuning knob: could process all or k pending
@ -408,14 +385,14 @@ RPCChannel::OnMaybeDequeueOne()
if (!Connected()) {
ReportConnectionError("RPCChannel");
return false;
return;
}
if (!mDeferred.empty())
return MaybeProcessDeferredIncall();
if (mPending.empty())
return false;
return;
recvd = mPending.front();
mPending.pop();
@ -425,19 +402,17 @@ RPCChannel::OnMaybeDequeueOne()
// We probably just received a reply in a nested loop for an
// RPC call sent before entering that loop.
mOutOfTurnReplies[recvd.seqno()] = recvd;
return false;
return;
}
CxxStackFrame f(*this, IN_MESSAGE, &recvd);
if (recvd.is_rpc())
Incall(recvd, 0);
return Incall(recvd, 0);
else if (recvd.is_sync())
SyncChannel::OnDispatchMessage(recvd);
return SyncChannel::OnDispatchMessage(recvd);
else
AsyncChannel::OnDispatchMessage(recvd);
return true;
return AsyncChannel::OnDispatchMessage(recvd);
}
void

View File

@ -166,14 +166,6 @@ public:
NS_OVERRIDE
virtual void OnChannelError();
/**
* If there is a pending RPC message, process all pending messages.
*
* @note This method is used on Windows when we detect that an outbound
* OLE RPC call is being made to unblock the parent.
*/
void FlushPendingRPCQueue();
#ifdef OS_WIN
void ProcessNativeEventsInRPCCall();
@ -196,15 +188,10 @@ protected:
bool EventOccurred() const;
bool MaybeProcessDeferredIncall();
void MaybeProcessDeferredIncall();
void EnqueuePendingMessages();
/**
* Process one deferred or pending message.
* @return true if a message was processed
*/
bool OnMaybeDequeueOne();
void OnMaybeDequeueOne();
void Incall(const Message& call, size_t stackDepth);
void DispatchIncall(const Message& call);

View File

@ -2978,14 +2978,9 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
onstack.addstmt(StmtReturn(ExprCall(
ExprSelect(p.channelVar(), '.', p.onCxxStackVar().name))))
# void ProcessIncomingRacingRPCCall
processincoming = MethodDefn(
MethodDecl('FlushPendingRPCQueue', ret=Type.VOID))
processincoming.addstmt(StmtExpr(ExprCall(ExprSelect(_actorChannel(ExprVar.THIS), '.', 'FlushPendingRPCQueue'))))
self.cls.addstmts([ onentered, onexited,
onenteredcall, onexitedcall,
onstack, processincoming, Whitespace.NL ])
onstack, Whitespace.NL ])
# OnChannelClose()
onclose = MethodDefn(MethodDecl('OnChannelClose'))