Bug 1525720, part 14 - Move final bits of nsIRemoteTab implementation to BrowserHost. r=nika

This commit moves the actual implementation of nsIRemoteTab from BrowserParent
to BrowserHost, without any functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D31445

--HG--
extra : source : d25963c72ff7981990660050182a82ea3e935f53
This commit is contained in:
Ryan Hunt 2019-05-08 15:47:18 -05:00
parent 4683a8b07a
commit 9078c825ec
7 changed files with 219 additions and 303 deletions

View File

@ -672,8 +672,8 @@ void DocAccessibleParent::MaybeInitWindowEmulation() {
rect.MoveToX(rootRect.X() - rect.X());
rect.MoveToY(rect.Y() - rootRect.Y());
auto tab = static_cast<dom::BrowserParent*>(Manager());
tab->GetDocShellIsActive(&isActive);
auto browserParent = static_cast<dom::BrowserParent*>(Manager());
isActive = browserParent->GetDocShellIsActive();
}
nsWinUtils::NativeWindowCreateProc onCreate([this](HWND aHwnd) -> void {

View File

@ -1096,9 +1096,7 @@ static bool HandleAccessKeyInRemoteChild(BrowserParent* aBrowserParent,
AccessKeyInfo* accessKeyInfo = static_cast<AccessKeyInfo*>(aArg);
// Only forward accesskeys for the active tab.
bool active;
aBrowserParent->GetDocShellIsActive(&active);
if (active) {
if (aBrowserParent->GetDocShellIsActive()) {
// Even if there is no target for the accesskey in this process,
// the event may match with a content accesskey. If so, the keyboard
// event should be handled with reply event for preventing double action.

View File

@ -68,93 +68,125 @@ void BrowserHost::UpdateDimensions(const nsIntRect& aRect,
/* attribute boolean docShellIsActive; */
NS_IMETHODIMP
BrowserHost::GetDocShellIsActive(bool* aDocShellIsActive) {
return mRoot->GetDocShellIsActive(aDocShellIsActive);
*aDocShellIsActive = mRoot->GetDocShellIsActive();
return NS_OK;
}
NS_IMETHODIMP
BrowserHost::SetDocShellIsActive(bool aDocShellIsActive) {
return mRoot->SetDocShellIsActive(aDocShellIsActive);
mRoot->SetDocShellIsActive(aDocShellIsActive);
return NS_OK;
}
/* attribute boolean renderLayers; */
NS_IMETHODIMP
BrowserHost::GetRenderLayers(bool* aRenderLayers) {
return mRoot->GetRenderLayers(aRenderLayers);
*aRenderLayers = mRoot->GetRenderLayers();
return NS_OK;
}
NS_IMETHODIMP
BrowserHost::SetRenderLayers(bool aRenderLayers) {
return mRoot->SetRenderLayers(aRenderLayers);
mRoot->SetRenderLayers(aRenderLayers);
return NS_OK;
}
/* readonly attribute boolean hasLayers; */
NS_IMETHODIMP
BrowserHost::GetHasLayers(bool* aHasLayers) {
return mRoot->GetHasLayers(aHasLayers);
*aHasLayers = mRoot->GetHasLayers();
return NS_OK;
}
/* void forceRepaint (); */
NS_IMETHODIMP
BrowserHost::ForceRepaint(void) { return mRoot->ForceRepaint(); }
BrowserHost::ForceRepaint(void) {
mRoot->ForceRepaint();
return NS_OK;
}
/* void resolutionChanged (); */
NS_IMETHODIMP
BrowserHost::NotifyResolutionChanged(void) {
return mRoot->NotifyResolutionChanged();
mRoot->NotifyResolutionChanged();
return NS_OK;
}
/* void deprioritize (); */
NS_IMETHODIMP
BrowserHost::Deprioritize(void) { return mRoot->Deprioritize(); }
BrowserHost::Deprioritize(void) {
mRoot->Deprioritize();
return NS_OK;
}
/* void preserveLayers (in boolean aPreserveLayers); */
NS_IMETHODIMP
BrowserHost::PreserveLayers(bool aPreserveLayers) {
return mRoot->PreserveLayers(aPreserveLayers);
mRoot->PreserveLayers(aPreserveLayers);
return NS_OK;
}
/* readonly attribute uint64_t tabId; */
NS_IMETHODIMP
BrowserHost::GetTabId(uint64_t* aTabId) { return mRoot->GetTabId(aTabId); }
BrowserHost::GetTabId(uint64_t* aTabId) {
*aTabId = mRoot->GetTabId();
return NS_OK;
}
/* readonly attribute uint64_t contentProcessId; */
NS_IMETHODIMP
BrowserHost::GetContentProcessId(uint64_t* aContentProcessId) {
return mRoot->GetContentProcessId(aContentProcessId);
*aContentProcessId = GetContentParent()->ChildID();
return NS_OK;
}
/* readonly attribute int32_t osPid; */
NS_IMETHODIMP
BrowserHost::GetOsPid(int32_t* aOsPid) { return mRoot->GetOsPid(aOsPid); }
BrowserHost::GetOsPid(int32_t* aOsPid) {
*aOsPid = GetContentParent()->Pid();
return NS_OK;
}
/* readonly attribute boolean hasContentOpener; */
NS_IMETHODIMP
BrowserHost::GetHasContentOpener(bool* aHasContentOpener) {
return mRoot->GetHasContentOpener(aHasContentOpener);
*aHasContentOpener = mRoot->GetHasContentOpener();
return NS_OK;
}
/* readonly attribute boolean hasPresented; */
NS_IMETHODIMP
BrowserHost::GetHasPresented(bool* aHasPresented) {
return mRoot->GetHasPresented(aHasPresented);
*aHasPresented = mRoot->GetHasPresented();
return NS_OK;
}
NS_IMETHODIMP
BrowserHost::GetWindowGlobalParents(
nsTArray<RefPtr<WindowGlobalParent>>& aWindowGlobalParents) {
return mRoot->GetWindowGlobalParents(aWindowGlobalParents);
mRoot->VisitAll([&aWindowGlobalParents](BrowserParent* aBrowser) {
const auto& windowGlobalParents = aBrowser->ManagedPWindowGlobalParent();
for (auto iter = windowGlobalParents.ConstIter(); !iter.Done();
iter.Next()) {
WindowGlobalParent* windowGlobalParent =
static_cast<WindowGlobalParent*>(iter.Get()->GetKey());
aWindowGlobalParents.AppendElement(windowGlobalParent);
}
});
return NS_OK;
}
/* void transmitPermissionsForPrincipal (in nsIPrincipal aPrincipal); */
NS_IMETHODIMP
BrowserHost::TransmitPermissionsForPrincipal(nsIPrincipal* aPrincipal) {
return mRoot->TransmitPermissionsForPrincipal(aPrincipal);
return GetContentParent()->TransmitPermissionsForPrincipal(aPrincipal);
}
/* readonly attribute boolean hasBeforeUnload; */
NS_IMETHODIMP
BrowserHost::GetHasBeforeUnload(bool* aHasBeforeUnload) {
return mRoot->GetHasBeforeUnload(aHasBeforeUnload);
*aHasBeforeUnload = mRoot->GetHasBeforeUnload();
return NS_OK;
}
/* readonly attribute Element ownerElement; */
@ -170,34 +202,80 @@ NS_IMETHODIMP
BrowserHost::StartApzAutoscroll(float aAnchorX, float aAnchorY,
nsViewID aScrollId, uint32_t aPresShellId,
bool* _retval) {
return mRoot->StartApzAutoscroll(aAnchorX, aAnchorY, aScrollId, aPresShellId,
_retval);
*_retval =
mRoot->StartApzAutoscroll(aAnchorX, aAnchorY, aScrollId, aPresShellId);
return NS_OK;
}
/* void stopApzAutoscroll (in nsViewID aScrollId, in uint32_t aPresShellId); */
NS_IMETHODIMP
BrowserHost::StopApzAutoscroll(nsViewID aScrollId, uint32_t aPresShellId) {
return mRoot->StopApzAutoscroll(aScrollId, aPresShellId);
mRoot->StopApzAutoscroll(aScrollId, aPresShellId);
return NS_OK;
}
/* bool saveRecording (in AString aFileName); */
NS_IMETHODIMP
BrowserHost::SaveRecording(const nsAString& aFileName, bool* _retval) {
return mRoot->SaveRecording(aFileName, _retval);
nsCOMPtr<nsIFile> file;
nsresult rv = NS_NewLocalFile(aFileName, false, getter_AddRefs(file));
if (NS_FAILED(rv)) {
return rv;
}
return GetContentParent()->SaveRecording(file, _retval);
}
/* Promise getContentBlockingLog (); */
NS_IMETHODIMP
BrowserHost::GetContentBlockingLog(::mozilla::dom::Promise** _retval) {
return mRoot->GetContentBlockingLog(_retval);
BrowserHost::GetContentBlockingLog(::mozilla::dom::Promise** aPromise) {
NS_ENSURE_ARG_POINTER(aPromise);
*aPromise = nullptr;
if (!mRoot->GetOwnerElement()) {
return NS_ERROR_FAILURE;
}
ErrorResult rv;
RefPtr<Promise> jsPromise = Promise::Create(
mRoot->GetOwnerElement()->OwnerDoc()->GetOwnerGlobal(), rv);
if (rv.Failed()) {
return NS_ERROR_FAILURE;
}
RefPtr<Promise> copy(jsPromise);
copy.forget(aPromise);
auto cblPromise = mRoot->SendGetContentBlockingLog();
cblPromise->Then(
GetMainThreadSerialEventTarget(), __func__,
[jsPromise](Tuple<nsCString, bool>&& aResult) {
if (Get<1>(aResult)) {
NS_ConvertUTF8toUTF16 utf16(Get<0>(aResult));
jsPromise->MaybeResolve(std::move(utf16));
} else {
jsPromise->MaybeRejectWithUndefined();
}
},
[jsPromise](ResponseRejectReason&& aReason) {
jsPromise->MaybeRejectWithUndefined();
});
return NS_OK;
}
NS_IMETHODIMP
BrowserHost::MaybeCancelContentJSExecutionFromScript(
nsIRemoteTab::NavigationType aNavigationType,
JS::Handle<JS::Value> aCancelContentJSOptions, JSContext* aCx) {
return mRoot->MaybeCancelContentJSExecutionFromScript(
aNavigationType, aCancelContentJSOptions, aCx);
dom::CancelContentJSOptions cancelContentJSOptions;
if (!cancelContentJSOptions.Init(aCx, aCancelContentJSOptions)) {
return NS_ERROR_INVALID_ARG;
}
if (StaticPrefs::dom_ipc_cancel_content_js_when_navigating()) {
GetContentParent()->CancelContentJSExecutionIfRunning(
mRoot, aNavigationType, cancelContentJSOptions);
}
return NS_OK;
}
} // namespace dom

View File

@ -47,6 +47,7 @@ class BrowserHost : public RemoteBrowser, public nsIRemoteTab {
// Get the IPDL actor for the root BrowserParent. This method should be
// avoided and consumers migrated to use this class.
BrowserParent* GetActor() { return mRoot; }
ContentParent* GetContentParent() const { return mRoot->Manager(); }
BrowserHost* AsBrowserHost() override { return this; }
BrowserBridgeHost* AsBrowserBridgeHost() override { return nullptr; }

View File

@ -545,11 +545,6 @@ void BrowserParent::SetOwnerElement(Element* aElement) {
});
}
NS_IMETHODIMP BrowserParent::GetOwnerElement(Element** aElement) {
*aElement = do_AddRef(GetOwnerElement()).take();
return NS_OK;
}
void BrowserParent::CacheFrameLoader(nsFrameLoader* aFrameLoader) {
mFrameLoader = aFrameLoader;
}
@ -2968,9 +2963,9 @@ mozilla::ipc::IPCResult BrowserParent::RecvRespondStartSwipeEvent(
return IPC_OK();
}
// defined in nsIRemoteTab
NS_IMETHODIMP
BrowserParent::SetDocShellIsActive(bool isActive) {
bool BrowserParent::GetDocShellIsActive() { return mDocShellIsActive; }
void BrowserParent::SetDocShellIsActive(bool isActive) {
mDocShellIsActive = isActive;
SetRenderLayers(isActive);
Unused << SendSetDocShellIsActive(isActive);
@ -2996,18 +2991,15 @@ BrowserParent::SetDocShellIsActive(bool isActive) {
if (Manager()->IsRecordingOrReplaying()) {
SetIsActiveRecordReplayTab(isActive);
}
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::GetDocShellIsActive(bool* aIsActive) {
*aIsActive = mDocShellIsActive;
return NS_OK;
}
bool BrowserParent::GetHasPresented() { return mHasPresented; }
NS_IMETHODIMP
BrowserParent::SetRenderLayers(bool aEnabled) {
bool BrowserParent::GetHasLayers() { return mHasLayers; }
bool BrowserParent::GetRenderLayers() { return mRenderLayers; }
void BrowserParent::SetRenderLayers(bool aEnabled) {
if (mActiveInPriorityManager != aEnabled) {
mActiveInPriorityManager = aEnabled;
// Let's inform the priority manager. This operation can end up with the
@ -3030,54 +3022,18 @@ BrowserParent::SetRenderLayers(bool aEnabled) {
}));
}
return NS_OK;
return;
}
// Preserve layers means that attempts to stop rendering layers
// will be ignored.
if (!aEnabled && mPreserveLayers) {
return NS_OK;
return;
}
mRenderLayers = aEnabled;
SetRenderLayersInternal(aEnabled, false /* aForceRepaint */);
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::GetRenderLayers(bool* aResult) {
*aResult = mRenderLayers;
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::GetHasLayers(bool* aResult) {
*aResult = mHasLayers;
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::Deprioritize() {
if (mActiveInPriorityManager) {
ProcessPriorityManager::TabActivityChanged(this, false);
mActiveInPriorityManager = false;
}
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::ForceRepaint() {
if (!mActiveInPriorityManager) {
// If a tab is left and then returned to very rapidly, it can be
// deprioritized without losing its loaded status. In this case we won't
// go through SetRenderLayers.
mActiveInPriorityManager = true;
ProcessPriorityManager::TabActivityChanged(this, true);
}
SetRenderLayersInternal(true /* aEnabled */, true /* aForceRepaint */);
return NS_OK;
}
void BrowserParent::SetRenderLayersInternal(bool aEnabled, bool aForceRepaint) {
@ -3095,72 +3051,98 @@ void BrowserParent::SetRenderLayersInternal(bool aEnabled, bool aForceRepaint) {
}
}
NS_IMETHODIMP
BrowserParent::PreserveLayers(bool aPreserveLayers) {
void BrowserParent::PreserveLayers(bool aPreserveLayers) {
mPreserveLayers = aPreserveLayers;
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::SaveRecording(const nsAString& aFilename, bool* aRetval) {
nsCOMPtr<nsIFile> file;
nsresult rv = NS_NewLocalFile(aFilename, false, getter_AddRefs(file));
if (NS_FAILED(rv)) {
return rv;
void BrowserParent::ForceRepaint() {
if (!mActiveInPriorityManager) {
// If a tab is left and then returned to very rapidly, it can be
// deprioritized without losing its loaded status. In this case we won't
// go through SetRenderLayers.
mActiveInPriorityManager = true;
ProcessPriorityManager::TabActivityChanged(this, true);
}
return Manager()->SaveRecording(file, aRetval);
SetRenderLayersInternal(true /* aEnabled */, true /* aForceRepaint */);
}
NS_IMETHODIMP
BrowserParent::GetContentBlockingLog(Promise** aPromise) {
NS_ENSURE_ARG_POINTER(aPromise);
*aPromise = nullptr;
if (!mFrameElement) {
return NS_ERROR_FAILURE;
void BrowserParent::NotifyResolutionChanged() {
if (!mIsDestroyed) {
// TryCacheDPIAndScale()'s cache is keyed off of
// mDPI being greater than 0, so this invalidates it.
mDPI = -1;
TryCacheDPIAndScale();
// If mDPI was set to -1 to invalidate it and then TryCacheDPIAndScale
// fails to cache the values, then mDefaultScale.scale might be invalid.
// We don't want to send that value to content. Just send -1 for it too in
// that case.
Unused << SendUIResolutionChanged(mDPI, mRounding,
mDPI < 0 ? -1.0 : mDefaultScale.scale);
}
ErrorResult rv;
RefPtr<Promise> jsPromise =
Promise::Create(mFrameElement->OwnerDoc()->GetOwnerGlobal(), rv);
if (rv.Failed()) {
return NS_ERROR_FAILURE;
}
RefPtr<Promise> copy(jsPromise);
copy.forget(aPromise);
auto cblPromise = SendGetContentBlockingLog();
cblPromise->Then(
GetMainThreadSerialEventTarget(), __func__,
[jsPromise](Tuple<nsCString, bool>&& aResult) {
if (Get<1>(aResult)) {
NS_ConvertUTF8toUTF16 utf16(Get<0>(aResult));
jsPromise->MaybeResolve(std::move(utf16));
} else {
jsPromise->MaybeRejectWithUndefined();
}
},
[jsPromise](ResponseRejectReason&& aReason) {
jsPromise->MaybeRejectWithUndefined();
});
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::MaybeCancelContentJSExecutionFromScript(
nsIRemoteTab::NavigationType aNavigationType,
JS::Handle<JS::Value> aCancelContentJSOptions, JSContext* aCx) {
dom::CancelContentJSOptions cancelContentJSOptions;
if (!cancelContentJSOptions.Init(aCx, aCancelContentJSOptions)) {
return NS_ERROR_INVALID_ARG;
void BrowserParent::Deprioritize() {
if (mActiveInPriorityManager) {
ProcessPriorityManager::TabActivityChanged(this, false);
mActiveInPriorityManager = false;
}
if (StaticPrefs::dom_ipc_cancel_content_js_when_navigating()) {
Manager()->CancelContentJSExecutionIfRunning(this, aNavigationType,
cancelContentJSOptions);
}
bool BrowserParent::GetHasContentOpener() { return mHasContentOpener; }
void BrowserParent::SetHasContentOpener(bool aHasContentOpener) {
mHasContentOpener = aHasContentOpener;
}
bool BrowserParent::GetHasBeforeUnload() { return mHasBeforeUnload; }
bool BrowserParent::StartApzAutoscroll(float aAnchorX, float aAnchorY,
nsViewID aScrollId,
uint32_t aPresShellId) {
if (!AsyncPanZoomEnabled()) {
return false;
}
bool success = false;
if (mRenderFrame.IsInitialized()) {
layers::LayersId layersId = mRenderFrame.GetLayersId();
if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
SLGuidAndRenderRoot guid(layersId, aPresShellId, aScrollId,
gfxUtils::GetContentRenderRoot());
// The anchor coordinates that are passed in are relative to the origin
// of the screen, but we are sending them to APZ which only knows about
// coordinates relative to the widget, so convert them accordingly.
CSSPoint anchorCss{aAnchorX, aAnchorY};
LayoutDeviceIntPoint anchor =
RoundedToInt(anchorCss * widget->GetDefaultScale());
anchor -= widget->WidgetToScreenOffset();
success = widget->StartAsyncAutoscroll(
ViewAs<ScreenPixel>(
anchor, PixelCastJustification::LayoutDeviceIsScreenForBounds),
guid);
}
}
return success;
}
void BrowserParent::StopApzAutoscroll(nsViewID aScrollId,
uint32_t aPresShellId) {
if (!AsyncPanZoomEnabled()) {
return;
}
if (mRenderFrame.IsInitialized()) {
layers::LayersId layersId = mRenderFrame.GetLayersId();
if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
SLGuidAndRenderRoot guid(layersId, aPresShellId, aScrollId,
gfxUtils::GetContentRenderRoot());
widget->StopAsyncAutoscroll(guid);
}
}
return NS_OK;
}
void BrowserParent::SuppressDisplayport(bool aEnabled) {
@ -3180,87 +3162,10 @@ void BrowserParent::SuppressDisplayport(bool aEnabled) {
Unused << SendSuppressDisplayport(aEnabled);
}
NS_IMETHODIMP
BrowserParent::GetTabId(uint64_t* aId) {
*aId = GetTabId();
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::GetContentProcessId(uint64_t* aId) {
*aId = Manager()->GetChildID();
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::GetOsPid(int32_t* aId) {
*aId = Manager()->Pid();
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::GetHasContentOpener(bool* aResult) {
*aResult = mHasContentOpener;
return NS_OK;
}
void BrowserParent::SetHasContentOpener(bool aHasContentOpener) {
mHasContentOpener = aHasContentOpener;
}
NS_IMETHODIMP
BrowserParent::GetHasPresented(bool* aResult) {
*aResult = mHasPresented;
return NS_OK;
}
void BrowserParent::NavigateByKey(bool aForward, bool aForDocumentNavigation) {
Unused << SendNavigateByKey(aForward, aForDocumentNavigation);
}
NS_IMETHODIMP
BrowserParent::GetWindowGlobalParents(
nsTArray<RefPtr<WindowGlobalParent>>& aWindowGlobalParents) {
VisitAll([&aWindowGlobalParents](BrowserParent* aBrowser) {
const auto& windowGlobalParents = aBrowser->ManagedPWindowGlobalParent();
for (auto iter = windowGlobalParents.ConstIter(); !iter.Done();
iter.Next()) {
WindowGlobalParent* windowGlobalParent =
static_cast<WindowGlobalParent*>(iter.Get()->GetKey());
aWindowGlobalParents.AppendElement(windowGlobalParent);
}
});
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::TransmitPermissionsForPrincipal(nsIPrincipal* aPrincipal) {
return Manager()->TransmitPermissionsForPrincipal(aPrincipal);
}
NS_IMETHODIMP
BrowserParent::GetHasBeforeUnload(bool* aResult) {
*aResult = mHasBeforeUnload;
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::NotifyResolutionChanged() {
if (!mIsDestroyed) {
// TryCacheDPIAndScale()'s cache is keyed off of
// mDPI being greater than 0, so this invalidates it.
mDPI = -1;
TryCacheDPIAndScale();
// If mDPI was set to -1 to invalidate it and then TryCacheDPIAndScale
// fails to cache the values, then mDefaultScale.scale might be invalid.
// We don't want to send that value to content. Just send -1 for it too in
// that case.
Unused << SendUIResolutionChanged(mDPI, mRounding,
mDPI < 0 ? -1.0 : mDefaultScale.scale);
}
return NS_OK;
}
void BrowserParent::LayerTreeUpdate(const LayersObserverEpoch& aEpoch,
bool aActive) {
// Ignore updates from old epochs. They might tell us that layers are
@ -3678,58 +3583,6 @@ void BrowserParent::StartPersistence(
// (The actor will be destroyed on constructor failure.)
}
NS_IMETHODIMP
BrowserParent::StartApzAutoscroll(float aAnchorX, float aAnchorY,
nsViewID aScrollId, uint32_t aPresShellId,
bool* aOutRetval) {
if (!AsyncPanZoomEnabled()) {
*aOutRetval = false;
return NS_OK;
}
bool success = false;
if (mRenderFrame.IsInitialized()) {
layers::LayersId layersId = mRenderFrame.GetLayersId();
if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
SLGuidAndRenderRoot guid(layersId, aPresShellId, aScrollId,
gfxUtils::GetContentRenderRoot());
// The anchor coordinates that are passed in are relative to the origin
// of the screen, but we are sending them to APZ which only knows about
// coordinates relative to the widget, so convert them accordingly.
CSSPoint anchorCss{aAnchorX, aAnchorY};
LayoutDeviceIntPoint anchor =
RoundedToInt(anchorCss * widget->GetDefaultScale());
anchor -= widget->WidgetToScreenOffset();
success = widget->StartAsyncAutoscroll(
ViewAs<ScreenPixel>(
anchor, PixelCastJustification::LayoutDeviceIsScreenForBounds),
guid);
}
}
*aOutRetval = success;
return NS_OK;
}
NS_IMETHODIMP
BrowserParent::StopApzAutoscroll(nsViewID aScrollId, uint32_t aPresShellId) {
if (!AsyncPanZoomEnabled()) {
return NS_OK;
}
if (mRenderFrame.IsInitialized()) {
layers::LayersId layersId = mRenderFrame.GetLayersId();
if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
SLGuidAndRenderRoot guid(layersId, aPresShellId, aScrollId,
gfxUtils::GetContentRenderRoot());
widget->StopAsyncAutoscroll(guid);
}
}
return NS_OK;
}
void BrowserParent::SkipBrowsingContextDetach() {
RefPtr<nsFrameLoader> fl = GetFrameLoader();
MOZ_ASSERT(fl);

View File

@ -673,34 +673,25 @@ class BrowserParent final : public PBrowserParent,
void SkipBrowsingContextDetach();
NS_IMETHOD GetDocShellIsActive(bool* aDocShellIsActive);
NS_IMETHOD SetDocShellIsActive(bool aDocShellIsActive);
NS_IMETHOD GetRenderLayers(bool* aRenderLayers);
NS_IMETHOD SetRenderLayers(bool aRenderLayers);
NS_IMETHOD GetHasLayers(bool* aHasLayers);
NS_IMETHOD ForceRepaint(void);
NS_IMETHOD NotifyResolutionChanged(void);
NS_IMETHOD Deprioritize(void);
NS_IMETHOD PreserveLayers(bool aPreserveLayers);
NS_IMETHOD GetTabId(uint64_t* aTabId);
NS_IMETHOD GetContentProcessId(uint64_t* aContentProcessId);
NS_IMETHOD GetOsPid(int32_t* aOsPid);
NS_IMETHOD GetHasContentOpener(bool* aHasContentOpener);
NS_IMETHOD GetHasPresented(bool* aHasPresented);
NS_IMETHOD GetWindowGlobalParents(
nsTArray<RefPtr<WindowGlobalParent>>& aWindowGlobalParents);
NS_IMETHOD TransmitPermissionsForPrincipal(nsIPrincipal* aPrincipal);
NS_IMETHOD GetHasBeforeUnload(bool* aHasBeforeUnload);
NS_IMETHOD GetOwnerElement(mozilla::dom::Element** aOwnerElement);
NS_IMETHOD StartApzAutoscroll(float aAnchorX, float aAnchorY,
nsViewID aScrollId, uint32_t aPresShellId,
bool* _retval);
NS_IMETHOD StopApzAutoscroll(nsViewID aScrollId, uint32_t aPresShellId);
NS_IMETHOD SaveRecording(const nsAString& aFileName, bool* _retval);
NS_IMETHOD GetContentBlockingLog(::mozilla::dom::Promise** _retval);
NS_IMETHOD MaybeCancelContentJSExecutionFromScript(
nsIRemoteTab::NavigationType aNavigationType,
JS::Handle<JS::Value> aCancelContentJSOptions, JSContext* aCx);
bool GetDocShellIsActive();
void SetDocShellIsActive(bool aDocShellIsActive);
bool GetHasPresented();
bool GetHasLayers();
bool GetRenderLayers();
void SetRenderLayers(bool aRenderLayers);
void PreserveLayers(bool aPreserveLayers);
void ForceRepaint();
void NotifyResolutionChanged();
void Deprioritize();
bool GetHasContentOpener();
bool GetHasBeforeUnload();
bool StartApzAutoscroll(float aAnchorX, float aAnchorY, nsViewID aScrollId,
uint32_t aPresShellId);
void StopApzAutoscroll(nsViewID aScrollId, uint32_t aPresShellId);
protected:
friend BrowserBridgeParent;

View File

@ -694,12 +694,7 @@ void ParticularProcessPriorityManager::OnBrowserParentDestroyed(
return;
}
uint64_t tabId;
if (NS_WARN_IF(NS_FAILED(browserParent->GetTabId(&tabId)))) {
return;
}
mActiveBrowserParents.RemoveEntry(tabId);
mActiveBrowserParents.RemoveEntry(browserParent->GetTabId());
ResetPriority();
}