gecko/widget/gonk/ParentProcessController.cpp
Kartikaya Gupta e7e7d59c58 Bug 995411 - Move various pieces of APZ code into gfx/layers/apz. r=jrmuizel,botond
--HG--
rename : gfx/layers/ipc/GeckoContentController.h => gfx/layers/apz/public/GeckoContentController.h
rename : gfx/layers/composite/APZCTreeManager.cpp => gfx/layers/apz/src/APZCTreeManager.cpp
rename : gfx/layers/composite/APZCTreeManager.h => gfx/layers/apz/src/APZCTreeManager.h
rename : gfx/layers/ipc/AsyncPanZoomController.cpp => gfx/layers/apz/src/AsyncPanZoomController.cpp
rename : gfx/layers/ipc/AsyncPanZoomController.h => gfx/layers/apz/src/AsyncPanZoomController.h
rename : gfx/layers/ipc/Axis.cpp => gfx/layers/apz/src/Axis.cpp
rename : gfx/layers/ipc/Axis.h => gfx/layers/apz/src/Axis.h
rename : gfx/layers/ipc/GestureEventListener.cpp => gfx/layers/apz/src/GestureEventListener.cpp
rename : gfx/layers/ipc/GestureEventListener.h => gfx/layers/apz/src/GestureEventListener.h
rename : gfx/layers/ipc/TaskThrottler.cpp => gfx/layers/apz/src/TaskThrottler.cpp
rename : gfx/layers/ipc/TaskThrottler.h => gfx/layers/apz/src/TaskThrottler.h
rename : widget/xpwidgets/APZCCallbackHelper.cpp => gfx/layers/apz/util/APZCCallbackHelper.cpp
rename : widget/xpwidgets/APZCCallbackHelper.h => gfx/layers/apz/util/APZCCallbackHelper.h
rename : widget/xpwidgets/ActiveElementManager.cpp => gfx/layers/apz/util/ActiveElementManager.cpp
rename : widget/xpwidgets/ActiveElementManager.h => gfx/layers/apz/util/ActiveElementManager.h
2014-04-17 07:54:25 -04:00

68 lines
1.8 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 "ParentProcessController.h"
#include "nsIContent.h"
#include "nsLayoutUtils.h"
#include "mozilla/layers/APZCCallbackHelper.h"
#include "base/message_loop.h"
namespace mozilla {
namespace widget {
class RequestContentRepaintEvent : public nsRunnable
{
typedef mozilla::layers::FrameMetrics FrameMetrics;
public:
RequestContentRepaintEvent(const FrameMetrics& aFrameMetrics)
: mFrameMetrics(aFrameMetrics)
{
}
NS_IMETHOD Run() {
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIContent> content = nsLayoutUtils::FindContentFor(mFrameMetrics.GetScrollId());
if (content) {
mozilla::layers::APZCCallbackHelper::UpdateSubFrame(content, mFrameMetrics);
}
return NS_OK;
}
protected:
FrameMetrics mFrameMetrics;
};
void
ParentProcessController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
{
if (aFrameMetrics.GetScrollId() == FrameMetrics::NULL_SCROLL_ID) {
return;
}
nsCOMPtr<nsIRunnable> r = new RequestContentRepaintEvent(aFrameMetrics);
if (!NS_IsMainThread()) {
NS_DispatchToMainThread(r);
} else {
r->Run();
}
}
void
ParentProcessController::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration)
{
mozilla::layers::APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
}
void
ParentProcessController::PostDelayedTask(Task* aTask, int aDelayMs)
{
MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
}
}
}