Backed out changeset 9fb279a95ce1 (bug 914829) and changeset 414c46543931 (bug 914331) for intermittent mochitest-mc crashes.

This commit is contained in:
Ryan VanderMeulen 2013-09-11 21:27:58 -04:00
parent 4a171cb7f6
commit ce366bbd09
7 changed files with 33 additions and 196 deletions

View File

@ -213,7 +213,6 @@ ApplyTransform(nsIntPoint* aPoint, const gfx3DMatrix& aMatrix)
nsEventStatus
APZCTreeManager::ReceiveInputEvent(const InputData& aEvent)
{
nsEventStatus result = nsEventStatus_eIgnore;
gfx3DMatrix transformToApzc;
gfx3DMatrix transformToScreen;
switch (aEvent.mInputType) {
@ -239,7 +238,7 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent)
for (size_t i = 0; i < inputForApzc.mTouches.Length(); i++) {
ApplyTransform(&(inputForApzc.mTouches[i].mScreenPoint), transformToApzc);
}
result = mApzcForInputBlock->ReceiveInputEvent(inputForApzc);
mApzcForInputBlock->ReceiveInputEvent(inputForApzc);
// If we have an mApzcForInputBlock and it's the end of the touch sequence
// then null it out so we don't keep a dangling reference and leak things.
if (multiTouchInput.mType == MultiTouchInput::MULTITOUCH_CANCEL ||
@ -255,7 +254,7 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent)
GetInputTransforms(apzc, transformToApzc, transformToScreen);
PinchGestureInput inputForApzc(pinchInput);
ApplyTransform(&(inputForApzc.mFocusPoint), transformToApzc);
result = apzc->ReceiveInputEvent(inputForApzc);
apzc->ReceiveInputEvent(inputForApzc);
}
break;
} case TAPGESTURE_INPUT: {
@ -265,12 +264,12 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent)
GetInputTransforms(apzc, transformToApzc, transformToScreen);
TapGestureInput inputForApzc(tapInput);
ApplyTransform(&(inputForApzc.mPoint), transformToApzc);
result = apzc->ReceiveInputEvent(inputForApzc);
apzc->ReceiveInputEvent(inputForApzc);
}
break;
}
}
return result;
return nsEventStatus_eIgnore;
}
nsEventStatus

View File

@ -42,8 +42,6 @@ extern UINT sAppShellGeckoMsgId;
static ComPtr<ICoreWindowStatic> sCoreStatic;
static bool sIsDispatching = false;
static bool sWillEmptyThreadQueue = false;
static bool sEmptyingThreadQueue = false;
MetroAppShell::~MetroAppShell()
{
@ -216,43 +214,6 @@ MetroAppShell::Run(void)
return rv;
}
// Called in certain cases where we have async input events in the thread
// queue and need to make sure they get dispatched before the stack unwinds.
void // static
MetroAppShell::MarkEventQueueForPurge()
{
LogFunction();
sWillEmptyThreadQueue = true;
// If we're dispatching native events, wait until the dispatcher is
// off the stack.
if (sIsDispatching) {
return;
}
// Safe to process pending events now
DispatchAllGeckoEvents();
}
// static
void
MetroAppShell::DispatchAllGeckoEvents()
{
if (!sWillEmptyThreadQueue) {
return;
}
LogFunction();
NS_ASSERTION(NS_IsMainThread(), "DispatchAllXPCOMEvents should be called on the main thread");
sWillEmptyThreadQueue = false;
AutoRestore<bool> dispatching(sEmptyingThreadQueue);
sEmptyingThreadQueue = true;
nsIThread *thread = NS_GetCurrentThread();
NS_ProcessPendingEvents(thread, 0);
}
static void
ProcessNativeEvents(CoreProcessEventsOption eventOption)
{
@ -279,29 +240,14 @@ MetroAppShell::ProcessOneNativeEventIfPresent()
if (sIsDispatching) {
NS_RUNTIMEABORT("Reentrant call into process events, this is not allowed in Winrt land. Goodbye!");
}
{
AutoRestore<bool> dispatching(sIsDispatching);
sIsDispatching = true;
ProcessNativeEvents(CoreProcessEventsOption::CoreProcessEventsOption_ProcessOneIfPresent);
}
DispatchAllGeckoEvents();
AutoRestore<bool> dispatching(sIsDispatching);
ProcessNativeEvents(CoreProcessEventsOption::CoreProcessEventsOption_ProcessOneIfPresent);
return !!HIWORD(::GetQueueStatus(MOZ_QS_ALLEVENT));
}
bool
MetroAppShell::ProcessNextNativeEvent(bool mayWait)
{
// NS_ProcessPendingEvents will process thread events *and* call
// nsBaseAppShell::OnProcessNextEvent to process native events. However
// we do not want native events getting dispatched while we are in
// DispatchAllGeckoEvents.
if (sEmptyingThreadQueue) {
return false;
}
if (ProcessOneNativeEventIfPresent()) {
return true;
}

View File

@ -27,14 +27,12 @@ public:
static LRESULT CALLBACK EventWindowProc(HWND, UINT, WPARAM, LPARAM);
static bool ProcessOneNativeEventIfPresent();
static void MarkEventQueueForPurge();
protected:
NS_IMETHOD Run();
virtual void ScheduleNativeEventCallback();
virtual bool ProcessNextNativeEvent(bool mayWait);
static void DispatchAllGeckoEvents();
virtual ~MetroAppShell();
HWND mEventWnd;

View File

@ -12,7 +12,6 @@
#include "nsIDOMSimpleGestureEvent.h" // Constants for gesture events
#include "InputData.h"
#include "UIABridgePrivate.h"
#include "MetroAppShell.h"
// System headers (alphabetical)
#include <windows.ui.core.h> // ABI::Window::UI::Core namespace
@ -180,20 +179,6 @@ namespace {
aData->mChanged = false;
return PL_DHASH_NEXT;
}
// Helper for making sure event ptrs get freed.
class AutoDeleteEvent
{
public:
AutoDeleteEvent(nsGUIEvent* aPtr) :
mPtr(aPtr) {}
~AutoDeleteEvent() {
if (mPtr) {
delete mPtr;
}
}
nsGUIEvent* mPtr;
};
}
namespace mozilla {
@ -446,8 +431,6 @@ MetroInput::OnPointerPressed(UI::Core::ICoreWindow* aSender,
mTouchStartDefaultPrevented = false;
mTouchMoveDefaultPrevented = false;
mIsFirstTouchMove = true;
mCancelable = true;
mTouchCancelSent = false;
InitTouchEventTouchList(touchEvent);
DispatchAsyncTouchEventWithCallback(touchEvent, &MetroInput::OnPointerPressedCallback);
} else {
@ -466,12 +449,10 @@ MetroInput::OnPointerPressedCallback()
{
nsEventStatus status = DeliverNextQueuedTouchEvent();
mTouchStartDefaultPrevented = (nsEventStatus_eConsumeNoDefault == status);
// If content cancelled the first touchstart don't generate any gesture based
// input - clear the recognizer state without sending any events.
if (mTouchStartDefaultPrevented) {
// If content canceled the first touchstart don't generate any gesture based
// input - clear the recognizer state without sending any events.
mGestureRecognizer->CompleteGesture();
// Let the apz know content wants to consume touch events.
mWidget->ApzContentConsumingTouch();
}
}
@ -568,15 +549,12 @@ MetroInput::OnPointerMoved(UI::Core::ICoreWindow* aSender,
void
MetroInput::OnFirstPointerMoveCallback()
{
nsEventStatus status = DeliverNextQueuedTouchEvent();
mCancelable = false;
nsTouchEvent* event = static_cast<nsTouchEvent*>(mInputEventQueue.PopFront());
MOZ_ASSERT(event);
nsEventStatus status;
mWidget->DispatchEvent(event, status);
mTouchMoveDefaultPrevented = (nsEventStatus_eConsumeNoDefault == status);
// Let the apz know whether content wants to consume touch events
if (mTouchMoveDefaultPrevented) {
mWidget->ApzContentConsumingTouch();
} else if (!mTouchMoveDefaultPrevented && !mTouchStartDefaultPrevented) {
mWidget->ApzContentIgnoringTouch();
}
delete event;
}
// This event is raised when the user lifts the left mouse button, lifts a
@ -636,11 +614,6 @@ MetroInput::OnPointerReleased(UI::Core::ICoreWindow* aSender,
mGestureRecognizer->ProcessUpEvent(currentPoint.Get());
}
// Make sure all gecko events are dispatched and the dom is up to date
// so that when ui automation comes in looking for focus info it gets
// the right information.
MetroAppShell::MarkEventQueueForPurge();
return S_OK;
}
@ -1097,6 +1070,17 @@ MetroInput::DeliverNextQueuedEventIgnoreStatus()
delete event;
}
nsEventStatus
MetroInput::DeliverNextQueuedEvent()
{
nsGUIEvent* event = static_cast<nsGUIEvent*>(mInputEventQueue.PopFront());
MOZ_ASSERT(event);
nsEventStatus status;
mWidget->DispatchEvent(event, status);
delete event;
return status;
}
void
MetroInput::DispatchAsyncTouchEventIgnoreStatus(nsTouchEvent* aEvent)
{
@ -1112,69 +1096,19 @@ MetroInput::DispatchAsyncTouchEventIgnoreStatus(nsTouchEvent* aEvent)
nsEventStatus
MetroInput::DeliverNextQueuedTouchEvent()
{
nsEventStatus status;
nsTouchEvent* event = static_cast<nsTouchEvent*>(mInputEventQueue.PopFront());
MOZ_ASSERT(event);
AutoDeleteEvent wrap(event);
/*
* We go through states here and make different decisions in each:
*
* 1) delivering first touchpoint touchstart or its first touchmove
* Our callers (OnFirstPointerMoveCallback, OnPointerPressedCallback) will
* check our result and set mTouchStartDefaultPrevented or
* mTouchMoveDefaultPrevented appropriately. Deliver touch events to the apz
* (ignoring return result) and to content and return the content event
* status result to our caller.
* 2) mTouchStartDefaultPrevented or mTouchMoveDefaultPrevented are true
* Deliver touch directly to content and bypass the apz. Our callers
* handle calling cancel for the touch sequence on the apz.
* 3) mTouchStartDefaultPrevented and mTouchMoveDefaultPrevented are false
* Deliver events to the apz. If the apz returns eConsumeNoDefault dispatch
* a touchcancel to content and do not deliver any additional events there.
* (If the apz is doing something with the events we can save ourselves
* the overhead of delivering dom events.)
*/
// Check if content called preventDefault on touchstart or first touchmove. If so
// send directly to content, do not forward to the apz.
if (mTouchStartDefaultPrevented || mTouchMoveDefaultPrevented) {
// continue delivering events to content
mWidget->DispatchEvent(event, status);
return status;
}
// Forward event data to apz. If the apz consumes the event, don't forward to
// content if this is not a cancelable event.
status = mWidget->ApzReceiveInputEvent(event);
if (!mCancelable && status == nsEventStatus_eConsumeNoDefault) {
if (!mTouchCancelSent) {
mTouchCancelSent = true;
DispatchTouchCancel();
}
return status;
}
// Deliver event to content
nsEventStatus status;
mWidget->DispatchEvent(event, status);
// Deliver to the apz if content has *not* cancelled touchstart or the first touchmove.
if (!mTouchStartDefaultPrevented && !mTouchMoveDefaultPrevented && MetroWidget::sAPZC) {
MultiTouchInput inputData(*event);
MetroWidget::sAPZC->ReceiveInputEvent(inputData);
}
delete event;
return status;
}
void
MetroInput::DispatchTouchCancel()
{
LogFunction();
// From the spec: The touch point or points that were removed must be
// included in the changedTouches attribute of the TouchEvent, and must
// not be included in the touches and targetTouches attributes.
// (We are 'removing' all touch points that have been sent to content
// thus far.)
nsTouchEvent touchEvent(true, NS_TOUCH_CANCEL, mWidget.Get());
InitTouchEventTouchList(&touchEvent);
mWidget->DispatchEvent(&touchEvent, sThrowawayStatus);
}
void
MetroInput::DispatchAsyncTouchEventWithCallback(nsTouchEvent* aEvent, void (MetroInput::*Callback)())
{

View File

@ -196,8 +196,6 @@ private:
bool mTouchStartDefaultPrevented;
bool mTouchMoveDefaultPrevented;
bool mIsFirstTouchMove;
bool mCancelable;
bool mTouchCancelSent;
// In the old Win32 way of doing things, we would receive a WM_TOUCH event
// that told us the state of every touchpoint on the touch surface. If
@ -264,6 +262,7 @@ private:
// Async event callbacks
void DeliverNextQueuedEventIgnoreStatus();
nsEventStatus DeliverNextQueuedEvent();
nsEventStatus DeliverNextQueuedTouchEvent();
// Misc. specialty async callbacks
@ -272,9 +271,8 @@ private:
// Sync event dispatching
void DispatchEventIgnoreStatus(nsGUIEvent *aEvent);
void DispatchTouchCancel();
nsDeque mInputEventQueue;
nsDeque mInputEventQueue;
static nsEventStatus sThrowawayStatus;
};

View File

@ -31,7 +31,6 @@
#endif
#include "UIABridgePrivate.h"
#include "WinMouseScrollHandler.h"
#include "InputData.h"
using namespace Microsoft::WRL;
using namespace Microsoft::WRL::Wrappers;
@ -979,39 +978,6 @@ CompositorParent* MetroWidget::NewCompositorParent(int aSurfaceWidth, int aSurfa
return compositor;
}
void
MetroWidget::ApzContentConsumingTouch()
{
LogFunction();
if (!MetroWidget::sAPZC) {
return;
}
MetroWidget::sAPZC->ContentReceivedTouch(mRootLayerTreeId, true);
}
void
MetroWidget::ApzContentIgnoringTouch()
{
LogFunction();
if (!MetroWidget::sAPZC) {
return;
}
MetroWidget::sAPZC->ContentReceivedTouch(mRootLayerTreeId, false);
}
nsEventStatus
MetroWidget::ApzReceiveInputEvent(nsTouchEvent* aEvent)
{
MOZ_ASSERT(aEvent);
if (!MetroWidget::sAPZC) {
return nsEventStatus_eIgnore;
}
MultiTouchInput inputData(*aEvent);
return MetroWidget::sAPZC->ReceiveInputEvent(inputData);
}
LayerManager*
MetroWidget::GetLayerManager(PLayerTransactionChild* aShadowManager,
LayersBackend aBackendHint,

View File

@ -196,10 +196,6 @@ public:
virtual void SetTransparencyMode(nsTransparencyMode aMode);
virtual nsTransparencyMode GetTransparencyMode();
// APZ related apis
void ApzContentConsumingTouch();
void ApzContentIgnoringTouch();
nsEventStatus ApzReceiveInputEvent(nsTouchEvent* aEvent);
nsresult RequestContentScroll();
void RequestContentRepaintImplMainThread();