зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1289650 - Convert APZChild into a wrapper around GeckoContentController. r=kats
MozReview-Commit-ID: L7ZG7EWKWEo
This commit is contained in:
Родитель
3f375eabe9
Коммит
58795e939e
|
@ -48,6 +48,7 @@
|
|||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
#include "mozilla/layers/APZChild.h"
|
||||
#include "mozilla/layers/CompositorBridgeChild.h"
|
||||
#include "mozilla/layers/ContentProcessController.h"
|
||||
#include "mozilla/layers/ImageBridgeChild.h"
|
||||
#include "mozilla/layers/SharedBufferManagerChild.h"
|
||||
#include "mozilla/layout/RenderFrameChild.h"
|
||||
|
@ -1390,7 +1391,7 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker)
|
|||
bool
|
||||
ContentChild::RecvNotifyLayerAllocated(const dom::TabId& aTabId, const uint64_t& aLayersId)
|
||||
{
|
||||
APZChild* apz = APZChild::Create(aTabId);
|
||||
APZChild* apz = ContentProcessController::Create(aTabId);
|
||||
return CompositorBridgeChild::Get()->SendPAPZConstructor(apz, aLayersId);
|
||||
}
|
||||
|
||||
|
|
|
@ -670,11 +670,6 @@ child:
|
|||
int32_t aModifiers,
|
||||
bool aPreventDefault);
|
||||
|
||||
/**
|
||||
* APZ notification for mouse scroll testing events.
|
||||
*/
|
||||
async MouseScrollTestEvent(uint64_t aLayersId, ViewID aScrollId, nsString aEvent);
|
||||
|
||||
async CompositionEvent(WidgetCompositionEvent event);
|
||||
|
||||
async SelectionEvent(WidgetSelectionEvent event);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/APZEventState.h"
|
||||
#include "mozilla/layers/ContentProcessController.h"
|
||||
#include "mozilla/layers/CompositorBridgeChild.h"
|
||||
#include "mozilla/layers/DoubleTapToZoom.h"
|
||||
#include "mozilla/layers/ImageBridgeChild.h"
|
||||
|
@ -1938,26 +1939,6 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvMouseScrollTestEvent(const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId, const nsString& aEvent)
|
||||
{
|
||||
if (aLayersId != mLayersId) {
|
||||
RefPtr<TabParent> browser = TabParent::GetTabParentFromLayersId(aLayersId);
|
||||
if (!browser) {
|
||||
return false;
|
||||
}
|
||||
NS_DispatchToMainThread(NS_NewRunnableFunction(
|
||||
[aLayersId, browser, aScrollId, aEvent] () -> void {
|
||||
Unused << browser->SendMouseScrollTestEvent(aLayersId, aScrollId, aEvent);
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
|
||||
APZCCallbackHelper::NotifyMozMouseScrollEvent(aScrollId, aEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
|
|
|
@ -388,10 +388,6 @@ public:
|
|||
const int32_t& aModifiers,
|
||||
const bool& aPreventDefault) override;
|
||||
|
||||
virtual bool RecvMouseScrollTestEvent(const uint64_t& aLayersId,
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const nsString& aEvent) override;
|
||||
|
||||
virtual bool RecvNativeSynthesisResponse(const uint64_t& aObserverId,
|
||||
const nsCString& aResponse) override;
|
||||
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
/* -*- 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/. */
|
||||
|
||||
#include "ContentProcessController.h"
|
||||
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
#include "mozilla/layers/APZChild.h"
|
||||
|
||||
#include "InputData.h" // for InputData
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
/**
|
||||
* There are cases where we try to create the APZChild before the corresponding
|
||||
* TabChild has been created, we use an observer for the "tab-child-created"
|
||||
* topic to set the TabChild in the APZChild when it has been created.
|
||||
*/
|
||||
class TabChildCreatedObserver : public nsIObserver
|
||||
{
|
||||
public:
|
||||
TabChildCreatedObserver(ContentProcessController* aController, const dom::TabId& aTabId)
|
||||
: mController(aController),
|
||||
mTabId(aTabId)
|
||||
{}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
private:
|
||||
virtual ~TabChildCreatedObserver()
|
||||
{}
|
||||
|
||||
// TabChildCreatedObserver is owned by mController, and mController outlives its
|
||||
// TabChildCreatedObserver, so the raw pointer is fine.
|
||||
ContentProcessController* mController;
|
||||
dom::TabId mTabId;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(TabChildCreatedObserver, nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChildCreatedObserver::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const char16_t* aData)
|
||||
{
|
||||
MOZ_ASSERT(strcmp(aTopic, "tab-child-created") == 0);
|
||||
|
||||
nsCOMPtr<nsITabChild> tabChild(do_QueryInterface(aSubject));
|
||||
NS_ENSURE_TRUE(tabChild, NS_ERROR_FAILURE);
|
||||
|
||||
dom::TabChild* browser = static_cast<dom::TabChild*>(tabChild.get());
|
||||
|
||||
if (browser->GetTabId() == mTabId) {
|
||||
mController->SetBrowser(browser);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
APZChild*
|
||||
ContentProcessController::Create(const dom::TabId& aTabId)
|
||||
{
|
||||
RefPtr<dom::TabChild> browser = dom::TabChild::FindTabChild(aTabId);
|
||||
|
||||
ContentProcessController* controller = new ContentProcessController();
|
||||
|
||||
nsAutoPtr<APZChild> apz(new APZChild(controller));
|
||||
|
||||
if (browser) {
|
||||
|
||||
controller->SetBrowser(browser);
|
||||
|
||||
} else {
|
||||
|
||||
RefPtr<TabChildCreatedObserver> observer =
|
||||
new TabChildCreatedObserver(controller, aTabId);
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (!os ||
|
||||
NS_FAILED(os->AddObserver(observer, "tab-child-created", false))) {
|
||||
return nullptr;
|
||||
}
|
||||
controller->SetObserver(observer);
|
||||
|
||||
}
|
||||
|
||||
return apz.forget();
|
||||
}
|
||||
|
||||
ContentProcessController::ContentProcessController()
|
||||
: mBrowser(nullptr)
|
||||
{
|
||||
}
|
||||
ContentProcessController::~ContentProcessController()
|
||||
{
|
||||
if (mObserver) {
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
os->RemoveObserver(mObserver, "tab-child-created");
|
||||
} else if (mBrowser) {
|
||||
mBrowser->SetAPZChild(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessController::SetObserver(nsIObserver* aObserver)
|
||||
{
|
||||
MOZ_ASSERT(!mBrowser);
|
||||
mObserver = aObserver;
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessController::SetBrowser(dom::TabChild* aBrowser)
|
||||
{
|
||||
MOZ_ASSERT(!mBrowser);
|
||||
mBrowser = aBrowser;
|
||||
|
||||
if (mObserver) {
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
os->RemoveObserver(mObserver, "tab-child-created");
|
||||
mObserver = nullptr;
|
||||
}
|
||||
}
|
||||
void
|
||||
ContentProcessController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
|
||||
{
|
||||
if (mBrowser) {
|
||||
mBrowser->UpdateFrame(aFrameMetrics);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessController::HandleTap(
|
||||
TapType aType,
|
||||
const LayoutDevicePoint& aPoint,
|
||||
Modifiers aModifiers,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
uint64_t aInputBlockId)
|
||||
{
|
||||
if (mBrowser) {
|
||||
mBrowser->HandleTap(aType, aPoint - mBrowser->GetChromeDisplacement(), aModifiers, aGuid,
|
||||
aInputBlockId, (aType == TapType::eSingleTap));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessController::NotifyAPZStateChange(
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
APZStateChange aChange,
|
||||
int aArg)
|
||||
{
|
||||
if (mBrowser) {
|
||||
mBrowser->NotifyAPZStateChange(aGuid.mScrollId, aChange, aArg);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessController::NotifyMozMouseScrollEvent(
|
||||
const FrameMetrics::ViewID& aScrollId,
|
||||
const nsString& aEvent)
|
||||
{
|
||||
if (mBrowser) {
|
||||
APZCCallbackHelper::NotifyMozMouseScrollEvent(aScrollId, aEvent);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessController::NotifyFlushComplete()
|
||||
{
|
||||
if (mBrowser) {
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
if (nsCOMPtr<nsIDocument> doc = mBrowser->GetDocument()) {
|
||||
shell = doc->GetShell();
|
||||
}
|
||||
APZCCallbackHelper::NotifyFlushComplete(shell.get());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessController::PostDelayedTask(already_AddRefed<Runnable> aRunnable, int aDelayMs)
|
||||
{
|
||||
MOZ_ASSERT_UNREACHABLE("ContentProcessController should only be used remotely.");
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessController::IsRepaintThread()
|
||||
{
|
||||
return NS_IsMainThread();
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessController::DispatchToRepaintThread(already_AddRefed<Runnable> aTask)
|
||||
{
|
||||
NS_DispatchToMainThread(Move(aTask));
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,74 @@
|
|||
/* -*- 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_ContentProcessController_h
|
||||
#define mozilla_layers_ContentProcessController_h
|
||||
|
||||
#include "mozilla/layers/GeckoContentController.h"
|
||||
|
||||
class nsIObserver;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class TabChild;
|
||||
} // namespace dom
|
||||
|
||||
namespace layers {
|
||||
|
||||
class APZChild;
|
||||
|
||||
class ContentProcessController final
|
||||
: public GeckoContentController
|
||||
{
|
||||
public:
|
||||
~ContentProcessController();
|
||||
|
||||
static APZChild* Create(const dom::TabId& aTabId);
|
||||
|
||||
// ContentProcessController
|
||||
|
||||
void SetBrowser(dom::TabChild* aBrowser);
|
||||
|
||||
// GeckoContentController
|
||||
|
||||
void RequestContentRepaint(const FrameMetrics& frame) override;
|
||||
|
||||
void HandleTap(TapType aType,
|
||||
const LayoutDevicePoint& aPoint,
|
||||
Modifiers aModifiers,
|
||||
const ScrollableLayerGuid& aGuid,
|
||||
uint64_t aInputBlockId) override;
|
||||
|
||||
void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
||||
APZStateChange aChange,
|
||||
int aArg) override;
|
||||
|
||||
void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId,
|
||||
const nsString& aEvent) override;
|
||||
|
||||
void NotifyFlushComplete() override;
|
||||
|
||||
void PostDelayedTask(already_AddRefed<Runnable> aRunnable, int aDelayMs) override;
|
||||
|
||||
bool IsRepaintThread() override;
|
||||
|
||||
void DispatchToRepaintThread(already_AddRefed<Runnable> aTask) override;
|
||||
|
||||
private:
|
||||
ContentProcessController();
|
||||
|
||||
void SetObserver(nsIObserver* aObserver);
|
||||
|
||||
RefPtr<dom::TabChild> mBrowser;
|
||||
RefPtr<nsIObserver> mObserver;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_layers_ContentProcessController_h
|
|
@ -5,98 +5,37 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/layers/APZChild.h"
|
||||
#include "mozilla/layers/GeckoContentController.h"
|
||||
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/layers/APZCCallbackHelper.h"
|
||||
|
||||
#include "InputData.h" // for InputData
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
/**
|
||||
* There are cases where we try to create the APZChild before the corresponding
|
||||
* TabChild has been created, we use an observer for the "tab-child-created"
|
||||
* topic to set the TabChild in the APZChild when it has been created.
|
||||
*/
|
||||
class TabChildCreatedObserver : public nsIObserver
|
||||
{
|
||||
public:
|
||||
TabChildCreatedObserver(APZChild* aAPZChild, const dom::TabId& aTabId)
|
||||
: mAPZChild(aAPZChild),
|
||||
mTabId(aTabId)
|
||||
{}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
private:
|
||||
virtual ~TabChildCreatedObserver()
|
||||
{}
|
||||
|
||||
// TabChildCreatedObserver is owned by mAPZChild, and mAPZChild outlives its
|
||||
// TabChildCreatedObserver, so the raw pointer is fine.
|
||||
APZChild* mAPZChild;
|
||||
dom::TabId mTabId;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(TabChildCreatedObserver, nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChildCreatedObserver::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const char16_t* aData)
|
||||
{
|
||||
MOZ_ASSERT(strcmp(aTopic, "tab-child-created") == 0);
|
||||
|
||||
nsCOMPtr<nsITabChild> tabChild(do_QueryInterface(aSubject));
|
||||
NS_ENSURE_TRUE(tabChild, NS_ERROR_FAILURE);
|
||||
|
||||
dom::TabChild* browser = static_cast<dom::TabChild*>(tabChild.get());
|
||||
if (browser->GetTabId() == mTabId) {
|
||||
mAPZChild->SetBrowser(browser);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
APZChild*
|
||||
APZChild::Create(const dom::TabId& aTabId)
|
||||
{
|
||||
RefPtr<dom::TabChild> browser = dom::TabChild::FindTabChild(aTabId);
|
||||
nsAutoPtr<APZChild> apz(new APZChild);
|
||||
if (browser) {
|
||||
apz->SetBrowser(browser);
|
||||
} else {
|
||||
RefPtr<TabChildCreatedObserver> observer =
|
||||
new TabChildCreatedObserver(apz, aTabId);
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (!os ||
|
||||
NS_FAILED(os->AddObserver(observer, "tab-child-created", false))) {
|
||||
return nullptr;
|
||||
}
|
||||
apz->SetObserver(observer);
|
||||
}
|
||||
|
||||
return apz.forget();
|
||||
}
|
||||
|
||||
APZChild::APZChild()
|
||||
: mDestroyed(false)
|
||||
APZChild::APZChild(RefPtr<GeckoContentController> aController)
|
||||
: mController(aController)
|
||||
{
|
||||
MOZ_ASSERT(mController);
|
||||
}
|
||||
|
||||
APZChild::~APZChild()
|
||||
{
|
||||
if (mObserver) {
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
os->RemoveObserver(mObserver, "tab-child-created");
|
||||
} else if (mBrowser) {
|
||||
mBrowser->SetAPZChild(nullptr);
|
||||
if (mController) {
|
||||
mController->Destroy();
|
||||
mController = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
APZChild::RecvRequestContentRepaint(const FrameMetrics& aFrameMetrics)
|
||||
{
|
||||
return mBrowser->UpdateFrame(aFrameMetrics);
|
||||
MOZ_ASSERT(mController->IsRepaintThread());
|
||||
|
||||
mController->RequestContentRepaint(aFrameMetrics);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -107,77 +46,66 @@ APZChild::RecvHandleTap(const TapType& aType,
|
|||
const uint64_t& aInputBlockId,
|
||||
const bool& aCallTakeFocusForClickFromTap)
|
||||
{
|
||||
mBrowser->HandleTap(aType, aPoint - mBrowser->GetChromeDisplacement(), aModifiers, aGuid,
|
||||
aInputBlockId, aCallTakeFocusForClickFromTap);
|
||||
mController->HandleTap(aType, aPoint, aModifiers, aGuid,
|
||||
aInputBlockId);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
APZChild::RecvNotifyMozMouseScrollEvent(const uint64_t& aLayersId,
|
||||
const ViewID& aScrollId,
|
||||
APZChild::RecvUpdateOverscrollVelocity(const float& aX, const float& aY, const bool& aIsRootContent)
|
||||
{
|
||||
mController->UpdateOverscrollVelocity(aX, aY, aIsRootContent);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
APZChild::RecvUpdateOverscrollOffset(const float& aX, const float& aY, const bool& aIsRootContent)
|
||||
{
|
||||
mController->UpdateOverscrollOffset(aX, aY, aIsRootContent);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
APZChild::RecvSetScrollingRootContent(const bool& aIsRootContent)
|
||||
{
|
||||
mController->SetScrollingRootContent(aIsRootContent);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
APZChild::RecvNotifyMozMouseScrollEvent(const ViewID& aScrollId,
|
||||
const nsString& aEvent)
|
||||
{
|
||||
if (mBrowser) {
|
||||
mBrowser->RecvMouseScrollTestEvent(aLayersId, aScrollId, aEvent);
|
||||
}
|
||||
mController->NotifyMozMouseScrollEvent(aScrollId, aEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
APZChild::RecvNotifyAPZStateChange(const ViewID& aViewId,
|
||||
APZChild::RecvNotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
||||
const APZStateChange& aChange,
|
||||
const int& aArg)
|
||||
{
|
||||
return mBrowser->NotifyAPZStateChange(aViewId, aChange, aArg);
|
||||
mController->NotifyAPZStateChange(aGuid, aChange, aArg);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
APZChild::RecvNotifyFlushComplete()
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
if (nsCOMPtr<nsIDocument> doc = mBrowser->GetDocument()) {
|
||||
shell = doc->GetShell();
|
||||
}
|
||||
APZCCallbackHelper::NotifyFlushComplete(shell.get());
|
||||
MOZ_ASSERT(mController->IsRepaintThread());
|
||||
|
||||
mController->NotifyFlushComplete();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
APZChild::RecvDestroy()
|
||||
{
|
||||
mDestroyed = true;
|
||||
if (mBrowser) {
|
||||
mBrowser->SetAPZChild(nullptr);
|
||||
mBrowser = nullptr;
|
||||
}
|
||||
// mController->Destroy will be called in the destructor
|
||||
PAPZChild::Send__delete__(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
APZChild::SetObserver(nsIObserver* aObserver)
|
||||
{
|
||||
MOZ_ASSERT(!mBrowser);
|
||||
mObserver = aObserver;
|
||||
}
|
||||
|
||||
void
|
||||
APZChild::SetBrowser(dom::TabChild* aBrowser)
|
||||
{
|
||||
MOZ_ASSERT(!mBrowser);
|
||||
if (mObserver) {
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
os->RemoveObserver(mObserver, "tab-child-created");
|
||||
mObserver = nullptr;
|
||||
}
|
||||
// We might get the tab-child-created notification after we receive a
|
||||
// Destroy message from the parent. In that case we don't want to install
|
||||
// ourselves with the browser.
|
||||
if (!mDestroyed) {
|
||||
mBrowser = aBrowser;
|
||||
mBrowser->SetAPZChild(this);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -9,25 +9,18 @@
|
|||
|
||||
#include "mozilla/layers/PAPZChild.h"
|
||||
|
||||
class nsIObserver;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class TabChild;
|
||||
} // namespace dom
|
||||
|
||||
namespace layers {
|
||||
|
||||
class GeckoContentController;
|
||||
|
||||
class APZChild final : public PAPZChild
|
||||
{
|
||||
public:
|
||||
static APZChild* Create(const dom::TabId& aTabId);
|
||||
|
||||
explicit APZChild(RefPtr<GeckoContentController> aController);
|
||||
~APZChild();
|
||||
|
||||
void SetBrowser(dom::TabChild* aBrowser);
|
||||
|
||||
bool RecvRequestContentRepaint(const FrameMetrics& frame) override;
|
||||
|
||||
bool RecvHandleTap(const TapType& aType,
|
||||
|
@ -37,11 +30,16 @@ public:
|
|||
const uint64_t& aInputBlockId,
|
||||
const bool& aCallTakeFocusForClickFromTap) override;
|
||||
|
||||
bool RecvNotifyMozMouseScrollEvent(const uint64_t& aLayersId,
|
||||
const ViewID& aScrollId,
|
||||
bool RecvUpdateOverscrollVelocity(const float& aX, const float& aY, const bool& aIsRootContent) override;
|
||||
|
||||
bool RecvUpdateOverscrollOffset(const float& aX, const float& aY, const bool& aIsRootContent) override;
|
||||
|
||||
bool RecvSetScrollingRootContent(const bool& aIsRootContent) override;
|
||||
|
||||
bool RecvNotifyMozMouseScrollEvent(const ViewID& aScrollId,
|
||||
const nsString& aEvent) override;
|
||||
|
||||
bool RecvNotifyAPZStateChange(const ViewID& aViewId,
|
||||
bool RecvNotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
||||
const APZStateChange& aChange,
|
||||
const int& aArg) override;
|
||||
|
||||
|
@ -50,13 +48,7 @@ public:
|
|||
bool RecvDestroy() override;
|
||||
|
||||
private:
|
||||
APZChild();
|
||||
|
||||
void SetObserver(nsIObserver* aObserver);
|
||||
|
||||
RefPtr<dom::TabChild> mBrowser;
|
||||
RefPtr<nsIObserver> mObserver;
|
||||
bool mDestroyed;
|
||||
RefPtr<GeckoContentController> mController;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -2584,7 +2584,7 @@ CrossProcessCompositorBridgeParent::AllocPAPZParent(const uint64_t& aLayersId)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RemoteContentController* controller = new RemoteContentController(aLayersId);
|
||||
RemoteContentController* controller = new RemoteContentController();
|
||||
|
||||
// Increment the controller's refcount before we return it. This will keep the
|
||||
// controller alive until it is released by IPDL in DeallocPAPZParent.
|
||||
|
|
|
@ -57,9 +57,15 @@ child:
|
|||
ScrollableLayerGuid aGuid, uint64_t aInputBlockId,
|
||||
bool aCallTakeFocusForClickFromTap);
|
||||
|
||||
async NotifyMozMouseScrollEvent(uint64_t aLayersId, ViewID aScrollId, nsString aEvent);
|
||||
async UpdateOverscrollVelocity(float aX, float aY, bool aIsRootContent);
|
||||
|
||||
async NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg);
|
||||
async UpdateOverscrollOffset(float aX, float aY, bool aIsRootContent);
|
||||
|
||||
async SetScrollingRootContent(bool aIsRootContent);
|
||||
|
||||
async NotifyMozMouseScrollEvent(ViewID aScrollId, nsString aEvent);
|
||||
|
||||
async NotifyAPZStateChange(ScrollableLayerGuid aGuid, APZStateChange aChange, int aArg);
|
||||
|
||||
async NotifyFlushComplete();
|
||||
|
||||
|
|
|
@ -26,9 +26,8 @@ namespace layers {
|
|||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
RemoteContentController::RemoteContentController(uint64_t aLayersId)
|
||||
RemoteContentController::RemoteContentController()
|
||||
: mCompositorThread(MessageLoop::current())
|
||||
, mLayersId(aLayersId)
|
||||
, mCanSend(true)
|
||||
, mMutex("RemoteContentController")
|
||||
{
|
||||
|
@ -124,10 +123,48 @@ RemoteContentController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
|||
}
|
||||
|
||||
if (mCanSend) {
|
||||
Unused << SendNotifyAPZStateChange(aGuid.mScrollId, aChange, aArg);
|
||||
Unused << SendNotifyAPZStateChange(aGuid, aChange, aArg);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RemoteContentController::UpdateOverscrollVelocity(float aX, float aY, bool aIsRootContent)
|
||||
{
|
||||
if (MessageLoop::current() != mCompositorThread) {
|
||||
mCompositorThread->PostTask(NewRunnableMethod<float,
|
||||
float, bool>(this,
|
||||
&RemoteContentController::UpdateOverscrollVelocity,
|
||||
aX, aY, aIsRootContent));
|
||||
return;
|
||||
}
|
||||
Unused << SendUpdateOverscrollVelocity(aX, aY, aIsRootContent);
|
||||
}
|
||||
|
||||
void
|
||||
RemoteContentController::UpdateOverscrollOffset(float aX, float aY, bool aIsRootContent)
|
||||
{
|
||||
if (MessageLoop::current() != mCompositorThread) {
|
||||
mCompositorThread->PostTask(NewRunnableMethod<float,
|
||||
float, bool>(this,
|
||||
&RemoteContentController::UpdateOverscrollOffset,
|
||||
aX, aY, aIsRootContent));
|
||||
return;
|
||||
}
|
||||
Unused << SendUpdateOverscrollOffset(aX, aY, aIsRootContent);
|
||||
}
|
||||
|
||||
void
|
||||
RemoteContentController::SetScrollingRootContent(bool aIsRootContent)
|
||||
{
|
||||
if (MessageLoop::current() != mCompositorThread) {
|
||||
mCompositorThread->PostTask(NewRunnableMethod<bool>(this,
|
||||
&RemoteContentController::SetScrollingRootContent,
|
||||
aIsRootContent));
|
||||
return;
|
||||
}
|
||||
Unused << SendSetScrollingRootContent(aIsRootContent);
|
||||
}
|
||||
|
||||
void
|
||||
RemoteContentController::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId,
|
||||
const nsString& aEvent)
|
||||
|
@ -142,7 +179,7 @@ RemoteContentController::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& a
|
|||
}
|
||||
|
||||
if (mCanSend) {
|
||||
Unused << SendNotifyMozMouseScrollEvent(mLayersId, aScrollId, aEvent);
|
||||
Unused << SendNotifyMozMouseScrollEvent(aScrollId, aEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class RemoteContentController : public GeckoContentController
|
|||
using GeckoContentController::APZStateChange;
|
||||
|
||||
public:
|
||||
explicit RemoteContentController(uint64_t aLayersId);
|
||||
RemoteContentController();
|
||||
|
||||
virtual ~RemoteContentController();
|
||||
|
||||
|
@ -57,6 +57,12 @@ public:
|
|||
APZStateChange aChange,
|
||||
int aArg) override;
|
||||
|
||||
virtual void UpdateOverscrollVelocity(float aX, float aY, bool aIsRootContent) override;
|
||||
|
||||
virtual void UpdateOverscrollOffset(float aX, float aY, bool aIsRootContent) override;
|
||||
|
||||
virtual void SetScrollingRootContent(bool aIsRootContent) override;
|
||||
|
||||
virtual void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId,
|
||||
const nsString& aEvent) override;
|
||||
|
||||
|
@ -70,7 +76,6 @@ public:
|
|||
|
||||
private:
|
||||
MessageLoop* mCompositorThread;
|
||||
uint64_t mLayersId;
|
||||
bool mCanSend;
|
||||
|
||||
// Mutex protecting members below accessed from multiple threads.
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "mozilla/ipc/MessageChannel.h" // for MessageChannel, etc
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/ipc/Transport.h" // for Transport
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/UniquePtr.h" // for UniquePtr
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
|
|
|
@ -112,6 +112,7 @@ EXPORTS.mozilla.layers += [
|
|||
'apz/util/APZEventState.h',
|
||||
'apz/util/APZThreadUtils.h',
|
||||
'apz/util/ChromeProcessController.h',
|
||||
'apz/util/ContentProcessController.h',
|
||||
'apz/util/DoubleTapToZoom.h',
|
||||
'apz/util/InputAPZContext.h',
|
||||
'apz/util/ScrollInputMethods.h',
|
||||
|
@ -288,6 +289,7 @@ UNIFIED_SOURCES += [
|
|||
'apz/util/APZThreadUtils.cpp',
|
||||
'apz/util/CheckerboardReportService.cpp',
|
||||
'apz/util/ChromeProcessController.cpp',
|
||||
'apz/util/ContentProcessController.cpp',
|
||||
'apz/util/DoubleTapToZoom.cpp',
|
||||
'apz/util/InputAPZContext.cpp',
|
||||
'apz/util/ScrollLinkedEffectDetector.cpp',
|
||||
|
|
Загрузка…
Ссылка в новой задаче