Bug 840721 - Add a PostDelayedTask method to the GeckoContentController interface. r=cjones

This commit is contained in:
Kartikaya Gupta 2013-02-25 15:50:49 -05:00
Родитель 378d71c084
Коммит dfdd0b2b64
6 изменённых файлов: 33 добавлений и 5 удалений

Просмотреть файл

@ -1489,6 +1489,14 @@ void AsyncPanZoomController::UpdateZoomConstraints(bool aAllowZoom,
mMaxZoom = aMaxZoom;
}
void AsyncPanZoomController::PostDelayedTask(Task* aTask, int aDelayMs) {
if (!mGeckoContentController) {
return;
}
mGeckoContentController->PostDelayedTask(aTask, aDelayMs);
}
void AsyncPanZoomController::SendAsyncScrollEvent() {
if (!mGeckoContentController) {
return;

Просмотреть файл

@ -151,6 +151,12 @@ public:
*/
void UpdateZoomConstraints(bool aAllowZoom, float aMinScale, float aMaxScale);
/**
* Schedules a runnable to run on the controller/UI thread at some time
* in the future.
*/
void PostDelayedTask(Task* aTask, int aDelayMs);
// --------------------------------------------------------------------------
// These methods must only be called on the compositor thread.
//

Просмотреть файл

@ -10,6 +10,8 @@
#include "FrameMetrics.h"
#include "nsISupportsImpl.h"
class Task;
namespace mozilla {
namespace layers {
@ -52,6 +54,12 @@ public:
virtual void SendAsyncScrollDOMEvent(const gfx::Rect &aContentRect,
const gfx::Size &aScrollableSize) = 0;
/**
* Schedules a runnable to run on the controller/UI thread at some time
* in the future.
*/
virtual void PostDelayedTask(Task* aTask, int aDelayMs) = 0;
GeckoContentController() {}
virtual ~GeckoContentController() {}
};

Просмотреть файл

@ -88,8 +88,7 @@ nsEventStatus GestureEventListener::HandleInputEvent(const InputData& aEvent)
mLongTapTimeoutTask =
NewRunnableMethod(this, &GestureEventListener::TimeoutLongTap);
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
mAsyncPanZoomController->PostDelayedTask(
mLongTapTimeoutTask,
Preferences::GetInt("ui.click_hold_context_menus.delay", 500));
}
@ -169,8 +168,7 @@ nsEventStatus GestureEventListener::HandleInputEvent(const InputData& aEvent)
mDoubleTapTimeoutTask =
NewRunnableMethod(this, &GestureEventListener::TimeoutDoubleTap);
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
mAsyncPanZoomController->PostDelayedTask(
mDoubleTapTimeoutTask,
MAX_TAP_TIME);
}

Просмотреть файл

@ -1,4 +1,7 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set sw=4 ts=8 et tw=80 : */ /* 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
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=4 ts=8 et tw=80 : */
/* 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_layers_GestureEventListener_h

Просмотреть файл

@ -569,6 +569,11 @@ public:
}
}
virtual void PostDelayedTask(Task* aTask, int aDelayMs) MOZ_OVERRIDE
{
MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
}
private:
void DoRequestContentRepaint(const FrameMetrics& aFrameMetrics)
{