Bug 1525720, part 15 - Apply appropriate nsIRemoteTab methods to all BrowserParents. r=nika

This commit finally updates some nsIRemoteTab methods to apply
to the whole tree of BrowserParent's.

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

--HG--
extra : source : 99f971a02d87941ee49a391de0e0626c170c0821
This commit is contained in:
Ryan Hunt 2019-05-08 16:12:26 -05:00
Родитель 9078c825ec
Коммит 7073efe48d
2 изменённых файлов: 27 добавлений и 7 удалений

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

@ -74,7 +74,9 @@ BrowserHost::GetDocShellIsActive(bool* aDocShellIsActive) {
NS_IMETHODIMP
BrowserHost::SetDocShellIsActive(bool aDocShellIsActive) {
mRoot->SetDocShellIsActive(aDocShellIsActive);
VisitAll([&](BrowserParent* aBrowserParent) {
aBrowserParent->SetDocShellIsActive(aDocShellIsActive);
});
return NS_OK;
}
@ -87,7 +89,9 @@ BrowserHost::GetRenderLayers(bool* aRenderLayers) {
NS_IMETHODIMP
BrowserHost::SetRenderLayers(bool aRenderLayers) {
mRoot->SetRenderLayers(aRenderLayers);
VisitAll([&](BrowserParent* aBrowserParent) {
aBrowserParent->SetRenderLayers(aRenderLayers);
});
return NS_OK;
}
@ -101,28 +105,34 @@ BrowserHost::GetHasLayers(bool* aHasLayers) {
/* void forceRepaint (); */
NS_IMETHODIMP
BrowserHost::ForceRepaint(void) {
mRoot->ForceRepaint();
VisitAll(
[](BrowserParent* aBrowserParent) { aBrowserParent->ForceRepaint(); });
return NS_OK;
}
/* void resolutionChanged (); */
NS_IMETHODIMP
BrowserHost::NotifyResolutionChanged(void) {
mRoot->NotifyResolutionChanged();
VisitAll([](BrowserParent* aBrowserParent) {
aBrowserParent->NotifyResolutionChanged();
});
return NS_OK;
}
/* void deprioritize (); */
NS_IMETHODIMP
BrowserHost::Deprioritize(void) {
mRoot->Deprioritize();
VisitAll(
[](BrowserParent* aBrowserParent) { aBrowserParent->Deprioritize(); });
return NS_OK;
}
/* void preserveLayers (in boolean aPreserveLayers); */
NS_IMETHODIMP
BrowserHost::PreserveLayers(bool aPreserveLayers) {
mRoot->PreserveLayers(aPreserveLayers);
VisitAll([&](BrowserParent* aBrowserParent) {
aBrowserParent->PreserveLayers(aPreserveLayers);
});
return NS_OK;
}
@ -164,7 +174,7 @@ BrowserHost::GetHasPresented(bool* aHasPresented) {
NS_IMETHODIMP
BrowserHost::GetWindowGlobalParents(
nsTArray<RefPtr<WindowGlobalParent>>& aWindowGlobalParents) {
mRoot->VisitAll([&aWindowGlobalParents](BrowserParent* aBrowser) {
VisitAll([&](BrowserParent* aBrowser) {
const auto& windowGlobalParents = aBrowser->ManagedPWindowGlobalParent();
for (auto iter = windowGlobalParents.ConstIter(); !iter.Done();
iter.Next()) {

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

@ -62,6 +62,16 @@ class BrowserHost : public RemoteBrowser, public nsIRemoteTab {
}
a11y::DocAccessibleParent* GetTopLevelDocAccessible() const;
// Visit each BrowserParent in the tree formed by PBrowser and
// PBrowserBridge that is anchored by `mRoot`.
template <typename Callback>
void VisitAll(Callback aCallback) {
if (!mRoot) {
return;
}
mRoot->VisitAll(aCallback);
}
void LoadURL(nsIURI* aURI) override;
void ResumeLoad(uint64_t aPendingSwitchId) override;
void DestroyStart() override;