Bug 1534395 - Rename TabParent to BrowserParent. r=nika

This commit renames TabParent to BrowserParent.

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

--HG--
rename : dom/ipc/TabParent.cpp => dom/ipc/BrowserParent.cpp
rename : dom/ipc/TabParent.h => dom/ipc/BrowserParent.h
extra : rebase_source : d2706b9f42177d8de16068b7b1d088a44b8720a4
extra : histedit_source : a617ddac45c58050ef799116a67d2d983f2a8f6d%2C1d1dabd8761a32d548a6fbf1027be960698f6a5e
This commit is contained in:
Ryan Hunt 2019-04-09 16:38:15 -05:00
parent 3675f2449b
commit 0eeced87be
127 changed files with 1215 additions and 1161 deletions

View File

@ -16,7 +16,7 @@
#include "nsIPersistentProperties2.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/a11y/DocAccessibleParent.h"
#include "mozilla/a11y/DocManager.h"
@ -120,7 +120,8 @@ void SessionAccessibility::Click(int32_t aID) {
SessionAccessibility* SessionAccessibility::GetInstanceFor(
ProxyAccessible* aAccessible) {
auto tab = static_cast<dom::TabParent*>(aAccessible->Document()->Manager());
auto tab =
static_cast<dom::BrowserParent*>(aAccessible->Document()->Manager());
dom::Element* frame = tab->GetOwnerElement();
MOZ_ASSERT(frame);
if (!frame) {

View File

@ -17,7 +17,7 @@
#include "mozilla/a11y/DocManager.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
namespace mozilla {
namespace a11y {
@ -176,7 +176,7 @@ void FocusManager::ActiveItemChanged(Accessible* aItem, bool aCheckIfActive) {
if (domfm) {
nsIContent* focusedElm = domfm->GetFocusedElement();
if (EventStateManager::IsRemoteTarget(focusedElm)) {
dom::TabParent* tab = dom::TabParent::GetFrom(focusedElm);
dom::BrowserParent* tab = dom::BrowserParent::GetFrom(focusedElm);
if (tab) {
a11y::DocAccessibleParent* dap = tab->GetTopLevelDocAccessible();
if (dap) {

View File

@ -9,7 +9,7 @@
#include "nsAccUtils.h"
#include "DocAccessible-inl.h"
#include "mozilla/a11y/DocAccessibleParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "Role.h"
#include "States.h"
@ -185,7 +185,7 @@ Accessible* OuterDocAccessible::GetChildAt(uint32_t aIndex) const {
#endif // defined(XP_WIN)
DocAccessibleParent* OuterDocAccessible::RemoteChildDoc() const {
dom::TabParent* tab = dom::TabParent::GetFrom(GetContent());
dom::BrowserParent* tab = dom::BrowserParent::GetFrom(GetContent());
if (!tab) return nullptr;
return tab->GetTopLevelDocAccessible();

View File

@ -669,12 +669,12 @@ ProxyAccessible* RootAccessible::GetPrimaryRemoteTopLevelContentDoc() const {
mDocumentNode->GetDocShell()->GetTreeOwner(getter_AddRefs(owner));
NS_ENSURE_TRUE(owner, nullptr);
nsCOMPtr<nsIRemoteTab> tabParent;
owner->GetPrimaryRemoteTab(getter_AddRefs(tabParent));
if (!tabParent) {
nsCOMPtr<nsIRemoteTab> browserParent;
owner->GetPrimaryRemoteTab(getter_AddRefs(browserParent));
if (!browserParent) {
return nullptr;
}
auto tab = static_cast<dom::TabParent*>(tabParent.get());
auto tab = static_cast<dom::BrowserParent*>(browserParent.get());
return tab->GetTopLevelDocAccessible();
}

View File

@ -6,7 +6,7 @@
#include "DocAccessibleParent.h"
#include "mozilla/a11y/Platform.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "xpcAccessibleDocument.h"
#include "xpcAccEvents.h"
#include "nsAccUtils.h"
@ -541,7 +541,7 @@ ipc::IPCResult DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
mozilla::ipc::IPCResult DocAccessibleParent::RecvShutdown() {
Destroy();
auto mgr = static_cast<dom::TabParent*>(Manager());
auto mgr = static_cast<dom::BrowserParent*>(Manager());
if (!mgr->IsDestroyed()) {
if (!PDocAccessibleParent::Send__delete__(this)) {
return IPC_FAIL_NO_REASON(mgr);
@ -654,7 +654,7 @@ void DocAccessibleParent::MaybeInitWindowEmulation() {
return;
}
// XXX get the bounds from the tabParent instead of poking at accessibles
// XXX get the bounds from the browserParent instead of poking at accessibles
// which might not exist yet.
Accessible* outerDoc = OuterDocOfRemoteBrowser();
if (!outerDoc) {
@ -672,7 +672,7 @@ void DocAccessibleParent::MaybeInitWindowEmulation() {
rect.MoveToX(rootRect.X() - rect.X());
rect.MoveToY(rect.Y() - rootRect.Y());
auto tab = static_cast<dom::TabParent*>(Manager());
auto tab = static_cast<dom::BrowserParent*>(Manager());
tab->GetDocShellIsActive(&isActive);
}
@ -708,7 +708,7 @@ void DocAccessibleParent::MaybeInitWindowEmulation() {
*/
void DocAccessibleParent::SendParentCOMProxy() {
// Make sure that we're not racing with a tab shutdown
auto tab = static_cast<dom::TabParent*>(Manager());
auto tab = static_cast<dom::BrowserParent*>(Manager());
MOZ_ASSERT(tab);
if (tab->IsDestroyed()) {
return;

View File

@ -12,7 +12,7 @@
#include "mozilla/a11y/ProxyAccessible.h"
#include "mozilla/a11y/Role.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/Unused.h"
#include "RelationType.h"
#include "xpcAccessibleDocument.h"
@ -116,7 +116,7 @@ Derived* ProxyAccessibleBase<Derived>::EmbeddedChildAt(size_t aChildIdx) {
template <class Derived>
Accessible* ProxyAccessibleBase<Derived>::OuterDocOfRemoteBrowser() const {
auto tab = static_cast<dom::TabParent*>(mDoc->Manager());
auto tab = static_cast<dom::BrowserParent*>(mDoc->Manager());
dom::Element* frame = tab->GetOwnerElement();
NS_ASSERTION(frame, "why isn't the tab in a frame!");
if (!frame) return nullptr;

View File

@ -9,7 +9,7 @@
#include "DocAccessible.h"
#include "mozilla/a11y/DocManager.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/Unused.h"
#include "mozilla/a11y/Platform.h"
#include "RelationType.h"

View File

@ -13,7 +13,7 @@
#include "DocAccessible.h"
#include "mozilla/a11y/DocManager.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/Unused.h"
#include "mozilla/a11y/Platform.h"
#include "RelationType.h"

View File

@ -35,7 +35,7 @@
#include "nsIScrollableFrame.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/NodeInfo.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "nsIServiceManager.h"
#include "nsNameSpaceManager.h"
#include "nsTextFormatter.h"
@ -1310,7 +1310,7 @@ static already_AddRefed<IDispatch> GetProxiedAccessibleInSubtree(
if (aDoc->IsTopLevel()) {
wrapper->GetNativeInterface(getter_AddRefs(comProxy));
} else {
auto tab = static_cast<dom::TabParent*>(aDoc->Manager());
auto tab = static_cast<dom::BrowserParent*>(aDoc->Manager());
MOZ_ASSERT(tab);
DocAccessibleParent* topLevelDoc = tab->GetTopLevelDocAccessible();
MOZ_ASSERT(topLevelDoc && topLevelDoc->IsTopLevel());

View File

@ -6,7 +6,7 @@
#include "mozilla/dom/ParentSHistory.h"
#include "mozilla/dom/ParentSHistoryBinding.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "nsDocShell.h"
#include "nsFrameLoader.h"
#include "nsXULAppAPI.h"
@ -25,8 +25,8 @@ nsDocShell* ParentSHistory::GetDocShell() {
return nsDocShell::Cast(mFrameLoader->GetExistingDocShell());
}
TabParent* ParentSHistory::GetTabParent() {
return static_cast<TabParent*>(mFrameLoader->GetRemoteBrowser());
BrowserParent* ParentSHistory::GetBrowserParent() {
return static_cast<BrowserParent*>(mFrameLoader->GetRemoteBrowser());
}
already_AddRefed<ChildSHistory> ParentSHistory::GetChildIfSameProcess() {

View File

@ -29,7 +29,7 @@ class nsDocShell;
namespace mozilla {
namespace dom {
class TabParent;
class BrowserParent;
class ChildSHistory;
class ParentSHistory : public nsISupports, public nsWrapperCache {
@ -50,7 +50,7 @@ class ParentSHistory : public nsISupports, public nsWrapperCache {
private:
nsDocShell* GetDocShell();
TabParent* GetTabParent();
BrowserParent* GetBrowserParent();
already_AddRefed<ChildSHistory> GetChildIfSameProcess();

View File

@ -989,7 +989,7 @@ nsresult TextInputProcessor::PrepareKeyboardEventToDispatch(
// When this emulates real input only in content process, we need to
// initialize edit commands with the main process's widget via PuppetWidget
// because they are initialized by TabParent before content process treats
// because they are initialized by BrowserParent before content process treats
// them.
if (aKeyboardEvent.mIsSynthesizedByTIP && !XRE_IsParentProcess()) {
// Note that retrieving edit commands from content process is expensive.

View File

@ -48,7 +48,7 @@
#include "mozilla/dom/DataTransfer.h"
#include "nsIMIMEInfo.h"
#include "nsRange.h"
#include "TabParent.h"
#include "BrowserParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLAreaElement.h"
#include "mozilla/dom/HTMLAnchorElement.h"
@ -552,10 +552,10 @@ nsresult DragDataProducer::Produce(DataTransfer* aDataTransfer, bool* aCanDrag,
if (flo) {
RefPtr<nsFrameLoader> fl = flo->GetFrameLoader();
if (fl) {
TabParent* tp = static_cast<TabParent*>(fl->GetRemoteBrowser());
BrowserParent* tp = static_cast<BrowserParent*>(fl->GetRemoteBrowser());
if (tp) {
// We have a TabParent, so it may have data for dnd in case the child
// process started a dnd session.
// We have a BrowserParent, so it may have data for dnd in case the
// child process started a dnd session.
tp->AddInitialDnDDataTo(aDataTransfer, aPrincipal);
}
}

View File

@ -17,7 +17,7 @@
#include "mozilla/dom/PContentPermissionRequestParent.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/Attributes.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/Preferences.h"

View File

@ -74,7 +74,7 @@
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/BrowserBridgeChild.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/Text.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/dom/ShadowRoot.h"
@ -7248,7 +7248,7 @@ bool nsContentUtils::CallOnAllRemoteChildren(
mozilla::dom::ipc::MessageManagerCallback* cb = childMM->GetCallback();
if (cb) {
nsFrameLoader* fl = static_cast<nsFrameLoader*>(cb);
TabParent* remote = TabParent::GetFrom(fl);
BrowserParent* remote = BrowserParent::GetFrom(fl);
if (remote && aCallback) {
if (aCallback(remote, aArg)) {
return true;
@ -7282,7 +7282,7 @@ struct UIStateChangeInfo {
mShowFocusRings(aShowFocusRings) {}
};
bool SetKeyboardIndicatorsChild(TabParent* aParent, void* aArg) {
bool SetKeyboardIndicatorsChild(BrowserParent* aParent, void* aArg) {
UIStateChangeInfo* stateInfo = static_cast<UIStateChangeInfo*>(aArg);
Unused << aParent->SendSetKeyboardIndicators(stateInfo->mShowAccelerators,
stateInfo->mShowFocusRings);

View File

@ -149,7 +149,7 @@ class ContentChild;
class ContentParent;
class TabChild;
class Selection;
class TabParent;
class BrowserParent;
} // namespace dom
namespace ipc {
@ -202,8 +202,8 @@ struct EventNameMapping {
bool mMaybeSpecialSVGorSMILEvent;
};
typedef bool (*CallOnRemoteChildFunction)(mozilla::dom::TabParent* aTabParent,
void* aArg);
typedef bool (*CallOnRemoteChildFunction)(
mozilla::dom::BrowserParent* aBrowserParent, void* aArg);
class nsContentUtils {
friend class nsAutoScriptBlockerSuppressNodeRemoved;
@ -2805,8 +2805,8 @@ class nsContentUtils {
/*
* Call nsPIDOMWindow::SetKeyboardIndicators all all remote children. This is
* in here rather than nsGlobalWindow because TabParent indirectly includes
* Windows headers which aren't allowed there.
* in here rather than nsGlobalWindow because BrowserParent indirectly
* includes Windows headers which aren't allowed there.
*/
static void SetKeyboardIndicatorsOnRemoteChildren(
nsPIDOMWindowOuter* aWindow, UIStateChangeType aShowAccelerators,

View File

@ -4,7 +4,7 @@
* 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 "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "nsFocusManager.h"
@ -1089,7 +1089,7 @@ void nsFocusManager::EnsureCurrentWidgetFocused() {
}
}
bool ActivateOrDeactivateChild(TabParent* aParent, void* aArg) {
bool ActivateOrDeactivateChild(BrowserParent* aParent, void* aArg) {
bool active = static_cast<bool>(aArg);
Unused << aParent->SendParentActivated(active);
return false;
@ -1637,7 +1637,7 @@ bool nsFocusManager::Blur(nsPIDOMWindowOuter* aWindowToClear,
// if the object being blurred is a remote browser, deactivate remote
// content
if (TabParent* remote = TabParent::GetFrom(element)) {
if (BrowserParent* remote = BrowserParent::GetFrom(element)) {
remote->Deactivate();
LOGFOCUS(("Remote browser deactivated %p", remote));
}
@ -1862,7 +1862,7 @@ void nsFocusManager::Focus(nsPIDOMWindowOuter* aWindow, Element* aElement,
// if the object being focused is a remote browser, activate remote
// content
if (TabParent* remote = TabParent::GetFrom(aElement)) {
if (BrowserParent* remote = BrowserParent::GetFrom(aElement)) {
remote->Activate();
LOGFOCUS(("Remote browser activated %p", remote));
}
@ -3492,7 +3492,7 @@ nsresult nsFocusManager::GetNextTabbableContent(
// code to have the caller return early. If the child ends up not
// being focusable in some way, the child process will call back
// into document navigation again by calling MoveFocus.
TabParent* remote = TabParent::GetFrom(currentContent);
BrowserParent* remote = BrowserParent::GetFrom(currentContent);
if (remote) {
remote->NavigateByKey(aForward, aForDocumentNavigation);
return NS_SUCCESS_DOM_NO_OPERATION;

View File

@ -31,7 +31,7 @@ class PresShell;
namespace dom {
class Element;
struct FocusOptions;
class TabParent;
class BrowserParent;
} // namespace dom
} // namespace mozilla

View File

@ -71,7 +71,7 @@
#include "ClientLayerManager.h"
#include "ContentParent.h"
#include "TabParent.h"
#include "BrowserParent.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/GuardObjects.h"
@ -554,7 +554,7 @@ nsresult nsFrameLoader::ReallyStartLoadingInternal() {
if (mBrowserBridgeChild) {
Unused << mBrowserBridgeChild->SendResumeLoad(mPendingSwitchID);
} else {
mRemoteBrowser->ResumeLoad(mPendingSwitchID);
mBrowserParent->ResumeLoad(mPendingSwitchID);
}
mPendingSwitchID = 0;
@ -1291,8 +1291,8 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
}
#endif // XP_WIN
MaybeUpdatePrimaryTabParent(eTabParentRemoved);
aOther->MaybeUpdatePrimaryTabParent(eTabParentRemoved);
MaybeUpdatePrimaryBrowserParent(eBrowserParentRemoved);
aOther->MaybeUpdatePrimaryBrowserParent(eBrowserParentRemoved);
SetOwnerContent(otherContent);
aOther->SetOwnerContent(ourContent);
@ -1306,8 +1306,8 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
Unused << aOther->mBrowserParent->SendParentActivated(
ParentWindowIsActive(ourContent->OwnerDoc()));
MaybeUpdatePrimaryTabParent(eTabParentChanged);
aOther->MaybeUpdatePrimaryTabParent(eTabParentChanged);
MaybeUpdatePrimaryBrowserParent(eBrowserParentChanged);
aOther->MaybeUpdatePrimaryBrowserParent(eBrowserParentChanged);
RefPtr<nsFrameMessageManager> ourMessageManager = mMessageManager;
RefPtr<nsFrameMessageManager> otherMessageManager = aOther->mMessageManager;
@ -1813,8 +1813,8 @@ void nsFrameLoader::StartDestroy() {
}
}
// If the TabParent has installed any event listeners on the window, this is
// its last chance to remove them while we're still in the document.
// If the BrowserParent has installed any event listeners on the window, this
// is its last chance to remove them while we're still in the document.
if (mBrowserParent) {
mBrowserParent->RemoveWindowListeners();
}
@ -1825,7 +1825,7 @@ void nsFrameLoader::StartDestroy() {
doc = mOwnerContent->OwnerDoc();
dynamicSubframeRemoval = !mIsTopLevelContent && !doc->InUnlinkOrDeletion();
doc->SetSubDocumentFor(mOwnerContent, nullptr);
MaybeUpdatePrimaryTabParent(eTabParentRemoved);
MaybeUpdatePrimaryBrowserParent(eBrowserParentRemoved);
SetOwnerContent(nullptr);
}
@ -1869,7 +1869,7 @@ nsresult nsFrameLoaderDestroyRunnable::Run() {
case eDestroyDocShell:
mFrameLoader->DestroyDocShell();
// In the out-of-process case, TabParent will eventually call
// In the out-of-process case, BrowserParent will eventually call
// DestroyComplete once it receives a __delete__ message from the child.
// In the in-process case, we dispatch a series of runnables to ensure
// that DestroyComplete gets called at the right time. The frame loader is
@ -1959,7 +1959,7 @@ void nsFrameLoader::DestroyComplete() {
}
}
// Call TabParent::Destroy if we haven't already (in case of a crash).
// Call BrowserParent::Destroy if we haven't already (in case of a crash).
if (mBrowserParent) {
mBrowserParent->SetOwnerElement(nullptr);
mBrowserParent->Destroy();
@ -2565,8 +2565,9 @@ uint32_t nsFrameLoader::LazyHeight() const {
return lazyHeight;
}
static Tuple<ContentParent*, TabParent*> GetContentParent(Element* aBrowser) {
using ReturnTuple = Tuple<ContentParent*, TabParent*>;
static Tuple<ContentParent*, BrowserParent*> GetContentParent(
Element* aBrowser) {
using ReturnTuple = Tuple<ContentParent*, BrowserParent*>;
nsCOMPtr<nsIBrowser> browser = aBrowser ? aBrowser->AsBrowser() : nullptr;
if (!browser) {
@ -2579,9 +2580,9 @@ static Tuple<ContentParent*, TabParent*> GetContentParent(Element* aBrowser) {
return ReturnTuple(nullptr, nullptr);
}
TabParent* tabParent = TabParent::GetFrom(otherLoader);
if (tabParent && tabParent->Manager()) {
return MakeTuple(tabParent->Manager(), tabParent);
BrowserParent* browserParent = BrowserParent::GetFrom(otherLoader);
if (browserParent && browserParent->Manager()) {
return MakeTuple(browserParent->Manager(), browserParent);
}
return ReturnTuple(nullptr, nullptr);
@ -2621,9 +2622,10 @@ bool nsFrameLoader::TryRemoteBrowser() {
return false;
}
TabParent* openingTab = TabParent::GetFrom(parentDocShell->GetOpener());
BrowserParent* openingTab =
BrowserParent::GetFrom(parentDocShell->GetOpener());
RefPtr<ContentParent> openerContentParent;
RefPtr<TabParent> sameTabGroupAs;
RefPtr<BrowserParent> sameTabGroupAs;
if (openingTab && openingTab->Manager()) {
openerContentParent = openingTab->Manager();
@ -2690,11 +2692,11 @@ bool nsFrameLoader::TryRemoteBrowser() {
uint64_t nextRemoteTabId = 0;
if (mOwnerContent) {
nsAutoString nextTabParentIdAttr;
nsAutoString nextBrowserParentIdAttr;
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::nextRemoteTabId,
nextTabParentIdAttr);
nextRemoteTabId =
strtoull(NS_ConvertUTF16toUTF8(nextTabParentIdAttr).get(), nullptr, 10);
nextBrowserParentIdAttr);
nextRemoteTabId = strtoull(
NS_ConvertUTF16toUTF8(nextBrowserParentIdAttr).get(), nullptr, 10);
// We may be in a window that was just opened, so try the
// nsIBrowserDOMWindow API as a backup.
@ -2729,7 +2731,7 @@ bool nsFrameLoader::TryRemoteBrowser() {
// Now that mBrowserParent is set, we can initialize the RenderFrame
mBrowserParent->InitRendering();
MaybeUpdatePrimaryTabParent(eTabParentChanged);
MaybeUpdatePrimaryBrowserParent(eBrowserParentChanged);
mChildID = mBrowserParent->Manager()->ChildID();
@ -2872,9 +2874,10 @@ nsresult nsFrameLoader::CreateStaticClone(nsFrameLoader* aDest) {
bool nsFrameLoader::DoLoadMessageManagerScript(const nsAString& aURL,
bool aRunInGlobalScope) {
auto* tabParent = TabParent::GetFrom(GetRemoteBrowser());
if (tabParent) {
return tabParent->SendLoadRemoteScript(nsString(aURL), aRunInGlobalScope);
auto* browserParent = BrowserParent::GetFrom(GetRemoteBrowser());
if (browserParent) {
return browserParent->SendLoadRemoteScript(nsString(aURL),
aRunInGlobalScope);
}
RefPtr<InProcessTabChildMessageManager> tabChild =
GetTabChildMessageManager();
@ -2916,10 +2919,10 @@ nsresult nsFrameLoader::DoSendAsyncMessage(JSContext* aCx,
StructuredCloneData& aData,
JS::Handle<JSObject*> aCpows,
nsIPrincipal* aPrincipal) {
TabParent* tabParent = mBrowserParent;
if (tabParent) {
BrowserParent* browserParent = mBrowserParent;
if (browserParent) {
ClonedMessageData data;
ContentParent* cp = tabParent->Manager();
ContentParent* cp = browserParent->Manager();
if (!BuildClonedMessageDataForParent(cp, aData, data)) {
MOZ_CRASH();
return NS_ERROR_DOM_DATA_CLONE_ERR;
@ -2929,8 +2932,8 @@ nsresult nsFrameLoader::DoSendAsyncMessage(JSContext* aCx,
if (aCpows && (!mgr || !mgr->Wrap(aCx, aCpows, &cpows))) {
return NS_ERROR_UNEXPECTED;
}
if (tabParent->SendAsyncMessage(nsString(aMessage), cpows,
IPC::Principal(aPrincipal), data)) {
if (browserParent->SendAsyncMessage(nsString(aMessage), cpows,
IPC::Principal(aPrincipal), data)) {
return NS_OK;
} else {
return NS_ERROR_UNEXPECTED;
@ -3029,12 +3032,12 @@ already_AddRefed<Element> nsFrameLoader::GetOwnerElement() {
return do_AddRef(mOwnerContent);
}
void nsFrameLoader::SetRemoteBrowser(nsIRemoteTab* aTabParent) {
void nsFrameLoader::SetRemoteBrowser(nsIRemoteTab* aBrowserParent) {
MOZ_ASSERT(!mBrowserParent);
mIsRemoteFrame = true;
mBrowserParent = TabParent::GetFrom(aTabParent);
mBrowserParent = BrowserParent::GetFrom(aBrowserParent);
mChildID = mBrowserParent ? mBrowserParent->Manager()->ChildID() : 0;
MaybeUpdatePrimaryTabParent(eTabParentChanged);
MaybeUpdatePrimaryBrowserParent(eBrowserParentChanged);
ReallyLoadFrameScripts();
InitializeBrowserAPI();
mBrowserParent->InitRendering();
@ -3096,7 +3099,7 @@ void nsFrameLoader::AttributeChanged(mozilla::dom::Element* aElement,
// if our parent is chrome, since in all other cases we're random content
// subframes and the treeowner shouldn't worry about us.
if (!GetDocShell()) {
MaybeUpdatePrimaryTabParent(eTabParentChanged);
MaybeUpdatePrimaryBrowserParent(eBrowserParentChanged);
return;
}
@ -3140,15 +3143,15 @@ void nsFrameLoader::AttributeChanged(mozilla::dom::Element* aElement,
* Send the RequestNotifyAfterRemotePaint message to the current Tab.
*/
void nsFrameLoader::RequestNotifyAfterRemotePaint() {
// If remote browsing (e10s), handle this with the TabParent.
// If remote browsing (e10s), handle this with the BrowserParent.
if (mBrowserParent) {
Unused << mBrowserParent->SendRequestNotifyAfterRemotePaint();
}
}
void nsFrameLoader::RequestUpdatePosition(ErrorResult& aRv) {
if (auto* tabParent = TabParent::GetFrom(GetRemoteBrowser())) {
nsresult rv = tabParent->UpdatePosition();
if (auto* browserParent = BrowserParent::GetFrom(GetRemoteBrowser())) {
nsresult rv = browserParent->UpdatePosition();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
@ -3339,7 +3342,8 @@ void nsFrameLoader::StartPersistence(
}
}
void nsFrameLoader::MaybeUpdatePrimaryTabParent(TabParentChange aChange) {
void nsFrameLoader::MaybeUpdatePrimaryBrowserParent(
BrowserParentChange aChange) {
if (mBrowserParent && mOwnerContent) {
nsCOMPtr<nsIDocShell> docShell = mOwnerContent->OwnerDoc()->GetDocShell();
if (!docShell) {
@ -3363,7 +3367,7 @@ void nsFrameLoader::MaybeUpdatePrimaryTabParent(TabParentChange aChange) {
}
parentTreeOwner->RemoteTabRemoved(mBrowserParent);
if (aChange == eTabParentChanged) {
if (aChange == eBrowserParentChanged) {
bool isPrimary = mOwnerContent->AttrValueIs(
kNameSpaceID_None, nsGkAtoms::primary, nsGkAtoms::_true, eIgnoreCase);
parentTreeOwner->RemoteTabAdded(mBrowserParent, isPrimary);

View File

@ -57,7 +57,7 @@ class MessageSender;
class PBrowserParent;
class ProcessMessageManager;
class Promise;
class TabParent;
class BrowserParent;
class MutableTabContext;
class BrowserBridgeChild;
class RemoteFrameChild;
@ -93,7 +93,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
friend class AutoResetInFrameSwap;
typedef mozilla::dom::PBrowserParent PBrowserParent;
typedef mozilla::dom::Document Document;
typedef mozilla::dom::TabParent TabParent;
typedef mozilla::dom::BrowserParent BrowserParent;
typedef mozilla::layout::RenderFrame RenderFrame;
public:
@ -333,7 +333,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
* this object, which means you can't have called ShowRemoteFrame()
* or ReallyStartLoading().
*/
void SetRemoteBrowser(nsIRemoteTab* aTabParent);
void SetRemoteBrowser(nsIRemoteTab* aBrowserParent);
/**
* Stashes a detached nsIFrame on the frame loader. We do this when we're
@ -449,8 +449,8 @@ class nsFrameLoader final : public nsStubMutationObserver,
nsresult GetNewTabContext(mozilla::dom::MutableTabContext* aTabContext,
nsIURI* aURI = nullptr);
enum TabParentChange { eTabParentRemoved, eTabParentChanged };
void MaybeUpdatePrimaryTabParent(TabParentChange aChange);
enum BrowserParentChange { eBrowserParentRemoved, eBrowserParentChanged };
void MaybeUpdatePrimaryBrowserParent(BrowserParentChange aChange);
nsresult PopulateUserContextIdFromAttribute(mozilla::OriginAttributes& aAttr);
@ -480,7 +480,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
// target process.
uint64_t mPendingSwitchID;
RefPtr<TabParent> mBrowserParent;
RefPtr<BrowserParent> mBrowserParent;
uint64_t mChildID;
// This is used when this refers to a remote sub frame

View File

@ -17,7 +17,7 @@ class nsINode;
namespace mozilla {
namespace dom {
class TabParent;
class BrowserParent;
} // namespace dom
} // namespace mozilla
@ -61,10 +61,11 @@ class nsPIWindowRoot : public mozilla::dom::EventTarget {
virtual mozilla::dom::EventTarget* GetParentTarget() = 0;
// Stores a weak reference to the browser.
virtual void AddBrowser(mozilla::dom::TabParent* aBrowser) = 0;
virtual void RemoveBrowser(mozilla::dom::TabParent* aBrowser) = 0;
virtual void AddBrowser(mozilla::dom::BrowserParent* aBrowser) = 0;
virtual void RemoveBrowser(mozilla::dom::BrowserParent* aBrowser) = 0;
typedef void (*BrowserEnumerator)(mozilla::dom::TabParent* aTab, void* aArg);
typedef void (*BrowserEnumerator)(mozilla::dom::BrowserParent* aTab,
void* aArg);
// Enumerate all stored browsers that for which the weak reference is valid.
virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc, void* aArg) = 0;

View File

@ -22,7 +22,7 @@
#include "nsIController.h"
#include "xpcpublic.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/HTMLInputElement.h"
#include "mozilla/dom/JSWindowActorService.h"
@ -300,13 +300,13 @@ JSObject* nsWindowRoot::WrapObject(JSContext* aCx,
return mozilla::dom::WindowRoot_Binding::Wrap(aCx, this, aGivenProto);
}
void nsWindowRoot::AddBrowser(mozilla::dom::TabParent* aBrowser) {
void nsWindowRoot::AddBrowser(mozilla::dom::BrowserParent* aBrowser) {
nsWeakPtr weakBrowser =
do_GetWeakReference(static_cast<nsIRemoteTab*>(aBrowser));
mWeakBrowsers.PutEntry(weakBrowser);
}
void nsWindowRoot::RemoveBrowser(mozilla::dom::TabParent* aBrowser) {
void nsWindowRoot::RemoveBrowser(mozilla::dom::BrowserParent* aBrowser) {
nsWeakPtr weakBrowser =
do_GetWeakReference(static_cast<nsIRemoteTab*>(aBrowser));
mWeakBrowsers.RemoveEntry(weakBrowser);
@ -315,16 +315,17 @@ void nsWindowRoot::RemoveBrowser(mozilla::dom::TabParent* aBrowser) {
void nsWindowRoot::EnumerateBrowsers(BrowserEnumerator aEnumFunc, void* aArg) {
// Collect strong references to all browsers in a separate array in
// case aEnumFunc alters mWeakBrowsers.
nsTArray<RefPtr<TabParent>> tabParents;
nsTArray<RefPtr<BrowserParent>> browserParents;
for (auto iter = mWeakBrowsers.ConstIter(); !iter.Done(); iter.Next()) {
nsCOMPtr<nsIRemoteTab> tabParent(do_QueryReferent(iter.Get()->GetKey()));
if (TabParent* tab = TabParent::GetFrom(tabParent)) {
tabParents.AppendElement(tab);
nsCOMPtr<nsIRemoteTab> browserParent(
do_QueryReferent(iter.Get()->GetKey()));
if (BrowserParent* tab = BrowserParent::GetFrom(browserParent)) {
browserParents.AppendElement(tab);
}
}
for (uint32_t i = 0; i < tabParents.Length(); ++i) {
aEnumFunc(tabParents[i], aArg);
for (uint32_t i = 0; i < browserParents.Length(); ++i) {
aEnumFunc(browserParents[i], aArg);
}
}

View File

@ -70,8 +70,8 @@ class nsWindowRoot final : public nsPIWindowRoot {
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsWindowRoot)
virtual void AddBrowser(mozilla::dom::TabParent* aBrowser) override;
virtual void RemoveBrowser(mozilla::dom::TabParent* aBrowser) override;
virtual void AddBrowser(mozilla::dom::BrowserParent* aBrowser) override;
virtual void RemoveBrowser(mozilla::dom::BrowserParent* aBrowser) override;
virtual void EnumerateBrowsers(BrowserEnumerator aEnumFunc,
void* aArg) override;
@ -109,7 +109,8 @@ class nsWindowRoot final : public nsPIWindowRoot {
nsCOMPtr<mozilla::dom::EventTarget> mParent;
// The TabParents that are currently registered with this top-level window.
// The BrowserParents that are currently registered with this top-level
// window.
typedef nsTHashtable<nsRefPtrHashKey<nsIWeakReference>> WeakBrowserTable;
WeakBrowserTable mWeakBrowsers;
};

View File

@ -4,9 +4,9 @@
* 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 "TabParent.h"
#include "BrowserParent.h"
// TabParent.h transitively includes <windows.h>, which does
// BrowserParent.h transitively includes <windows.h>, which does
// #define CreateEvent CreateEventW
// That messes up our call to EventDispatcher::CreateEvent below.
@ -172,10 +172,11 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
/*static*/
BrowserElementParent::OpenWindowResult BrowserElementParent::OpenWindowOOP(
TabParent* aOpenerTabParent, TabParent* aPopupTabParent,
BrowserParent* aOpenerBrowserParent, BrowserParent* aPopupBrowserParent,
const nsAString& aURL, const nsAString& aName, const nsAString& aFeatures) {
// Create an iframe owned by the same document which owns openerFrameElement.
nsCOMPtr<Element> openerFrameElement = aOpenerTabParent->GetOwnerElement();
nsCOMPtr<Element> openerFrameElement =
aOpenerBrowserParent->GetOwnerElement();
NS_ENSURE_TRUE(openerFrameElement, BrowserElementParent::OPEN_WINDOW_IGNORED);
RefPtr<HTMLIFrameElement> popupFrameElement =
CreateIframe(openerFrameElement, aName, /* aRemote = */ true);
@ -201,9 +202,9 @@ BrowserElementParent::OpenWindowResult BrowserElementParent::OpenWindowOOP(
// The popup was not blocked, so hook up the frame element and the popup tab
// parent, and return success.
aPopupTabParent->SetOwnerElement(popupFrameElement);
aPopupBrowserParent->SetOwnerElement(popupFrameElement);
popupFrameElement->AllowCreateFrameLoader();
popupFrameElement->CreateRemoteFrameLoader(aPopupTabParent);
popupFrameElement->CreateRemoteFrameLoader(aPopupBrowserParent);
return opened;
}

View File

@ -20,7 +20,7 @@ namespace mozilla {
namespace dom {
class BrowsingContext;
class TabParent;
class BrowserParent;
} // namespace dom
/**
@ -74,23 +74,23 @@ class BrowserElementParent {
* iframe element) into the DOM somewhere.
*
* 3) If the embedder accepted the window.open request, we return true and
* set aPopupTabParent's frame element to event.detail.frameElement.
* set aPopupBrowserParent's frame element to event.detail.frameElement.
* Otherwise, we return false.
*
* @param aURL the URL the new window should load. The empty string is
* allowed.
* @param aOpenerTabParent the TabParent whose TabChild called window.open.
* @param aPopupTabParent the TabParent inside which the opened window will
* live.
* @param aOpenerBrowserParent the BrowserParent whose TabChild called
* window.open.
* @param aPopupBrowserParent the BrowserParent inside which the opened window
* will live.
* @return an OpenWindowresult that describes whether the embedder added the
* frame to a document and whether it called preventDefault to prevent
* the platform from handling the open request.
*/
static OpenWindowResult OpenWindowOOP(dom::TabParent* aOpenerTabParent,
dom::TabParent* aPopupTabParent,
const nsAString& aURL,
const nsAString& aName,
const nsAString& aFeatures);
static OpenWindowResult OpenWindowOOP(
dom::BrowserParent* aOpenerBrowserParent,
dom::BrowserParent* aPopupBrowserParent, const nsAString& aURL,
const nsAString& aName, const nsAString& aFeatures);
/**
* Handle a window.open call from an in-process <iframe mozbrowser>.

View File

@ -25,7 +25,7 @@
#include "mozilla/dom/FrameLoaderBinding.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/UIEvent.h"
#include "mozilla/dom/UIEventBinding.h"
#include "mozilla/dom/WheelEventBinding.h"
@ -661,7 +661,7 @@ nsresult EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
// preceding eKeyDown event is consumed. If preceding eKeyDown event
// is consumed in the remote process, TabChild won't send the event
// back to this process. So, only when this process receives a reply
// eKeyPress event in TabParent, we should handle accesskey in this
// eKeyPress event in BrowserParent, we should handle accesskey in this
// process.
if (IsRemoteTarget(GetFocusedContent())) {
// However, if there is no accesskey target for the key combination,
@ -1091,12 +1091,13 @@ struct MOZ_STACK_CLASS AccessKeyInfo {
: event(aEvent), charCodes(aCharCodes) {}
};
static bool HandleAccessKeyInRemoteChild(TabParent* aTabParent, void* aArg) {
static bool HandleAccessKeyInRemoteChild(BrowserParent* aBrowserParent,
void* aArg) {
AccessKeyInfo* accessKeyInfo = static_cast<AccessKeyInfo*>(aArg);
// Only forward accesskeys for the active tab.
bool active;
aTabParent->GetDocShellIsActive(&active);
aBrowserParent->GetDocShellIsActive(&active);
if (active) {
// Even if there is no target for the accesskey in this process,
// the event may match with a content accesskey. If so, the keyboard
@ -1105,8 +1106,8 @@ static bool HandleAccessKeyInRemoteChild(TabParent* aTabParent, void* aArg) {
// "File" menu.)
accessKeyInfo->event->StopPropagation();
accessKeyInfo->event->MarkAsWaitingReplyFromRemoteProcess();
aTabParent->HandleAccessKey(*accessKeyInfo->event,
accessKeyInfo->charCodes);
aBrowserParent->HandleAccessKey(*accessKeyInfo->event,
accessKeyInfo->charCodes);
return true;
}
@ -1205,10 +1206,10 @@ bool EventStateManager::WalkESMTreeToHandleAccessKey(
if (aExecute &&
aEvent->ModifiersMatchWithAccessKey(AccessKeyType::eContent) &&
mDocument && mDocument->GetWindow()) {
// If the focus is currently on a node with a TabParent, the key event
// If the focus is currently on a node with a BrowserParent, the key event
// should've gotten forwarded to the child process and HandleAccessKey
// called from there.
if (TabParent::GetFrom(GetFocusedContent())) {
if (BrowserParent::GetFrom(GetFocusedContent())) {
// If access key may be only in remote contents, this method won't handle
// access key synchronously. In this case, only reply event should reach
// here.
@ -1233,23 +1234,24 @@ bool EventStateManager::WalkESMTreeToHandleAccessKey(
void EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
nsFrameLoader* aFrameLoader,
nsEventStatus* aStatus) {
TabParent* remote = TabParent::GetFrom(aFrameLoader);
BrowserParent* remote = BrowserParent::GetFrom(aFrameLoader);
if (!remote) {
return;
}
if (aEvent->mLayersId.IsValid()) {
TabParent* preciseRemote =
TabParent::GetTabParentFromLayersId(aEvent->mLayersId);
BrowserParent* preciseRemote =
BrowserParent::GetBrowserParentFromLayersId(aEvent->mLayersId);
if (preciseRemote) {
remote = preciseRemote;
}
// else there is a race between APZ and the LayersId to TabParent mapping,
// so fall back to delivering the event to the topmost child process.
// else there is a race between APZ and the LayersId to BrowserParent
// mapping, so fall back to delivering the event to the topmost child
// process.
} else if (aEvent->mClass == eKeyboardEventClass) {
// APZ attaches a LayersId to hit-testable events, for keyboard events,
// we use focus.
TabParent* preciseRemote = TabParent::GetFocused();
BrowserParent* preciseRemote = BrowserParent::GetFocused();
if (preciseRemote) {
remote = preciseRemote;
}
@ -1278,8 +1280,8 @@ void EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
return;
}
case eDragEventClass: {
RefPtr<TabParent> tabParent = remote;
tabParent->Manager()->MaybeInvokeDragSession(tabParent);
RefPtr<BrowserParent> browserParent = remote;
browserParent->Manager()->MaybeInvokeDragSession(browserParent);
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
uint32_t dropEffect = nsIDragService::DRAGDROP_ACTION_NONE;
@ -1296,8 +1298,8 @@ void EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
}
}
tabParent->SendRealDragEvent(*aEvent->AsDragEvent(), action, dropEffect,
IPC::Principal(principal));
browserParent->SendRealDragEvent(*aEvent->AsDragEvent(), action,
dropEffect, IPC::Principal(principal));
return;
}
case ePluginEventClass: {
@ -1312,7 +1314,7 @@ void EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
}
bool EventStateManager::IsRemoteTarget(nsIContent* target) {
return !!TabParent::GetFrom(target);
return !!BrowserParent::GetFrom(target);
}
bool EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
@ -2887,8 +2889,8 @@ void EventStateManager::PostHandleKeyboardEvent(
if (!aKeyboardEvent->HasBeenPostedToRemoteProcess()) {
if (aKeyboardEvent->IsWaitingReplyFromRemoteProcess()) {
RefPtr<TabParent> remote =
aTargetFrame ? TabParent::GetFrom(aTargetFrame->GetContent())
RefPtr<BrowserParent> remote =
aTargetFrame ? BrowserParent::GetFrom(aTargetFrame->GetContent())
: nullptr;
if (remote) {
// remote is null-checked above in order to let pre-existing event
@ -2897,7 +2899,7 @@ void EventStateManager::PostHandleKeyboardEvent(
// there are still bugs in the Fission-mode code. That is, if remote
// is nullptr, the pre-existing event targeting code has deemed this
// event to belong to chrome rather than content.
TabParent* preciseRemote = TabParent::GetFocused();
BrowserParent* preciseRemote = BrowserParent::GetFocused();
if (preciseRemote) {
remote = preciseRemote;
}
@ -3619,8 +3621,8 @@ nsresult EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
return ret;
}
TabParent* EventStateManager::GetCrossProcessTarget() {
return IMEStateManager::GetActiveTabParent();
BrowserParent* EventStateManager::GetCrossProcessTarget() {
return IMEStateManager::GetActiveBrowserParent();
}
bool EventStateManager::IsTargetCrossProcess(WidgetGUIEvent* aEvent) {
@ -3628,7 +3630,7 @@ bool EventStateManager::IsTargetCrossProcess(WidgetGUIEvent* aEvent) {
// in that case, do not forward IME events to content
nsIContent* focusedContent = GetFocusedContent();
if (focusedContent && focusedContent->IsEditable()) return false;
return IMEStateManager::GetActiveTabParent() != nullptr;
return IMEStateManager::GetActiveBrowserParent() != nullptr;
}
void EventStateManager::NotifyDestroyPresContext(nsPresContext* aPresContext) {
@ -5596,7 +5598,7 @@ nsresult EventStateManager::DoContentCommandEvent(
if (canDoIt && !aEvent->mOnlyEnabledCheck) {
switch (aEvent->mMessage) {
case eContentCommandPasteTransferable: {
TabParent* remote = TabParent::GetFocused();
BrowserParent* remote = BrowserParent::GetFocused();
if (remote) {
nsCOMPtr<nsITransferable> transferable = aEvent->mTransferable;
IPCDataTransfer ipcDataTransfer;

View File

@ -45,7 +45,7 @@ class DataTransfer;
class Document;
class Element;
class Selection;
class TabParent;
class BrowserParent;
} // namespace dom
class OverOutElementsWrapper final : public nsISupports {
@ -1050,7 +1050,7 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
LayoutDeviceIntPoint GetEventRefPoint(WidgetEvent* aEvent) const;
friend class mozilla::dom::TabParent;
friend class mozilla::dom::BrowserParent;
void BeginTrackingRemoteDragGesture(nsIContent* aContent);
void StopTrackingDragGesture();
void GenerateDragGesture(nsPresContext* aPresContext,
@ -1112,7 +1112,7 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
nsresult DoContentCommandEvent(WidgetContentCommandEvent* aEvent);
nsresult DoContentCommandScrollEvent(WidgetContentCommandEvent* aEvent);
dom::TabParent* GetCrossProcessTarget();
dom::BrowserParent* GetCrossProcessTarget();
bool IsTargetCrossProcess(WidgetGUIEvent* aEvent);
/**

View File

@ -22,7 +22,7 @@
#include "mozilla/dom/HTMLFormElement.h"
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "HTMLInputElement.h"
#include "IMEContentObserver.h"
@ -129,7 +129,7 @@ StaticRefPtr<nsIContent> IMEStateManager::sContent;
StaticRefPtr<nsPresContext> IMEStateManager::sPresContext;
nsIWidget* IMEStateManager::sWidget = nullptr;
nsIWidget* IMEStateManager::sFocusedIMEWidget = nullptr;
StaticRefPtr<TabParent> IMEStateManager::sFocusedIMETabParent;
StaticRefPtr<BrowserParent> IMEStateManager::sFocusedIMEBrowserParent;
nsIWidget* IMEStateManager::sActiveInputContextWidget = nullptr;
StaticRefPtr<IMEContentObserver> IMEStateManager::sActiveIMEContentObserver;
TextCompositionArray* IMEStateManager::sTextCompositions = nullptr;
@ -171,8 +171,8 @@ void IMEStateManager::Shutdown() {
}
// static
void IMEStateManager::OnFocusMovedBetweenBrowsers(TabParent* aBlur,
TabParent* aFocus) {
void IMEStateManager::OnFocusMovedBetweenBrowsers(BrowserParent* aBlur,
BrowserParent* aFocus) {
MOZ_ASSERT(aBlur != aFocus);
MOZ_ASSERT(XRE_IsParentProcess());
@ -192,7 +192,7 @@ void IMEStateManager::OnFocusMovedBetweenBrowsers(TabParent* aBlur,
GetBoolName(
!oldWidget->IMENotificationRequestsRef().WantDuringDeactive())));
NotifyIME(REQUEST_TO_COMMIT_COMPOSITION, oldWidget,
composition->GetTabParent());
composition->GetBrowserParent());
}
}
@ -209,21 +209,21 @@ void IMEStateManager::OnFocusMovedBetweenBrowsers(TabParent* aBlur,
}
if (sFocusedIMEWidget) {
// sFocusedIMETabParent can be null, if IME focus hasn't been
// taken before TabParent blur.
// sFocusedIMEBrowserParent can be null, if IME focus hasn't been
// taken before BrowserParent blur.
// aBlur can be null when keyboard focus moves not actually
// between tabs but an open menu is involved.
MOZ_ASSERT(!sFocusedIMETabParent || !aBlur ||
(sFocusedIMETabParent == aBlur));
MOZ_ASSERT(!sFocusedIMEBrowserParent || !aBlur ||
(sFocusedIMEBrowserParent == aBlur));
MOZ_LOG(sISMLog, LogLevel::Debug,
(" OnFocusMovedBetweenBrowsers(), notifying IME of blur"));
NotifyIME(NOTIFY_IME_OF_BLUR, sFocusedIMEWidget, sFocusedIMETabParent);
NotifyIME(NOTIFY_IME_OF_BLUR, sFocusedIMEWidget, sFocusedIMEBrowserParent);
MOZ_ASSERT(!sFocusedIMETabParent);
MOZ_ASSERT(!sFocusedIMEBrowserParent);
MOZ_ASSERT(!sFocusedIMEWidget);
} else {
MOZ_ASSERT(!sFocusedIMETabParent);
MOZ_ASSERT(!sFocusedIMEBrowserParent);
}
// We deliberely don't null out sContent or sPresContext here. When
@ -240,9 +240,9 @@ void IMEStateManager::WidgetDestroyed(nsIWidget* aWidget) {
sWidget = nullptr;
}
if (sFocusedIMEWidget == aWidget) {
if (sFocusedIMETabParent) {
OnFocusMovedBetweenBrowsers(sFocusedIMETabParent, nullptr);
MOZ_ASSERT(!sFocusedIMETabParent);
if (sFocusedIMEBrowserParent) {
OnFocusMovedBetweenBrowsers(sFocusedIMEBrowserParent, nullptr);
MOZ_ASSERT(!sFocusedIMEBrowserParent);
}
sFocusedIMEWidget = nullptr;
}
@ -343,7 +343,7 @@ nsresult IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext) {
InputContextAction action(InputContextAction::CAUSE_UNKNOWN,
InputContextAction::LOST_FOCUS);
InputContext::Origin origin =
TabParent::GetFocused() ? InputContext::ORIGIN_CONTENT : sOrigin;
BrowserParent::GetFocused() ? InputContext::ORIGIN_CONTENT : sOrigin;
SetIMEState(newState, nullptr, nullptr, sWidget, action, origin);
}
sWidget = nullptr;
@ -398,7 +398,7 @@ nsresult IMEStateManager::OnRemoveContent(nsPresContext* aPresContext,
InputContextAction action(InputContextAction::CAUSE_UNKNOWN,
InputContextAction::LOST_FOCUS);
InputContext::Origin origin =
TabParent::GetFocused() ? InputContext::ORIGIN_CONTENT : sOrigin;
BrowserParent::GetFocused() ? InputContext::ORIGIN_CONTENT : sOrigin;
SetIMEState(newState, aPresContext, nullptr, sWidget, action, origin);
}
@ -432,21 +432,21 @@ nsresult IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
nsIContent* aContent,
InputContextAction aAction) {
bool remoteHasFocus =
TabParent::GetFrom(aContent) || BrowserBridgeChild::GetFrom(aContent);
BrowserParent::GetFrom(aContent) || BrowserBridgeChild::GetFrom(aContent);
MOZ_LOG(sISMLog, LogLevel::Info,
("OnChangeFocusInternal(aPresContext=0x%p (available: %s), "
"aContent=0x%p (remote: %s), aAction={ mCause=%s, "
"mFocusChange=%s }), "
"sPresContext=0x%p (available: %s), sContent=0x%p, "
"sWidget=0x%p (available: %s), TabParent::GetFocused()=0x%p, "
"sWidget=0x%p (available: %s), BrowserParent::GetFocused()=0x%p, "
"sActiveIMEContentObserver=0x%p, sInstalledMenuKeyboardListener=%s",
aPresContext, GetBoolName(CanHandleWith(aPresContext)), aContent,
GetBoolName(remoteHasFocus), GetActionCauseName(aAction.mCause),
GetActionFocusChangeName(aAction.mFocusChange), sPresContext.get(),
GetBoolName(CanHandleWith(sPresContext)), sContent.get(), sWidget,
GetBoolName(sWidget && !sWidget->Destroyed()),
TabParent::GetFocused(), sActiveIMEContentObserver.get(),
BrowserParent::GetFocused(), sActiveIMEContentObserver.get(),
GetBoolName(sInstalledMenuKeyboardListener)));
// If new aPresShell has been destroyed, this should handle the focus change
@ -486,7 +486,7 @@ nsresult IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
(" OnChangeFocusInternal(), requesting to commit composition to "
"the (previous) focused widget"));
NotifyIME(REQUEST_TO_COMMIT_COMPOSITION, oldWidget,
composition->GetTabParent());
composition->GetBrowserParent());
}
}
}
@ -605,7 +605,7 @@ nsresult IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
// composition here since the IME state is changing.
if (sPresContext && oldWidget && !focusActuallyChanging) {
NotifyIME(REQUEST_TO_COMMIT_COMPOSITION, oldWidget,
sFocusedIMETabParent);
sFocusedIMEBrowserParent);
}
} else if (aAction.mFocusChange == InputContextAction::FOCUS_NOT_CHANGED) {
// If aContent isn't null or aContent is null but editable, somebody gets
@ -654,12 +654,12 @@ void IMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling) {
MOZ_LOG(
sISMLog, LogLevel::Info,
("OnInstalledMenuKeyboardListener(aInstalling=%s), "
"sInstalledMenuKeyboardListener=%s, TabParent::GetFocused()=0x%p, "
"sInstalledMenuKeyboardListener=%s, BrowserParent::GetFocused()=0x%p, "
"sActiveChildInputContext={ mIMEState={ mEnabled=%s, mOpen=%s }, "
"mHTMLInputType=\"%s\", mHTMLInputInputmode=\"%s\", mActionHint=\"%s\", "
"mInPrivateBrowsing=%s }",
GetBoolName(aInstalling), GetBoolName(sInstalledMenuKeyboardListener),
TabParent::GetFocused(),
BrowserParent::GetFocused(),
GetIMEStateEnabledName(sActiveChildInputContext.mIMEState.mEnabled),
GetIMEStateSetOpenName(sActiveChildInputContext.mIMEState.mOpen),
NS_ConvertUTF16toUTF8(sActiveChildInputContext.mHTMLInputType).get(),
@ -674,7 +674,7 @@ void IMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling) {
aInstalling
? InputContextAction::MENU_GOT_PSEUDO_FOCUS
: InputContextAction::MENU_LOST_PSEUDO_FOCUS);
TabParent* focused = TabParent::GetFocused();
BrowserParent* focused = BrowserParent::GetFocused();
if (focused) {
if (aInstalling) {
OnFocusMovedBetweenBrowsers(focused, nullptr);
@ -989,7 +989,7 @@ void IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState,
if (updateIMEState) {
// commit current composition before modifying IME state.
NotifyIME(REQUEST_TO_COMMIT_COMPOSITION, widget, sFocusedIMETabParent);
NotifyIME(REQUEST_TO_COMMIT_COMPOSITION, widget, sFocusedIMEBrowserParent);
if (NS_WARN_IF(widget->Destroyed())) {
MOZ_LOG(sISMLog, LogLevel::Error,
(" UpdateIMEState(), widget has gone during committing "
@ -1115,17 +1115,17 @@ bool IMEStateManager::HasActiveChildSetInputContext() {
// static
void IMEStateManager::SetInputContextForChildProcess(
TabParent* aTabParent, const InputContext& aInputContext,
BrowserParent* aBrowserParent, const InputContext& aInputContext,
const InputContextAction& aAction) {
MOZ_LOG(
sISMLog, LogLevel::Info,
("SetInputContextForChildProcess(aTabParent=0x%p, "
("SetInputContextForChildProcess(aBrowserParent=0x%p, "
"aInputContext={ mIMEState={ mEnabled=%s, mOpen=%s }, "
"mHTMLInputType=\"%s\", mHTMLInputInputmode=\"%s\", mActionHint=\"%s\", "
"mInPrivateBrowsing=%s }, aAction={ mCause=%s, mAction=%s }), "
"sPresContext=0x%p (available: %s), sWidget=0x%p (available: %s), "
"TabParent::GetFocused()=0x%p, sInstalledMenuKeyboardListener=%s",
aTabParent, GetIMEStateEnabledName(aInputContext.mIMEState.mEnabled),
"BrowserParent::GetFocused()=0x%p, sInstalledMenuKeyboardListener=%s",
aBrowserParent, GetIMEStateEnabledName(aInputContext.mIMEState.mEnabled),
GetIMEStateSetOpenName(aInputContext.mIMEState.mOpen),
NS_ConvertUTF16toUTF8(aInputContext.mHTMLInputType).get(),
NS_ConvertUTF16toUTF8(aInputContext.mHTMLInputInputmode).get(),
@ -1134,10 +1134,11 @@ void IMEStateManager::SetInputContextForChildProcess(
GetActionCauseName(aAction.mCause),
GetActionFocusChangeName(aAction.mFocusChange), sPresContext.get(),
GetBoolName(CanHandleWith(sPresContext)), sWidget,
GetBoolName(sWidget && !sWidget->Destroyed()), TabParent::GetFocused(),
GetBoolName(sWidget && !sWidget->Destroyed()),
BrowserParent::GetFocused(),
GetBoolName(sInstalledMenuKeyboardListener)));
if (aTabParent != TabParent::GetFocused()) {
if (aBrowserParent != BrowserParent::GetFocused()) {
MOZ_LOG(sISMLog, LogLevel::Error,
(" SetInputContextForChildProcess(), FAILED, "
"because non-focused tab parent tries to set input context"));
@ -1304,15 +1305,16 @@ void IMEStateManager::SetIMEState(const IMEState& aState,
nsIContent* aContent, nsIWidget* aWidget,
InputContextAction aAction,
InputContext::Origin aOrigin) {
MOZ_LOG(sISMLog, LogLevel::Info,
("SetIMEState(aState={ mEnabled=%s, mOpen=%s }, "
"aContent=0x%p (TabParent=0x%p), aWidget=0x%p, aAction={ mCause=%s, "
"mFocusChange=%s }, aOrigin=%s)",
GetIMEStateEnabledName(aState.mEnabled),
GetIMEStateSetOpenName(aState.mOpen), aContent,
TabParent::GetFrom(aContent), aWidget,
GetActionCauseName(aAction.mCause),
GetActionFocusChangeName(aAction.mFocusChange), ToChar(aOrigin)));
MOZ_LOG(
sISMLog, LogLevel::Info,
("SetIMEState(aState={ mEnabled=%s, mOpen=%s }, "
"aContent=0x%p (BrowserParent=0x%p), aWidget=0x%p, aAction={ mCause=%s, "
"mFocusChange=%s }, aOrigin=%s)",
GetIMEStateEnabledName(aState.mEnabled),
GetIMEStateSetOpenName(aState.mOpen), aContent,
BrowserParent::GetFrom(aContent), aWidget,
GetActionCauseName(aAction.mCause),
GetActionFocusChangeName(aAction.mFocusChange), ToChar(aOrigin)));
NS_ENSURE_TRUE_VOID(aWidget);
@ -1390,21 +1392,22 @@ void IMEStateManager::SetIMEState(const IMEState& aState,
void IMEStateManager::SetInputContext(nsIWidget* aWidget,
const InputContext& aInputContext,
const InputContextAction& aAction) {
MOZ_LOG(sISMLog, LogLevel::Info,
("SetInputContext(aWidget=0x%p, aInputContext={ "
"mIMEState={ mEnabled=%s, mOpen=%s }, mHTMLInputType=\"%s\", "
"mHTMLInputInputmode=\"%s\", mActionHint=\"%s\", "
"mInPrivateBrowsing=%s }, "
"aAction={ mCause=%s, mAction=%s }), TabParent::GetFocused()=0x%p",
aWidget, GetIMEStateEnabledName(aInputContext.mIMEState.mEnabled),
GetIMEStateSetOpenName(aInputContext.mIMEState.mOpen),
NS_ConvertUTF16toUTF8(aInputContext.mHTMLInputType).get(),
NS_ConvertUTF16toUTF8(aInputContext.mHTMLInputInputmode).get(),
NS_ConvertUTF16toUTF8(aInputContext.mActionHint).get(),
GetBoolName(aInputContext.mInPrivateBrowsing),
GetActionCauseName(aAction.mCause),
GetActionFocusChangeName(aAction.mFocusChange),
TabParent::GetFocused()));
MOZ_LOG(
sISMLog, LogLevel::Info,
("SetInputContext(aWidget=0x%p, aInputContext={ "
"mIMEState={ mEnabled=%s, mOpen=%s }, mHTMLInputType=\"%s\", "
"mHTMLInputInputmode=\"%s\", mActionHint=\"%s\", "
"mInPrivateBrowsing=%s }, "
"aAction={ mCause=%s, mAction=%s }), BrowserParent::GetFocused()=0x%p",
aWidget, GetIMEStateEnabledName(aInputContext.mIMEState.mEnabled),
GetIMEStateSetOpenName(aInputContext.mIMEState.mOpen),
NS_ConvertUTF16toUTF8(aInputContext.mHTMLInputType).get(),
NS_ConvertUTF16toUTF8(aInputContext.mHTMLInputInputmode).get(),
NS_ConvertUTF16toUTF8(aInputContext.mActionHint).get(),
GetBoolName(aInputContext.mInPrivateBrowsing),
GetActionCauseName(aAction.mCause),
GetActionFocusChangeName(aAction.mFocusChange),
BrowserParent::GetFocused()));
MOZ_RELEASE_ASSERT(aWidget);
@ -1424,7 +1427,7 @@ void IMEStateManager::EnsureTextCompositionArray() {
// static
void IMEStateManager::DispatchCompositionEvent(
nsINode* aEventTargetNode, nsPresContext* aPresContext,
TabParent* aTabParent, WidgetCompositionEvent* aCompositionEvent,
BrowserParent* aBrowserParent, WidgetCompositionEvent* aCompositionEvent,
nsEventStatus* aStatus, EventDispatchingCallback* aCallBack,
bool aIsSynthesized) {
MOZ_LOG(
@ -1436,7 +1439,7 @@ void IMEStateManager::DispatchCompositionEvent(
"GetNativeIMEContext()={ mRawNativeIMEContext=0x%" PRIXPTR ", "
"mOriginProcessID=0x%" PRIX64 " }, Destroyed()=%s }, "
"mFlags={ mIsTrusted=%s, mPropagationStopped=%s } }, "
"aIsSynthesized=%s), tabParent=%p",
"aIsSynthesized=%s), browserParent=%p",
aEventTargetNode, aPresContext, ToChar(aCompositionEvent->mMessage),
aCompositionEvent->mNativeIMEContext.mRawNativeIMEContext,
aCompositionEvent->mNativeIMEContext.mOriginProcessID,
@ -1446,7 +1449,7 @@ void IMEStateManager::DispatchCompositionEvent(
GetBoolName(aCompositionEvent->mWidget->Destroyed()),
GetBoolName(aCompositionEvent->mFlags.mIsTrusted),
GetBoolName(aCompositionEvent->mFlags.mPropagationStopped),
GetBoolName(aIsSynthesized), aTabParent));
GetBoolName(aIsSynthesized), aBrowserParent));
if (!aCompositionEvent->IsTrusted() ||
aCompositionEvent->PropagationStopped()) {
@ -1471,7 +1474,7 @@ void IMEStateManager::DispatchCompositionEvent(
"adding new TextComposition to the array"));
MOZ_ASSERT(aCompositionEvent->mMessage == eCompositionStart);
composition = new TextComposition(aPresContext, aEventTargetNode,
aTabParent, aCompositionEvent);
aBrowserParent, aCompositionEvent);
sTextCompositions->AppendElement(composition);
}
#ifdef DEBUG
@ -1533,15 +1536,16 @@ void IMEStateManager::HandleSelectionEvent(
WidgetSelectionEvent* aSelectionEvent) {
nsIContent* eventTargetContent =
aEventTargetContent ? aEventTargetContent : GetRootContent(aPresContext);
RefPtr<TabParent> tabParent =
eventTargetContent ? TabParent::GetFrom(eventTargetContent) : nullptr;
RefPtr<BrowserParent> browserParent =
eventTargetContent ? BrowserParent::GetFrom(eventTargetContent) : nullptr;
MOZ_LOG(sISMLog, LogLevel::Info,
("HandleSelectionEvent(aPresContext=0x%p, "
"aEventTargetContent=0x%p, aSelectionEvent={ mMessage=%s, "
"mFlags={ mIsTrusted=%s } }), tabParent=%p",
aPresContext, aEventTargetContent, ToChar(aSelectionEvent->mMessage),
GetBoolName(aSelectionEvent->mFlags.mIsTrusted), tabParent.get()));
MOZ_LOG(
sISMLog, LogLevel::Info,
("HandleSelectionEvent(aPresContext=0x%p, "
"aEventTargetContent=0x%p, aSelectionEvent={ mMessage=%s, "
"mFlags={ mIsTrusted=%s } }), browserParent=%p",
aPresContext, aEventTargetContent, ToChar(aSelectionEvent->mMessage),
GetBoolName(aSelectionEvent->mFlags.mIsTrusted), browserParent.get()));
if (!aSelectionEvent->IsTrusted()) {
return;
@ -1557,8 +1561,8 @@ void IMEStateManager::HandleSelectionEvent(
composition->HandleSelectionEvent(aSelectionEvent);
} else {
// When there is no composition, the selection event should be handled
// in the aPresContext or tabParent.
TextComposition::HandleSelectionEvent(aPresContext, tabParent,
// in the aPresContext or browserParent.
TextComposition::HandleSelectionEvent(aPresContext, browserParent,
aSelectionEvent);
}
}
@ -1613,25 +1617,26 @@ void IMEStateManager::OnCompositionEventDiscarded(
// static
nsresult IMEStateManager::NotifyIME(IMEMessage aMessage, nsIWidget* aWidget,
TabParent* aTabParent) {
BrowserParent* aBrowserParent) {
return IMEStateManager::NotifyIME(IMENotification(aMessage), aWidget,
aTabParent);
aBrowserParent);
}
// static
nsresult IMEStateManager::NotifyIME(const IMENotification& aNotification,
nsIWidget* aWidget, TabParent* aTabParent) {
MOZ_LOG(
sISMLog, LogLevel::Info,
("NotifyIME(aNotification={ mMessage=%s }, "
"aWidget=0x%p, aTabParent=0x%p), sFocusedIMEWidget=0x%p, "
"TabParent::GetFocused()=0x%p, sFocusedIMETabParent=0x%p, "
"aTabParent == TabParent::GetFocused()=%s, "
"aTabParent == sFocusedIMETabParent=%s",
ToChar(aNotification.mMessage), aWidget, aTabParent, sFocusedIMEWidget,
TabParent::GetFocused(), sFocusedIMETabParent.get(),
GetBoolName(aTabParent == TabParent::GetFocused()),
GetBoolName(aTabParent == sFocusedIMETabParent)));
nsIWidget* aWidget,
BrowserParent* aBrowserParent) {
MOZ_LOG(sISMLog, LogLevel::Info,
("NotifyIME(aNotification={ mMessage=%s }, "
"aWidget=0x%p, aBrowserParent=0x%p), sFocusedIMEWidget=0x%p, "
"BrowserParent::GetFocused()=0x%p, sFocusedIMEBrowserParent=0x%p, "
"aBrowserParent == BrowserParent::GetFocused()=%s, "
"aBrowserParent == sFocusedIMEBrowserParent=%s",
ToChar(aNotification.mMessage), aWidget, aBrowserParent,
sFocusedIMEWidget, BrowserParent::GetFocused(),
sFocusedIMEBrowserParent.get(),
GetBoolName(aBrowserParent == BrowserParent::GetFocused()),
GetBoolName(aBrowserParent == sFocusedIMEBrowserParent)));
if (NS_WARN_IF(!aWidget)) {
MOZ_LOG(sISMLog, LogLevel::Error,
@ -1644,11 +1649,11 @@ nsresult IMEStateManager::NotifyIME(const IMENotification& aNotification,
// If focus notification comes from a remote browser which already lost
// focus, we shouldn't accept the focus notification. Then, following
// notifications from the process will be ignored.
if (aTabParent != TabParent::GetFocused()) {
if (aBrowserParent != BrowserParent::GetFocused()) {
MOZ_LOG(sISMLog, LogLevel::Warning,
(" NotifyIME(), WARNING, the received focus notification is "
"ignored, because its associated TabParent did not match"
"the focused TabParent."));
"ignored, because its associated BrowserParent did not match"
"the focused BrowserParent."));
return NS_OK;
}
// If IME focus is already set, first blur the currently-focused
@ -1657,7 +1662,7 @@ nsresult IMEStateManager::NotifyIME(const IMENotification& aNotification,
// XXX Why don't we first request the previously-focused IME
// widget to commit the composition?
MOZ_ASSERT(
sFocusedIMETabParent || aTabParent,
sFocusedIMEBrowserParent || aBrowserParent,
"This case shouldn't be caused by focus move in this process");
MOZ_LOG(sISMLog, LogLevel::Warning,
(" NotifyIME(), WARNING, received focus notification with ")
@ -1665,16 +1670,16 @@ nsresult IMEStateManager::NotifyIME(const IMENotification& aNotification,
"OnFocusMovedBetweenBrowsers did not blur it already?");
nsCOMPtr<nsIWidget> focusedIMEWidget(sFocusedIMEWidget);
sFocusedIMEWidget = nullptr;
sFocusedIMETabParent = nullptr;
sFocusedIMEBrowserParent = nullptr;
focusedIMEWidget->NotifyIME(IMENotification(NOTIFY_IME_OF_BLUR));
}
#ifdef DEBUG
if (aTabParent) {
nsCOMPtr<nsIWidget> tabParentWidget = aTabParent->GetWidget();
MOZ_ASSERT(tabParentWidget == aWidget);
if (aBrowserParent) {
nsCOMPtr<nsIWidget> browserParentWidget = aBrowserParent->GetWidget();
MOZ_ASSERT(browserParentWidget == aWidget);
}
#endif
sFocusedIMETabParent = aTabParent;
sFocusedIMEBrowserParent = aBrowserParent;
sFocusedIMEWidget = aWidget;
nsCOMPtr<nsIWidget> widget(aWidget);
MOZ_LOG(
@ -1683,7 +1688,7 @@ nsresult IMEStateManager::NotifyIME(const IMENotification& aNotification,
return widget->NotifyIME(aNotification);
}
case NOTIFY_IME_OF_BLUR: {
if (aTabParent != sFocusedIMETabParent) {
if (aBrowserParent != sFocusedIMEBrowserParent) {
MOZ_LOG(sISMLog, LogLevel::Warning,
(" NotifyIME(), WARNING, the received blur notification is "
"ignored "
@ -1706,7 +1711,7 @@ nsresult IMEStateManager::NotifyIME(const IMENotification& aNotification,
}
nsCOMPtr<nsIWidget> focusedIMEWidget(sFocusedIMEWidget);
sFocusedIMEWidget = nullptr;
sFocusedIMETabParent = nullptr;
sFocusedIMEBrowserParent = nullptr;
return focusedIMEWidget->NotifyIME(IMENotification(NOTIFY_IME_OF_BLUR));
}
case NOTIFY_IME_OF_SELECTION_CHANGE:
@ -1714,7 +1719,7 @@ nsresult IMEStateManager::NotifyIME(const IMENotification& aNotification,
case NOTIFY_IME_OF_POSITION_CHANGE:
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED: {
if (aTabParent != sFocusedIMETabParent) {
if (aBrowserParent != sFocusedIMEBrowserParent) {
MOZ_LOG(
sISMLog, LogLevel::Warning,
(" NotifyIME(), WARNING, the received content change notification "
@ -1760,7 +1765,7 @@ nsresult IMEStateManager::NotifyIME(const IMENotification& aNotification,
return NS_OK;
}
if (aTabParent != composition->GetTabParent()) {
if (aBrowserParent != composition->GetBrowserParent()) {
MOZ_LOG(
sISMLog, LogLevel::Warning,
(" NotifyIME(), WARNING, the request to IME is ignored because "
@ -1785,10 +1790,10 @@ nsresult IMEStateManager::NotifyIME(const IMENotification& aNotification,
// static
nsresult IMEStateManager::NotifyIME(IMEMessage aMessage,
nsPresContext* aPresContext,
TabParent* aTabParent) {
BrowserParent* aBrowserParent) {
MOZ_LOG(sISMLog, LogLevel::Info,
("NotifyIME(aMessage=%s, aPresContext=0x%p, aTabParent=0x%p)",
ToChar(aMessage), aPresContext, aTabParent));
("NotifyIME(aMessage=%s, aPresContext=0x%p, aBrowserParent=0x%p)",
ToChar(aMessage), aPresContext, aBrowserParent));
if (NS_WARN_IF(!CanHandleWith(aPresContext))) {
return NS_ERROR_INVALID_ARG;
@ -1801,7 +1806,7 @@ nsresult IMEStateManager::NotifyIME(IMEMessage aMessage,
"nsPresContext"));
return NS_ERROR_NOT_AVAILABLE;
}
return NotifyIME(aMessage, widget, aTabParent);
return NotifyIME(aMessage, widget, aBrowserParent);
}
// static

View File

@ -9,7 +9,7 @@
#include "mozilla/EventForwards.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "nsIWidget.h"
class nsIContent;
@ -35,7 +35,7 @@ class Selection;
*/
class IMEStateManager {
typedef dom::TabParent TabParent;
typedef dom::BrowserParent BrowserParent;
typedef widget::IMEMessage IMEMessage;
typedef widget::IMENotification IMENotification;
typedef widget::IMEState IMEState;
@ -47,41 +47,44 @@ class IMEStateManager {
static void Shutdown();
/**
* GetActiveTabParent() returns a pointer to a TabParent instance which is
* managed by the focused content (sContent). If the focused content isn't
* managing another process, this returns nullptr.
* GetActiveBrowserParent() returns a pointer to a BrowserParent instance
* which is managed by the focused content (sContent). If the focused content
* isn't managing another process, this returns nullptr.
*/
static TabParent* GetActiveTabParent() {
static BrowserParent* GetActiveBrowserParent() {
// If menu has pseudo focus, we should ignore active child process.
if (sInstalledMenuKeyboardListener) {
return nullptr;
}
return TabParent::GetFocused();
return BrowserParent::GetFocused();
}
/**
* DoesTabParentHaveIMEFocus() returns true when aTabParent has IME focus,
* i.e., the TabParent sent "focus" notification but not yet sends "blur".
* Note that this doesn't check if the remote processes are same because
* if another TabParent has focus, committing composition causes firing
* composition events in different TabParent. (Anyway, such case shouldn't
* occur.)
* DoesBrowserParentHaveIMEFocus() returns true when aBrowserParent has IME
* focus, i.e., the BrowserParent sent "focus" notification but not yet sends
* "blur". Note that this doesn't check if the remote processes are same
* because if another BrowserParent has focus, committing composition causes
* firing composition events in different BrowserParent. (Anyway, such case
* shouldn't occur.)
*/
static bool DoesTabParentHaveIMEFocus(const TabParent* aTabParent) {
MOZ_ASSERT(aTabParent);
return sFocusedIMETabParent == aTabParent;
static bool DoesBrowserParentHaveIMEFocus(
const BrowserParent* aBrowserParent) {
MOZ_ASSERT(aBrowserParent);
return sFocusedIMEBrowserParent == aBrowserParent;
}
/**
* OnTabParentDestroying() is called when aTabParent is being destroyed.
* OnBrowserParentDestroying() is called when aBrowserParent is being
* destroyed.
*/
static void OnTabParentDestroying(TabParent* aTabParent);
static void OnBrowserParentDestroying(BrowserParent* aBrowserParent);
/**
* Focus moved between browsers from aBlur to aFocus. (nullptr means the
* chrome process.)
*/
static void OnFocusMovedBetweenBrowsers(TabParent* aBlur, TabParent* aFocus);
static void OnFocusMovedBetweenBrowsers(BrowserParent* aBlur,
BrowserParent* aFocus);
/**
* Called when aWidget is being deleted.
@ -102,10 +105,10 @@ class IMEStateManager {
}
/**
* SetIMEContextForChildProcess() is called when aTabParent receives
* SetIMEContextForChildProcess() is called when aBrowserParent receives
* SetInputContext() from the remote process.
*/
static void SetInputContextForChildProcess(TabParent* aTabParent,
static void SetInputContextForChildProcess(BrowserParent* aBrowserParent,
const InputContext& aInputContext,
const InputContextAction& aAction);
@ -203,7 +206,7 @@ class IMEStateManager {
*/
static void DispatchCompositionEvent(
nsINode* aEventTargetNode, nsPresContext* aPresContext,
TabParent* aTabParent, WidgetCompositionEvent* aCompositionEvent,
BrowserParent* aBrowserParent, WidgetCompositionEvent* aCompositionEvent,
nsEventStatus* aStatus, EventDispatchingCallback* aCallBack,
bool aIsSynthesized = false);
@ -250,11 +253,11 @@ class IMEStateManager {
*/
static nsresult NotifyIME(const IMENotification& aNotification,
nsIWidget* aWidget,
TabParent* aTabParent = nullptr);
BrowserParent* aBrowserParent = nullptr);
static nsresult NotifyIME(IMEMessage aMessage, nsIWidget* aWidget,
TabParent* aTabParent = nullptr);
BrowserParent* aBrowserParent = nullptr);
static nsresult NotifyIME(IMEMessage aMessage, nsPresContext* aPresContext,
TabParent* aTabParent = nullptr);
BrowserParent* aBrowserParent = nullptr);
static nsINode* GetRootEditableNode(nsPresContext* aPresContext,
nsIContent* aContent);
@ -316,10 +319,10 @@ class IMEStateManager {
// sPresContext has gone, we need to clean up some IME state on the widget
// if the widget is available.
static nsIWidget* sWidget;
// sFocusedIMETabParent is the tab parent, which send "focus" notification to
// sFocusedIMEWidget (and didn't yet sent "blur" notification).
// sFocusedIMEBrowserParent is the tab parent, which send "focus" notification
// to sFocusedIMEWidget (and didn't yet sent "blur" notification).
static nsIWidget* sFocusedIMEWidget;
static StaticRefPtr<TabParent> sFocusedIMETabParent;
static StaticRefPtr<BrowserParent> sFocusedIMEBrowserParent;
// sActiveInputContextWidget is the last widget whose SetInputContext() is
// called. This is important to reduce sync IPC cost with parent process.
// If IMEStateManager set input context to different widget, PuppetWidget can
@ -338,9 +341,9 @@ class IMEStateManager {
// Origin type of current process.
static InputContext::Origin sOrigin;
// sActiveChildInputContext is valid only when TabParent::GetFocused() is not
// nullptr. This stores last information of input context in the remote
// process of TabParent::GetFocused(). I.e., they are set when
// sActiveChildInputContext is valid only when BrowserParent::GetFocused() is
// not nullptr. This stores last information of input context in the remote
// process of BrowserParent::GetFocused(). I.e., they are set when
// SetInputContextForChildProcess() is called. This is necessary for
// restoring IME state when menu keyboard listener is uninstalled.
static InputContext sActiveChildInputContext;

View File

@ -22,7 +22,7 @@
#include "mozilla/TextComposition.h"
#include "mozilla/TextEvents.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#ifdef XP_MACOSX
// Some defiens will be conflict with OSX SDK
@ -52,11 +52,11 @@ namespace mozilla {
bool TextComposition::sHandlingSelectionEvent = false;
TextComposition::TextComposition(nsPresContext* aPresContext, nsINode* aNode,
TabParent* aTabParent,
BrowserParent* aBrowserParent,
WidgetCompositionEvent* aCompositionEvent)
: mPresContext(aPresContext),
mNode(aNode),
mTabParent(aTabParent),
mBrowserParent(aBrowserParent),
mNativeContext(aCompositionEvent->mNativeIMEContext),
mCompositionStartOffset(0),
mTargetClauseOffsetInComposition(0),
@ -80,7 +80,7 @@ TextComposition::TextComposition(nsPresContext* aPresContext, nsINode* aNode,
void TextComposition::Destroy() {
mPresContext = nullptr;
mNode = nullptr;
mTabParent = nullptr;
mBrowserParent = nullptr;
mContainerTextNode = nullptr;
mCompositionStartOffsetInTextNode = UINT32_MAX;
mCompositionLengthInTextNode = UINT32_MAX;
@ -96,7 +96,7 @@ bool TextComposition::IsValidStateForComposition(nsIWidget* aWidget) const {
bool TextComposition::MaybeDispatchCompositionUpdate(
const WidgetCompositionEvent* aCompositionEvent) {
MOZ_RELEASE_ASSERT(!mTabParent);
MOZ_RELEASE_ASSERT(!mBrowserParent);
if (!IsValidStateForComposition(aCompositionEvent->mWidget)) {
return false;
@ -119,7 +119,7 @@ bool TextComposition::MaybeDispatchCompositionUpdate(
BaseEventFlags TextComposition::CloneAndDispatchAs(
const WidgetCompositionEvent* aCompositionEvent, EventMessage aMessage,
nsEventStatus* aStatus, EventDispatchingCallback* aCallBack) {
MOZ_RELEASE_ASSERT(!mTabParent);
MOZ_RELEASE_ASSERT(!mBrowserParent);
MOZ_ASSERT(IsValidStateForComposition(aCompositionEvent->mWidget),
"Should be called only when it's safe to dispatch an event");
@ -170,9 +170,9 @@ void TextComposition::OnCompositionEventDiscarded(
MOZ_ASSERT(aCompositionEvent->IsTrusted(),
"Shouldn't be called with untrusted event");
if (mTabParent) {
if (mBrowserParent) {
// The composition event should be discarded in the child process too.
Unused << mTabParent->SendCompositionEvent(*aCompositionEvent);
Unused << mBrowserParent->SendCompositionEvent(*aCompositionEvent);
}
// XXX If composition events are discarded, should we dispatch them with
@ -255,10 +255,10 @@ void TextComposition::DispatchCompositionEvent(
return;
}
// If the content is a container of TabParent, composition should be in the
// remote process.
if (mTabParent) {
Unused << mTabParent->SendCompositionEvent(*aCompositionEvent);
// If the content is a container of BrowserParent, composition should be in
// the remote process.
if (mBrowserParent) {
Unused << mBrowserParent->SendCompositionEvent(*aCompositionEvent);
aCompositionEvent->StopPropagation();
if (aCompositionEvent->CausesDOMTextEvent()) {
mLastData = aCompositionEvent->mData;
@ -417,12 +417,12 @@ void TextComposition::DispatchCompositionEvent(
// static
void TextComposition::HandleSelectionEvent(
nsPresContext* aPresContext, TabParent* aTabParent,
nsPresContext* aPresContext, BrowserParent* aBrowserParent,
WidgetSelectionEvent* aSelectionEvent) {
// If the content is a container of TabParent, composition should be in the
// remote process.
if (aTabParent) {
Unused << aTabParent->SendSelectionEvent(*aSelectionEvent);
// If the content is a container of BrowserParent, composition should be in
// the remote process.
if (aBrowserParent) {
Unused << aBrowserParent->SendSelectionEvent(*aSelectionEvent);
aSelectionEvent->StopPropagation();
return;
}
@ -485,7 +485,7 @@ uint32_t TextComposition::GetSelectionStartOffset() {
void TextComposition::OnCompositionEventDispatched(
const WidgetCompositionEvent* aCompositionEvent) {
MOZ_RELEASE_ASSERT(!mTabParent);
MOZ_RELEASE_ASSERT(!mBrowserParent);
if (!IsValidStateForComposition(aCompositionEvent->mWidget)) {
return;
@ -605,7 +605,7 @@ nsresult TextComposition::RequestToCommit(nsIWidget* aWidget, bool aDiscard) {
nsresult TextComposition::NotifyIME(IMEMessage aMessage) {
NS_ENSURE_TRUE(mPresContext, NS_ERROR_NOT_AVAILABLE);
return IMEStateManager::NotifyIME(aMessage, mPresContext, mTabParent);
return IMEStateManager::NotifyIME(aMessage, mPresContext, mBrowserParent);
}
void TextComposition::EditorWillHandleCompositionChangeEvent(
@ -621,7 +621,7 @@ void TextComposition::EditorWillHandleCompositionChangeEvent(
}
void TextComposition::OnEditorDestroyed() {
MOZ_RELEASE_ASSERT(!mTabParent);
MOZ_RELEASE_ASSERT(!mBrowserParent);
MOZ_ASSERT(!mIsEditorHandlingEvent,
"The editor should have stopped listening events");
@ -641,14 +641,14 @@ void TextComposition::EditorDidHandleCompositionChangeEvent() {
}
void TextComposition::StartHandlingComposition(EditorBase* aEditorBase) {
MOZ_RELEASE_ASSERT(!mTabParent);
MOZ_RELEASE_ASSERT(!mBrowserParent);
MOZ_ASSERT(!HasEditor(), "There is a handling editor already");
mEditorBaseWeak = do_GetWeakReference(static_cast<nsIEditor*>(aEditorBase));
}
void TextComposition::EndHandlingComposition(EditorBase* aEditorBase) {
MOZ_RELEASE_ASSERT(!mTabParent);
MOZ_RELEASE_ASSERT(!mBrowserParent);
#ifdef DEBUG
RefPtr<EditorBase> editorBase = GetEditorBase();
@ -825,8 +825,8 @@ TextComposition::CompositionEventDispatcher::Run() {
compStart.mFlags.mIsSynthesizedForTests =
mTextComposition->IsSynthesizedForTests();
IMEStateManager::DispatchCompositionEvent(
mEventTarget, presContext, mTextComposition->mTabParent, &compStart,
&status, nullptr, mIsSynthesizedEvent);
mEventTarget, presContext, mTextComposition->mBrowserParent,
&compStart, &status, nullptr, mIsSynthesizedEvent);
break;
}
case eCompositionChange:
@ -840,8 +840,8 @@ TextComposition::CompositionEventDispatcher::Run() {
compEvent.mFlags.mIsSynthesizedForTests =
mTextComposition->IsSynthesizedForTests();
IMEStateManager::DispatchCompositionEvent(
mEventTarget, presContext, mTextComposition->mTabParent, &compEvent,
&status, nullptr, mIsSynthesizedEvent);
mEventTarget, presContext, mTextComposition->mBrowserParent,
&compEvent, &status, nullptr, mIsSynthesizedEvent);
break;
}
default:

View File

@ -18,7 +18,7 @@
#include "mozilla/EventForwards.h"
#include "mozilla/RangeBoundary.h"
#include "mozilla/TextRange.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/Text.h"
namespace mozilla {
@ -39,13 +39,13 @@ class TextComposition final {
NS_INLINE_DECL_REFCOUNTING(TextComposition)
public:
typedef dom::TabParent TabParent;
typedef dom::BrowserParent BrowserParent;
typedef dom::Text Text;
static bool IsHandlingSelectionEvent() { return sHandlingSelectionEvent; }
TextComposition(nsPresContext* aPresContext, nsINode* aNode,
TabParent* aTabParent,
BrowserParent* aBrowserParent,
WidgetCompositionEvent* aCompositionEvent);
bool Destroyed() const { return !mPresContext; }
@ -78,7 +78,7 @@ class TextComposition final {
return mPresContext ? mPresContext->GetRootWidget() : nullptr;
}
// Returns the tab parent which has this composition in its remote process.
TabParent* GetTabParent() const { return mTabParent; }
BrowserParent* GetBrowserParent() const { return mBrowserParent; }
// Returns true if the composition is started with synthesized event which
// came from nsDOMWindowUtils.
bool IsSynthesizedForTests() const { return mIsSynthesizedForTests; }
@ -288,7 +288,7 @@ class TextComposition final {
// this instance.
nsPresContext* mPresContext;
nsCOMPtr<nsINode> mNode;
RefPtr<TabParent> mTabParent;
RefPtr<BrowserParent> mBrowserParent;
// The text node which includes the composition string.
RefPtr<Text> mContainerTextNode;
@ -470,12 +470,12 @@ class TextComposition final {
MOZ_CAN_RUN_SCRIPT
void HandleSelectionEvent(WidgetSelectionEvent* aSelectionEvent) {
RefPtr<nsPresContext> presContext(mPresContext);
RefPtr<TabParent> tabParent(mTabParent);
HandleSelectionEvent(presContext, tabParent, aSelectionEvent);
RefPtr<BrowserParent> browserParent(mBrowserParent);
HandleSelectionEvent(presContext, browserParent, aSelectionEvent);
}
MOZ_CAN_RUN_SCRIPT
static void HandleSelectionEvent(nsPresContext* aPresContext,
TabParent* aTabParent,
BrowserParent* aBrowserParent,
WidgetSelectionEvent* aSelectionEvent);
/**

View File

@ -133,11 +133,11 @@ void nsGenericHTMLFrameElement::EnsureFrameLoader() {
}
nsresult nsGenericHTMLFrameElement::CreateRemoteFrameLoader(
nsIRemoteTab* aTabParent) {
nsIRemoteTab* aBrowserParent) {
MOZ_ASSERT(!mFrameLoader);
EnsureFrameLoader();
NS_ENSURE_STATE(mFrameLoader);
mFrameLoader->SetRemoteBrowser(aTabParent);
mFrameLoader->SetRemoteBrowser(aBrowserParent);
if (nsSubDocumentFrame* subdocFrame = do_QueryFrame(GetPrimaryFrame())) {
// The reflow for this element already happened while we were waiting

View File

@ -40,7 +40,7 @@
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileBlobImpl.h"
#include "mozilla/dom/StructuredCloneTags.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/filehandle/ActorsParent.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBCursorParent.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseParent.h"

View File

@ -144,7 +144,7 @@ IPCResult BrowserBridgeChild::RecvSetLayersId(
mozilla::ipc::IPCResult BrowserBridgeChild::RecvRequestFocus(
const bool& aCanRaise) {
// Adapted from TabParent
// Adapted from BrowserParent
nsCOMPtr<nsIFocusManager> fm = nsFocusManager::GetFocusManager();
if (!fm) {
return IPC_OK();
@ -167,7 +167,7 @@ mozilla::ipc::IPCResult BrowserBridgeChild::RecvRequestFocus(
mozilla::ipc::IPCResult BrowserBridgeChild::RecvMoveFocus(
const bool& aForward, const bool& aForDocumentNavigation) {
// Adapted from TabParent
// Adapted from BrowserParent
nsCOMPtr<nsIFocusManager> fm = nsFocusManager::GetFocusManager();
if (!fm) {
return IPC_OK();

View File

@ -59,15 +59,15 @@ nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL,
tabContext.AsIPCTabContext(),
constructorSender->ChildID());
// Construct the TabParent object for our subframe.
RefPtr<TabParent> tabParent(new TabParent(constructorSender, tabId,
tabContext, aBrowsingContext,
aChromeFlags, this));
// Construct the BrowserParent object for our subframe.
RefPtr<BrowserParent> browserParent(
new BrowserParent(constructorSender, tabId, tabContext, aBrowsingContext,
aChromeFlags, this));
// Open a remote endpoint for our PBrowser actor. DeallocPBrowserParent
// releases the ref taken.
ManagedEndpoint<PBrowserChild> childEp =
constructorSender->OpenPBrowserEndpoint(do_AddRef(tabParent).take());
constructorSender->OpenPBrowserEndpoint(do_AddRef(browserParent).take());
if (NS_WARN_IF(!childEp.IsValid())) {
MOZ_ASSERT(false, "Browser Open Endpoint Failed");
return NS_ERROR_FAILURE;
@ -83,12 +83,12 @@ nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL,
return NS_ERROR_FAILURE;
}
// Set our TabParent object to the newly created browser.
mTabParent = tabParent.forget();
mTabParent->SetOwnerElement(Manager()->GetOwnerElement());
mTabParent->InitRendering();
// Set our BrowserParent object to the newly created browser.
mBrowserParent = browserParent.forget();
mBrowserParent->SetOwnerElement(Manager()->GetOwnerElement());
mBrowserParent->InitRendering();
RenderFrame* rf = mTabParent->GetRenderFrame();
RenderFrame* rf = mBrowserParent->GetRenderFrame();
if (NS_WARN_IF(!rf)) {
MOZ_ASSERT(false, "No RenderFrame");
return NS_ERROR_FAILURE;
@ -100,61 +100,61 @@ nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL,
}
void BrowserBridgeParent::Destroy() {
if (mTabParent) {
mTabParent->Destroy();
mTabParent = nullptr;
if (mBrowserParent) {
mBrowserParent->Destroy();
mBrowserParent = nullptr;
}
}
IPCResult BrowserBridgeParent::RecvShow(const ScreenIntSize& aSize,
const bool& aParentIsActive,
const nsSizeMode& aSizeMode) {
RenderFrame* rf = mTabParent->GetRenderFrame();
RenderFrame* rf = mBrowserParent->GetRenderFrame();
if (!rf->AttachLayerManager()) {
MOZ_CRASH();
}
Unused << mTabParent->SendShow(aSize, mTabParent->GetShowInfo(),
aParentIsActive, aSizeMode);
Unused << mBrowserParent->SendShow(aSize, mBrowserParent->GetShowInfo(),
aParentIsActive, aSizeMode);
return IPC_OK();
}
IPCResult BrowserBridgeParent::RecvLoadURL(const nsCString& aUrl) {
Unused << mTabParent->SendLoadURL(aUrl, mTabParent->GetShowInfo());
Unused << mBrowserParent->SendLoadURL(aUrl, mBrowserParent->GetShowInfo());
return IPC_OK();
}
IPCResult BrowserBridgeParent::RecvResumeLoad(uint64_t aPendingSwitchID) {
mTabParent->ResumeLoad(aPendingSwitchID);
mBrowserParent->ResumeLoad(aPendingSwitchID);
return IPC_OK();
}
IPCResult BrowserBridgeParent::RecvUpdateDimensions(
const DimensionInfo& aDimensions) {
Unused << mTabParent->SendUpdateDimensions(aDimensions);
Unused << mBrowserParent->SendUpdateDimensions(aDimensions);
return IPC_OK();
}
IPCResult BrowserBridgeParent::RecvRenderLayers(
const bool& aEnabled, const bool& aForceRepaint,
const layers::LayersObserverEpoch& aEpoch) {
Unused << mTabParent->SendRenderLayers(aEnabled, aForceRepaint, aEpoch);
Unused << mBrowserParent->SendRenderLayers(aEnabled, aForceRepaint, aEpoch);
return IPC_OK();
}
IPCResult BrowserBridgeParent::RecvNavigateByKey(
const bool& aForward, const bool& aForDocumentNavigation) {
Unused << mTabParent->SendNavigateByKey(aForward, aForDocumentNavigation);
Unused << mBrowserParent->SendNavigateByKey(aForward, aForDocumentNavigation);
return IPC_OK();
}
IPCResult BrowserBridgeParent::RecvActivate() {
mTabParent->Activate();
mBrowserParent->Activate();
return IPC_OK();
}
IPCResult BrowserBridgeParent::RecvDeactivate() {
mTabParent->Deactivate();
mBrowserParent->Deactivate();
return IPC_OK();
}

View File

@ -8,7 +8,7 @@
#define mozilla_dom_BrowserBridgeParent_h
#include "mozilla/dom/PBrowserBridgeParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
namespace mozilla {
namespace dom {
@ -24,16 +24,16 @@ class BrowserBridgeParent : public PBrowserBridgeParent {
CanonicalBrowsingContext* aBrowsingContext,
const uint32_t& aChromeFlags);
TabParent* GetTabParent() { return mTabParent; }
BrowserParent* GetBrowserParent() { return mBrowserParent; }
CanonicalBrowsingContext* GetBrowsingContext() {
return mTabParent->GetBrowsingContext();
return mBrowserParent->GetBrowsingContext();
}
// Get our manager actor.
TabParent* Manager() {
BrowserParent* Manager() {
MOZ_ASSERT(mIPCOpen);
return static_cast<TabParent*>(PBrowserBridgeParent::Manager());
return static_cast<BrowserParent*>(PBrowserBridgeParent::Manager());
}
// Tear down this BrowserBridgeParent.
@ -65,7 +65,7 @@ class BrowserBridgeParent : public PBrowserBridgeParent {
private:
~BrowserBridgeParent();
RefPtr<TabParent> mTabParent;
RefPtr<BrowserParent> mBrowserParent;
bool mIPCOpen;
};

File diff suppressed because it is too large Load Diff

View File

@ -4,8 +4,8 @@
* 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_tabs_TabParent_h
#define mozilla_tabs_TabParent_h
#ifndef mozilla_tabs_BrowserParent_h
#define mozilla_tabs_BrowserParent_h
#include "js/TypeDecls.h"
#include "LiveResizeListener.h"
@ -78,20 +78,20 @@ namespace ipc {
class StructuredCloneData;
} // namespace ipc
class TabParent final : public PBrowserParent,
public nsIDOMEventListener,
public nsIRemoteTab,
public nsIAuthPromptProvider,
public nsIKeyEventInPluginCallback,
public nsSupportsWeakReference,
public TabContext,
public LiveResizeListener {
class BrowserParent final : public PBrowserParent,
public nsIDOMEventListener,
public nsIRemoteTab,
public nsIAuthPromptProvider,
public nsIKeyEventInPluginCallback,
public nsSupportsWeakReference,
public TabContext,
public LiveResizeListener {
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
friend class PBrowserParent;
friend class BrowserBridgeParent; // for clearing mBrowserBridgeParent
virtual ~TabParent();
virtual ~BrowserParent();
public:
// Helper class for ContentParent::RecvCreateWindow.
@ -104,12 +104,13 @@ class TabParent final : public PBrowserParent,
// nsIDOMEventListener interfaces
NS_DECL_NSIDOMEVENTLISTENER
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(TabParent, nsIRemoteTab)
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(BrowserParent, nsIRemoteTab)
TabParent(ContentParent* aManager, const TabId& aTabId,
const TabContext& aContext,
CanonicalBrowsingContext* aBrowsingContext, uint32_t aChromeFlags,
BrowserBridgeParent* aBrowserBridgeParent = nullptr);
BrowserParent(ContentParent* aManager, const TabId& aTabId,
const TabContext& aContext,
CanonicalBrowsingContext* aBrowsingContext,
uint32_t aChromeFlags,
BrowserBridgeParent* aBrowserBridgeParent = nullptr);
Element* GetOwnerElement() const { return mFrameElement; }
already_AddRefed<nsPIDOMWindowOuter> GetParentWindowOuter();
@ -491,18 +492,18 @@ class TabParent final : public PBrowserParent,
static void InitializeStatics();
/**
* Returns the focused TabParent or nullptr if chrome or another app
* Returns the focused BrowserParent or nullptr if chrome or another app
* is focused.
*/
static TabParent* GetFocused();
static BrowserParent* GetFocused();
static TabParent* GetFrom(nsFrameLoader* aFrameLoader);
static BrowserParent* GetFrom(nsFrameLoader* aFrameLoader);
static TabParent* GetFrom(nsIRemoteTab* aTabParent);
static BrowserParent* GetFrom(nsIRemoteTab* aBrowserParent);
static TabParent* GetFrom(PBrowserParent* aTabParent);
static BrowserParent* GetFrom(PBrowserParent* aBrowserParent);
static TabParent* GetFrom(nsIContent* aContent);
static BrowserParent* GetFrom(nsIContent* aContent);
static TabId GetTabIdFrom(nsIDocShell* docshell);
@ -599,8 +600,8 @@ class TabParent final : public PBrowserParent,
layout::RenderFrame* GetRenderFrame();
// Returns the BrowserBridgeParent if this TabParent is for an out-of-process
// iframe and nullptr otherwise.
// Returns the BrowserBridgeParent if this BrowserParent is for an
// out-of-process iframe and nullptr otherwise.
BrowserBridgeParent* GetBrowserBridgeParent() const;
mozilla::ipc::IPCResult RecvEnsureLayersConnected(
@ -712,7 +713,7 @@ class TabParent final : public PBrowserParent,
// When true, we've initiated normal shutdown and notified our managing
// PContent.
bool mMarkedDestroying;
// When true, the TabParent is invalid and we should not send IPC messages
// When true, the BrowserParent is invalid and we should not send IPC messages
// anymore.
bool mIsDestroyed;
@ -732,13 +733,13 @@ class TabParent final : public PBrowserParent,
// dispatch message manager messages during this time.
RefPtr<nsFrameLoader> mFrameLoader;
// The root browsing context loaded in this TabParent.
// The root browsing context loaded in this BrowserParent.
RefPtr<CanonicalBrowsingContext> mBrowsingContext;
// Pointer back to BrowserBridgeParent if there is one associated with
// this TabParent. This is non-owning to avoid cycles and is managed
// this BrowserParent. This is non-owning to avoid cycles and is managed
// by the BrowserBridgeParent instance, which has the strong reference
// to this TabParent.
// to this BrowserParent.
BrowserBridgeParent* mBrowserBridgeParent;
TabId mTabId;
@ -794,22 +795,23 @@ class TabParent final : public PBrowserParent,
#endif
private:
// This is used when APZ needs to find the TabParent associated with a layer
// to dispatch events.
typedef nsDataHashtable<nsUint64HashKey, TabParent*> LayerToTabParentTable;
static LayerToTabParentTable* sLayerToTabParentTable;
// This is used when APZ needs to find the BrowserParent associated with a
// layer to dispatch events.
typedef nsDataHashtable<nsUint64HashKey, BrowserParent*>
LayerToBrowserParentTable;
static LayerToBrowserParentTable* sLayerToBrowserParentTable;
static void AddTabParentToTable(layers::LayersId aLayersId,
TabParent* aTabParent);
static void AddBrowserParentToTable(layers::LayersId aLayersId,
BrowserParent* aBrowserParent);
static void RemoveTabParentFromTable(layers::LayersId aLayersId);
static void RemoveBrowserParentFromTable(layers::LayersId aLayersId);
// Keeps track of which TabParent has keyboard focus
static StaticAutoPtr<nsTArray<TabParent*>> sFocusStack;
// Keeps track of which BrowserParent has keyboard focus
static StaticAutoPtr<nsTArray<BrowserParent*>> sFocusStack;
static void PushFocus(TabParent* aTabParent);
static void PushFocus(BrowserParent* aBrowserParent);
static void PopFocus(TabParent* aTabParent);
static void PopFocus(BrowserParent* aBrowserParent);
layout::RenderFrame mRenderFrame;
LayersObserverEpoch mLayerTreeEpoch;
@ -832,7 +834,7 @@ class TabParent final : public PBrowserParent,
// layers.
bool mHasLayers;
// True if this TabParent has had its layer tree sent to the compositor
// True if this BrowserParent has had its layer tree sent to the compositor
// at least once.
bool mHasPresented;
@ -858,12 +860,13 @@ class TabParent final : public PBrowserParent,
void SetIsActiveRecordReplayTab(bool aIsActive);
public:
static TabParent* GetTabParentFromLayersId(layers::LayersId aLayersId);
static BrowserParent* GetBrowserParentFromLayersId(
layers::LayersId aLayersId);
};
struct MOZ_STACK_CLASS TabParent::AutoUseNewTab final {
struct MOZ_STACK_CLASS BrowserParent::AutoUseNewTab final {
public:
AutoUseNewTab(TabParent* aNewTab, nsCString* aURLToLoad)
AutoUseNewTab(BrowserParent* aNewTab, nsCString* aURLToLoad)
: mNewTab(aNewTab), mURLToLoad(aURLToLoad) {
MOZ_ASSERT(!aNewTab->mCreatingWindow);
@ -877,11 +880,11 @@ struct MOZ_STACK_CLASS TabParent::AutoUseNewTab final {
}
private:
TabParent* mNewTab;
BrowserParent* mNewTab;
nsCString* mURLToLoad;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_tabs_TabParent_h
#endif // mozilla_tabs_BrowserParent_h

View File

@ -10,7 +10,7 @@
#include "nsIDOMWindow.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
using mozilla::Unused;
using namespace mozilla::dom;
@ -45,7 +45,7 @@ bool ColorPickerParent::CreateColorPicker() {
return false;
}
Element* ownerElement = TabParent::GetFrom(Manager())->GetOwnerElement();
Element* ownerElement = BrowserParent::GetFrom(Manager())->GetOwnerElement();
if (!ownerElement) {
return false;
}

View File

@ -11,7 +11,7 @@
#include "ContentParent.h"
#include "ProcessUtils.h"
#include "TabParent.h"
#include "BrowserParent.h"
#if defined(ANDROID) || defined(LINUX)
# include <sys/time.h>
@ -195,7 +195,7 @@
#include "ProcessPriorityManager.h"
#include "SandboxHal.h"
#include "SourceSurfaceRawData.h"
#include "TabParent.h"
#include "BrowserParent.h"
#include "URIUtils.h"
#include "nsIWebBrowserChrome.h"
#include "nsIDocShell.h"
@ -537,7 +537,7 @@ ScriptableCPInfo::GetTabCount(int32_t* aTabCount) {
}
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
*aTabCount = cpm->GetTabParentCountByProcessId(mContentParent->ChildID());
*aTabCount = cpm->GetBrowserParentCountByProcessId(mContentParent->ChildID());
return NS_OK;
}
@ -574,7 +574,8 @@ UniquePtr<SandboxBrokerPolicyFactory>
ContentParent::sSandboxBrokerPolicyFactory;
#endif
uint64_t ContentParent::sNextRemoteTabId = 0;
nsDataHashtable<nsUint64HashKey, TabParent*> ContentParent::sNextTabParents;
nsDataHashtable<nsUint64HashKey, BrowserParent*>
ContentParent::sNextBrowserParents;
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
StaticAutoPtr<std::vector<std::string>> ContentParent::sMacSandboxParams;
#endif
@ -744,7 +745,7 @@ void ContentParent::ReleaseCachedProcesses() {
// Shuting down these processes will change the array so let's use another
// array for the removal.
for (auto* cp : contentParents) {
nsTArray<TabId> tabIds = cpm->GetTabParentsByProcessId(cp->mChildID);
nsTArray<TabId> tabIds = cpm->GetBrowserParentsByProcessId(cp->mChildID);
if (!tabIds.Length()) {
toRelease.AppendElement(cp);
}
@ -777,7 +778,7 @@ already_AddRefed<ContentParent> ContentParent::MinTabSelect(
NS_ASSERTION(p->IsAlive(),
"Non-alive contentparent in sBrowserContentParents?");
if (p->mOpener == aOpener) {
uint32_t tabCount = cpm->GetTabParentCountByProcessId(p->ChildID());
uint32_t tabCount = cpm->GetBrowserParentCountByProcessId(p->ChildID());
if (tabCount < min) {
candidate = p;
min = tabCount;
@ -1084,12 +1085,12 @@ mozilla::ipc::IPCResult ContentParent::RecvLaunchRDDProcess(
}
/*static*/
TabParent* ContentParent::CreateBrowser(const TabContext& aContext,
Element* aFrameElement,
BrowsingContext* aBrowsingContext,
ContentParent* aOpenerContentParent,
TabParent* aSameTabGroupAs,
uint64_t aNextRemoteTabId) {
BrowserParent* ContentParent::CreateBrowser(const TabContext& aContext,
Element* aFrameElement,
BrowsingContext* aBrowsingContext,
ContentParent* aOpenerContentParent,
BrowserParent* aSameTabGroupAs,
uint64_t aNextRemoteTabId) {
AUTO_PROFILER_LABEL("ContentParent::CreateBrowser", OTHER);
if (!sCanLaunchSubprocesses) {
@ -1103,8 +1104,9 @@ TabParent* ContentParent::CreateBrowser(const TabContext& aContext,
}
if (aNextRemoteTabId) {
if (TabParent* parent =
sNextTabParents.GetAndRemove(aNextRemoteTabId).valueOr(nullptr)) {
if (BrowserParent* parent =
sNextBrowserParents.GetAndRemove(aNextRemoteTabId)
.valueOr(nullptr)) {
MOZ_ASSERT(!parent->GetOwnerElement(),
"Shouldn't have an owner elemnt before");
parent->SetOwnerElement(aFrameElement);
@ -1118,7 +1120,7 @@ TabParent* ContentParent::CreateBrowser(const TabContext& aContext,
nsIDocShell* docShell = GetOpenerDocShellHelper(aFrameElement);
TabId openerTabId;
if (docShell) {
openerTabId = TabParent::GetTabIdFrom(docShell);
openerTabId = BrowserParent::GetTabIdFrom(docShell);
}
bool isPreloadBrowser = false;
@ -1130,7 +1132,7 @@ TabParent* ContentParent::CreateBrowser(const TabContext& aContext,
RefPtr<ContentParent> constructorSender;
MOZ_RELEASE_ASSERT(XRE_IsParentProcess(),
"Cannot allocate TabParent in content process");
"Cannot allocate BrowserParent in content process");
if (aOpenerContentParent) {
constructorSender = aOpenerContentParent;
} else {
@ -1187,14 +1189,15 @@ TabParent* ContentParent::CreateBrowser(const TabContext& aContext,
aBrowsingContext->Canonical()->SetOwnerProcessId(
constructorSender->ChildID());
RefPtr<TabParent> tabParent =
new TabParent(constructorSender, tabId, aContext,
RefPtr<BrowserParent> browserParent =
new BrowserParent(constructorSender, tabId, aContext,
aBrowsingContext->Canonical(), chromeFlags);
// Open a remote endpoint for our PBrowser actor. DeallocPBrowserParent
// releases the ref taken.
ManagedEndpoint<PBrowserChild> childEp =
constructorSender->OpenPBrowserEndpoint(do_AddRef(tabParent).take());
constructorSender->OpenPBrowserEndpoint(
do_AddRef(browserParent).take());
if (NS_WARN_IF(!childEp.IsValid())) {
return nullptr;
}
@ -1212,11 +1215,11 @@ TabParent* ContentParent::CreateBrowser(const TabContext& aContext,
if (remoteType.EqualsLiteral(LARGE_ALLOCATION_REMOTE_TYPE)) {
// Tell the TabChild object that it was created due to a Large-Allocation
// request.
Unused << tabParent->SendAwaitLargeAlloc();
Unused << browserParent->SendAwaitLargeAlloc();
}
tabParent->SetOwnerElement(aFrameElement);
return tabParent;
browserParent->SetOwnerElement(aFrameElement);
return browserParent;
}
return nullptr;
}
@ -1309,8 +1312,8 @@ namespace {
class RemoteWindowContext final : public nsIRemoteWindowContext,
public nsIInterfaceRequestor {
public:
explicit RemoteWindowContext(TabParent* aTabParent)
: mTabParent(aTabParent) {}
explicit RemoteWindowContext(BrowserParent* aBrowserParent)
: mBrowserParent(aBrowserParent) {}
NS_DECL_ISUPPORTS
NS_DECL_NSIINTERFACEREQUESTOR
@ -1318,7 +1321,7 @@ class RemoteWindowContext final : public nsIRemoteWindowContext,
private:
~RemoteWindowContext();
RefPtr<TabParent> mTabParent;
RefPtr<BrowserParent> mBrowserParent;
};
NS_IMPL_ISUPPORTS(RemoteWindowContext, nsIRemoteWindowContext,
@ -1333,13 +1336,13 @@ RemoteWindowContext::GetInterface(const nsIID& aIID, void** aSink) {
NS_IMETHODIMP
RemoteWindowContext::OpenURI(nsIURI* aURI) {
mTabParent->LoadURL(aURI);
mBrowserParent->LoadURL(aURI);
return NS_OK;
}
NS_IMETHODIMP
RemoteWindowContext::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing) {
nsCOMPtr<nsILoadContext> loadContext = mTabParent->GetLoadContext();
nsCOMPtr<nsILoadContext> loadContext = mBrowserParent->GetLoadContext();
*aUsePrivateBrowsing = loadContext && loadContext->UsePrivateBrowsing();
return NS_OK;
}
@ -1767,7 +1770,7 @@ void ContentParent::NotifyTabDestroying(const TabId& aTabId,
return;
}
++cp->mNumDestroyingTabs;
nsTArray<TabId> tabIds = cpm->GetTabParentsByProcessId(aCpId);
nsTArray<TabId> tabIds = cpm->GetBrowserParentsByProcessId(aCpId);
if (static_cast<size_t>(cp->mNumDestroyingTabs) != tabIds.Length()) {
return;
}
@ -1824,7 +1827,7 @@ void ContentParent::NotifyTabDestroyed(const TabId& aTabId,
// because of popup windows. When the last one closes, shut
// us down.
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
nsTArray<TabId> tabIds = cpm->GetTabParentsByProcessId(this->ChildID());
nsTArray<TabId> tabIds = cpm->GetBrowserParentsByProcessId(this->ChildID());
if (tabIds.Length() == 1 && !ShouldKeepProcessAlive() && !TryToRecycle()) {
// In the case of normal shutdown, send a shutdown message to child to
@ -3174,7 +3177,7 @@ bool ContentParent::CanOpenBrowser(const IPCTabContext& aContext) {
}
auto opener =
TabParent::GetFrom(popupContext.opener().get_PBrowserParent());
BrowserParent::GetFrom(popupContext.opener().get_PBrowserParent());
if (!opener) {
ASSERT_UNLESS_FUZZING(
"Got null opener from child; aborting AllocPBrowserParent.");
@ -3206,7 +3209,7 @@ bool ContentParent::CanOpenBrowser(const IPCTabContext& aContext) {
}
bool ContentParent::DeallocPBrowserParent(PBrowserParent* frame) {
TabParent* parent = TabParent::GetFrom(frame);
BrowserParent* parent = BrowserParent::GetFrom(frame);
NS_RELEASE(parent);
return true;
}
@ -3224,11 +3227,11 @@ mozilla::ipc::IPCResult ContentParent::RecvConstructPopupBrowser(
ContentParentId openerCpId(0);
if (aContext.type() == IPCTabContext::TPopupIPCTabContext) {
// CanOpenBrowser has ensured that the IPCTabContext is of
// type PopupIPCTabContext, and that the opener TabParent is
// type PopupIPCTabContext, and that the opener BrowserParent is
// reachable.
const PopupIPCTabContext& popupContext = aContext.get_PopupIPCTabContext();
auto opener =
TabParent::GetFrom(popupContext.opener().get_PBrowserParent());
BrowserParent::GetFrom(popupContext.opener().get_PBrowserParent());
openerTabId = opener->GetTabId();
openerCpId = opener->Manager()->ChildID();
@ -3275,11 +3278,11 @@ mozilla::ipc::IPCResult ContentParent::RecvConstructPopupBrowser(
MaybeInvalidTabContext tc(aContext);
MOZ_ASSERT(tc.IsValid());
RefPtr<TabParent> parent = new TabParent(this, aTabId, tc.GetTabContext(),
browsingContext, chromeFlags);
RefPtr<BrowserParent> parent = new BrowserParent(
this, aTabId, tc.GetTabContext(), browsingContext, chromeFlags);
// Bind the created TabParent to IPC to actually link the actor. The ref here
// is released in DeallocPBrowserParent.
// Bind the created BrowserParent to IPC to actually link the actor. The ref
// here is released in DeallocPBrowserParent.
if (NS_WARN_IF(!BindPBrowserEndpoint(std::move(aBrowserEp),
do_AddRef(parent).take()))) {
return IPC_FAIL(this, "BindPBrowserEndpoint failed");
@ -3289,7 +3292,8 @@ mozilla::ipc::IPCResult ContentParent::RecvConstructPopupBrowser(
// normal priority IPC messages. To prevent the input events preempt
// PBrowserConstructor, we use an IPC 'RemoteIsReadyToHandleInputEvents' to
// notify parent that TabChild is created. In this case, PBrowser is initiated
// from content so that we can set TabParent as ready to handle input events.
// from content so that we can set BrowserParent as ready to handle input
// events.
parent->SetReadyToHandleInputEvents();
return IPC_OK();
}
@ -3791,7 +3795,7 @@ mozilla::ipc::IPCResult ContentParent::RecvLoadURIExternal(
}
RefPtr<RemoteWindowContext> context =
new RemoteWindowContext(static_cast<TabParent*>(windowContext));
new RemoteWindowContext(static_cast<BrowserParent*>(windowContext));
extProtService->LoadURI(ourURI, context);
return IPC_OK();
}
@ -4563,7 +4567,7 @@ mozilla::ipc::IPCResult ContentParent::RecvSetOfflinePermission(
return IPC_OK();
}
void ContentParent::MaybeInvokeDragSession(TabParent* aParent) {
void ContentParent::MaybeInvokeDragSession(BrowserParent* aParent) {
// dnd uses IPCBlob to transfer data to the content process and the IPC
// message is sent as normal priority. When sending input events with input
// priority, the message may be preempted by the later dnd events. To make
@ -4624,8 +4628,8 @@ ContentParent::AllocPContentPermissionRequestParent(
const bool& aIsHandlingUserInput, const bool& aDocumentHasUserInput,
const DOMTimeStamp& aPageLoadTimestamp, const TabId& aTabId) {
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
RefPtr<TabParent> tp =
cpm->GetTopLevelTabParentByProcessAndTabId(this->ChildID(), aTabId);
RefPtr<BrowserParent> tp =
cpm->GetTopLevelBrowserParentByProcessAndTabId(this->ChildID(), aTabId);
if (!tp) {
return nullptr;
}
@ -4659,7 +4663,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
const bool& aCalledFromJS, const bool& aPositionSpecified,
const bool& aSizeSpecified, nsIURI* aURIToLoad, const nsCString& aFeatures,
const float& aFullZoom, uint64_t aNextRemoteTabId, const nsString& aName,
nsresult& aResult, nsCOMPtr<nsIRemoteTab>& aNewTabParent,
nsresult& aResult, nsCOMPtr<nsIRemoteTab>& aNewBrowserParent,
bool* aWindowIsNew, int32_t& aOpenLocation,
nsIPrincipal* aTriggeringPrincipal, nsIReferrerInfo* aReferrerInfo,
bool aLoadURI, nsIContentSecurityPolicy* aCsp)
@ -4675,12 +4679,12 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
return IPC_FAIL(this, "Forbidden aChromeFlags passed");
}
TabParent* thisTabParent = TabParent::GetFrom(aThisTab);
BrowserParent* thisBrowserParent = BrowserParent::GetFrom(aThisTab);
nsCOMPtr<nsIContent> frame;
if (thisTabParent) {
frame = thisTabParent->GetOwnerElement();
if (thisBrowserParent) {
frame = thisBrowserParent->GetOwnerElement();
if (NS_WARN_IF(thisTabParent->IsMozBrowser())) {
if (NS_WARN_IF(thisBrowserParent->IsMozBrowser())) {
return IPC_FAIL(this, "aThisTab is not a MozBrowser");
}
}
@ -4697,8 +4701,8 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
}
nsCOMPtr<nsIBrowserDOMWindow> browserDOMWin;
if (thisTabParent) {
browserDOMWin = thisTabParent->GetBrowserDOMWindow();
if (thisBrowserParent) {
browserDOMWin = thisBrowserParent->GetBrowserDOMWindow();
}
// If we haven't found a chrome window to open in, just use the most recently
@ -4723,10 +4727,10 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
MOZ_ASSERT(aOpenLocation == nsIBrowserDOMWindow::OPEN_NEWTAB ||
aOpenLocation == nsIBrowserDOMWindow::OPEN_NEWWINDOW);
// Read the origin attributes for the tab from the opener tabParent.
// Read the origin attributes for the tab from the opener browserParent.
OriginAttributes openerOriginAttributes;
if (thisTabParent) {
nsCOMPtr<nsILoadContext> loadContext = thisTabParent->GetLoadContext();
if (thisBrowserParent) {
nsCOMPtr<nsILoadContext> loadContext = thisBrowserParent->GetLoadContext();
loadContext->GetOriginAttributes(openerOriginAttributes);
} else if (Preferences::GetBool("browser.privatebrowsing.autostart")) {
openerOriginAttributes.mPrivateBrowsingId = 1;
@ -4762,7 +4766,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
if (NS_SUCCEEDED(aResult) && frameLoaderOwner) {
RefPtr<nsFrameLoader> frameLoader = frameLoaderOwner->GetFrameLoader();
if (frameLoader) {
aNewTabParent = frameLoader->GetRemoteTab();
aNewBrowserParent = frameLoader->GetRemoteTab();
// At this point, it's possible the inserted frameloader hasn't gone
// through layout yet. To ensure that the dimensions that we send down
// when telling the frameloader to display will be correct (instead of
@ -4792,13 +4796,13 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
}
aResult = pwwatch->OpenWindowWithRemoteTab(
thisTabParent, aFeatures, aCalledFromJS, aFullZoom, aNextRemoteTabId,
!aSetOpener, getter_AddRefs(aNewTabParent));
thisBrowserParent, aFeatures, aCalledFromJS, aFullZoom, aNextRemoteTabId,
!aSetOpener, getter_AddRefs(aNewBrowserParent));
if (NS_WARN_IF(NS_FAILED(aResult))) {
return IPC_OK();
}
MOZ_ASSERT(aNewTabParent);
MOZ_ASSERT(aNewBrowserParent);
// At this point, it's possible the inserted frameloader hasn't gone through
// layout yet. To ensure that the dimensions that we send down when telling
@ -4810,7 +4814,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
// so we scope this to avoid polluting the main function scope.
{
nsCOMPtr<Element> frameElement =
TabParent::GetFrom(aNewTabParent)->GetOwnerElement();
BrowserParent::GetFrom(aNewBrowserParent)->GetOwnerElement();
MOZ_ASSERT(frameElement);
RefPtr<nsFrameLoaderOwner> frameLoaderOwner = do_QueryObject(frameElement);
MOZ_ASSERT(frameLoaderOwner);
@ -4822,7 +4826,8 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
// If we were passed a name for the window which would override the default,
// we should send it down to the new tab.
if (nsContentUtils::IsOverridingWindowName(aName)) {
Unused << TabParent::GetFrom(aNewTabParent)->SendSetWindowName(aName);
Unused
<< BrowserParent::GetFrom(aNewBrowserParent)->SendSetWindowName(aName);
}
// Don't send down the OriginAttributes if the content process is handling
@ -4831,17 +4836,17 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
// If we send it down in the non-async case, then we might set the
// OriginAttributes after the document has already navigated.
if (!aSetOpener) {
Unused << TabParent::GetFrom(aNewTabParent)
Unused << BrowserParent::GetFrom(aNewBrowserParent)
->SendSetOriginAttributes(openerOriginAttributes);
}
if (aURIToLoad && aLoadURI) {
nsCOMPtr<mozIDOMWindowProxy> openerWindow;
if (aSetOpener && thisTabParent) {
openerWindow = thisTabParent->GetParentWindowOuter();
if (aSetOpener && thisBrowserParent) {
openerWindow = thisBrowserParent->GetParentWindowOuter();
}
nsCOMPtr<nsIBrowserDOMWindow> newBrowserDOMWin =
TabParent::GetFrom(aNewTabParent)->GetBrowserDOMWindow();
BrowserParent::GetFrom(aNewBrowserParent)->GetBrowserDOMWindow();
if (NS_WARN_IF(!newBrowserDOMWin)) {
aResult = NS_ERROR_ABORT;
return IPC_OK();
@ -4880,7 +4885,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
aResolve(cwi);
});
TabParent* newTab = TabParent::GetFrom(aNewTab);
BrowserParent* newTab = BrowserParent::GetFrom(aNewTab);
MOZ_ASSERT(newTab);
auto destroyNewTabOnError = MakeScopeExit([&] {
@ -4896,9 +4901,9 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
// we must have an opener.
newTab->SetHasContentOpener(true);
TabParent::AutoUseNewTab aunt(newTab, &cwi.urlToLoad());
BrowserParent::AutoUseNewTab aunt(newTab, &cwi.urlToLoad());
const uint64_t nextRemoteTabId = ++sNextRemoteTabId;
sNextTabParents.Put(nextRemoteTabId, newTab);
sNextBrowserParents.Put(nextRemoteTabId, newTab);
const nsCOMPtr<nsIURI> uriToLoad = DeserializeURI(aURIToLoad);
@ -4918,10 +4923,10 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
return IPC_OK();
}
if (sNextTabParents.GetAndRemove(nextRemoteTabId).valueOr(nullptr)) {
if (sNextBrowserParents.GetAndRemove(nextRemoteTabId).valueOr(nullptr)) {
cwi.windowOpened() = false;
}
MOZ_ASSERT(TabParent::GetFrom(newRemoteTab) == newTab);
MOZ_ASSERT(BrowserParent::GetFrom(newRemoteTab) == newTab);
newTab->SwapFrameScriptsFrom(cwi.frameScripts());
newTab->MaybeShowFrame();
@ -5240,13 +5245,13 @@ void ContentParent::SendGetFilesResponseAndForget(
}
void ContentParent::PaintTabWhileInterruptingJS(
TabParent* aTabParent, bool aForceRepaint,
BrowserParent* aBrowserParent, bool aForceRepaint,
const layers::LayersObserverEpoch& aEpoch) {
if (!mHangMonitorActor) {
return;
}
ProcessHangMonitor::PaintWhileInterruptingJS(mHangMonitorActor, aTabParent,
aForceRepaint, aEpoch);
ProcessHangMonitor::PaintWhileInterruptingJS(
mHangMonitorActor, aBrowserParent, aForceRepaint, aEpoch);
}
void ContentParent::UpdateCookieStatus(nsIChannel* aChannel) {
@ -5757,7 +5762,7 @@ void ContentParent::UnregisterRemoveWorkerActor() {
}
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
if (!cpm->GetTabParentCountByProcessId(ChildID()) &&
if (!cpm->GetBrowserParentCountByProcessId(ChildID()) &&
!ShouldKeepProcessAlive() && !TryToRecycle()) {
// In the case of normal shutdown, send a shutdown message to child to
// allow it to perform shutdown tasks.

View File

@ -103,7 +103,7 @@ namespace dom {
class BrowsingContextGroup;
class Element;
class TabParent;
class BrowserParent;
class ClonedMessageData;
class MemoryReport;
class TabContext;
@ -206,12 +206,12 @@ class ContentParent final : public PContentParent,
* should be the frame/iframe element with which this process will
* associated.
*/
static TabParent* CreateBrowser(const TabContext& aContext,
Element* aFrameElement,
BrowsingContext* aBrowsingContext,
ContentParent* aOpenerContentParent,
TabParent* aSameTabGroupAs,
uint64_t aNextRemoteTabId);
static BrowserParent* CreateBrowser(const TabContext& aContext,
Element* aFrameElement,
BrowsingContext* aBrowsingContext,
ContentParent* aOpenerContentParent,
BrowserParent* aSameTabGroupAs,
uint64_t aNextRemoteTabId);
static void GetAll(nsTArray<ContentParent*>& aArray);
@ -495,7 +495,7 @@ class ContentParent final : public PContentParent,
mozilla::ipc::IPCResult RecvFinishShutdown();
void MaybeInvokeDragSession(TabParent* aParent);
void MaybeInvokeDragSession(BrowserParent* aParent);
PContentPermissionRequestParent* AllocPContentPermissionRequestParent(
const InfallibleTArray<PermissionRequest>& aRequests,
@ -512,7 +512,7 @@ class ContentParent final : public PContentParent,
void ForkNewProcess(bool aBlocking);
mozilla::ipc::IPCResult RecvCreateWindow(
PBrowserParent* aThisTabParent, PBrowserParent* aNewTab,
PBrowserParent* aThisBrowserParent, PBrowserParent* aNewTab,
const uint32_t& aChromeFlags, const bool& aCalledFromJS,
const bool& aPositionSpecified, const bool& aSizeSpecified,
const Maybe<URIParams>& aURIToLoad, const nsCString& aFeatures,
@ -584,7 +584,8 @@ class ContentParent final : public PContentParent,
bool DeallocPURLClassifierParent(PURLClassifierParent* aActor);
// Use the PHangMonitor channel to ask the child to repaint a tab.
void PaintTabWhileInterruptingJS(TabParent* aTabParent, bool aForceRepaint,
void PaintTabWhileInterruptingJS(BrowserParent* aBrowserParent,
bool aForceRepaint,
const layers::LayersObserverEpoch& aEpoch);
// This function is called when we are about to load a document from an
@ -666,7 +667,7 @@ class ContentParent final : public PContentParent,
const bool& aSizeSpecified, nsIURI* aURIToLoad,
const nsCString& aFeatures, const float& aFullZoom,
uint64_t aNextRemoteTabId, const nsString& aName, nsresult& aResult,
nsCOMPtr<nsIRemoteTab>& aNewTabParent, bool* aWindowIsNew,
nsCOMPtr<nsIRemoteTab>& aNewBrowserParent, bool* aWindowIsNew,
int32_t& aOpenLocation, nsIPrincipal* aTriggeringPrincipal,
nsIReferrerInfo* aReferrerInfo, bool aLoadUri,
nsIContentSecurityPolicy* aCsp);
@ -1222,7 +1223,7 @@ class ContentParent final : public PContentParent,
Atomic<uint32_t> mRemoteWorkerActors;
// How many tabs we're waiting to finish their destruction
// sequence. Precisely, how many TabParents have called
// sequence. Precisely, how many BrowserParents have called
// NotifyTabDestroying() but not called NotifyTabDestroyed().
int32_t mNumDestroyingTabs;
@ -1312,7 +1313,7 @@ class ContentParent final : public PContentParent,
RefPtr<mozilla::dom::ProcessMessageManager> mMessageManager;
static uint64_t sNextRemoteTabId;
static nsDataHashtable<nsUint64HashKey, TabParent*> sNextTabParents;
static nsDataHashtable<nsUint64HashKey, BrowserParent*> sNextBrowserParents;
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
// When set to true, indicates that content processes should

View File

@ -6,7 +6,7 @@
#include "ContentProcessManager.h"
#include "ContentParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/ClearOnShutdown.h"
@ -254,8 +254,8 @@ ContentParentId ContentProcessManager::GetTabProcessId(const TabId& aTabId) {
return tabProcessIter->second;
}
already_AddRefed<TabParent>
ContentProcessManager::GetTabParentByProcessAndTabId(
already_AddRefed<BrowserParent>
ContentProcessManager::GetBrowserParentByProcessAndTabId(
const ContentParentId& aChildCpId, const TabId& aChildTabId) {
MOZ_ASSERT(NS_IsMainThread());
@ -268,7 +268,7 @@ ContentProcessManager::GetTabParentByProcessAndTabId(
const ManagedContainer<PBrowserParent>& browsers =
iter->second.mCp->ManagedPBrowserParent();
for (auto iter = browsers.ConstIter(); !iter.Done(); iter.Next()) {
RefPtr<TabParent> tab = TabParent::GetFrom(iter.Get()->GetKey());
RefPtr<BrowserParent> tab = BrowserParent::GetFrom(iter.Get()->GetKey());
if (tab->GetTabId() == aChildTabId) {
return tab.forget();
}
@ -277,8 +277,8 @@ ContentProcessManager::GetTabParentByProcessAndTabId(
return nullptr;
}
already_AddRefed<TabParent>
ContentProcessManager::GetTopLevelTabParentByProcessAndTabId(
already_AddRefed<BrowserParent>
ContentProcessManager::GetTopLevelBrowserParentByProcessAndTabId(
const ContentParentId& aChildCpId, const TabId& aChildTabId) {
MOZ_ASSERT(NS_IsMainThread());
@ -287,7 +287,7 @@ ContentProcessManager::GetTopLevelTabParentByProcessAndTabId(
ContentParentId currentCpId;
TabId currentTabId;
// To get the ContentParentId and the TabParentId on upper level
// To get the ContentParentId and the BrowserParentId on upper level
ContentParentId parentCpId = aChildCpId;
TabId openerTabId = aChildTabId;
@ -305,11 +305,11 @@ ContentProcessManager::GetTopLevelTabParentByProcessAndTabId(
}
} while (parentCpId);
// Get the top level TabParent by the current ContentParentId and TabId
return GetTabParentByProcessAndTabId(currentCpId, currentTabId);
// Get the top level BrowserParent by the current ContentParentId and TabId
return GetBrowserParentByProcessAndTabId(currentCpId, currentTabId);
}
nsTArray<TabId> ContentProcessManager::GetTabParentsByProcessId(
nsTArray<TabId> ContentProcessManager::GetBrowserParentsByProcessId(
const ContentParentId& aChildCpId) {
MOZ_ASSERT(NS_IsMainThread());
@ -328,7 +328,7 @@ nsTArray<TabId> ContentProcessManager::GetTabParentsByProcessId(
return tabIdList;
}
uint32_t ContentProcessManager::GetTabParentCountByProcessId(
uint32_t ContentProcessManager::GetBrowserParentCountByProcessId(
const ContentParentId& aChildCpId) {
MOZ_ASSERT(NS_IsMainThread());

View File

@ -111,38 +111,39 @@ class ContentProcessManager final {
ContentParentId GetTabProcessId(const TabId& aTabId);
/**
* Get all TabParents' Ids managed by the givent content process.
* Return empty array when TabParent couldn't be found via aChildCpId
* Get all BrowserParents' Ids managed by the givent content process.
* Return empty array when BrowserParent couldn't be found via aChildCpId
*/
nsTArray<TabId> GetTabParentsByProcessId(const ContentParentId& aChildCpId);
nsTArray<TabId> GetBrowserParentsByProcessId(
const ContentParentId& aChildCpId);
/**
* Get the number of TabParents managed by the givent content process.
* Return 0 when TabParent couldn't be found via aChildCpId.
* Get the number of BrowserParents managed by the givent content process.
* Return 0 when BrowserParent couldn't be found via aChildCpId.
*/
uint32_t GetTabParentCountByProcessId(const ContentParentId& aChildCpId);
uint32_t GetBrowserParentCountByProcessId(const ContentParentId& aChildCpId);
/**
* Get the TabParent by the given content process and tab id.
* Return nullptr when TabParent couldn't be found via aChildCpId
* Get the BrowserParent by the given content process and tab id.
* Return nullptr when BrowserParent couldn't be found via aChildCpId
* and aChildTabId.
* (or probably because the TabParent is not in the chrome process)
* (or probably because the BrowserParent is not in the chrome process)
*/
already_AddRefed<TabParent> GetTabParentByProcessAndTabId(
already_AddRefed<BrowserParent> GetBrowserParentByProcessAndTabId(
const ContentParentId& aChildCpId, const TabId& aChildTabId);
/**
* Get the TabParent on top level by the given content process and tab id.
* Get the BrowserParent on top level by the given content process and tab id.
*
* This function return the TabParent belong to the chrome process,
* called top-level TabParent here, by given aChildCpId and aChildTabId.
* This function return the BrowserParent belong to the chrome process,
* called top-level BrowserParent here, by given aChildCpId and aChildTabId.
* The given aChildCpId and aChildTabId are related to a content process
* and a tab respectively. In nested-oop, the top-level TabParent isn't
* and a tab respectively. In nested-oop, the top-level BrowserParent isn't
* always the opener tab of the given tab in content process. This function
* will call GetTabParentByProcessAndTabId iteratively until the Tab returned
* is belong to the chrome process.
* will call GetBrowserParentByProcessAndTabId iteratively until the Tab
* returned is belong to the chrome process.
*/
already_AddRefed<TabParent> GetTopLevelTabParentByProcessAndTabId(
already_AddRefed<BrowserParent> GetTopLevelBrowserParentByProcessAndTabId(
const ContentParentId& aChildCpId, const TabId& aChildTabId);
private:

View File

@ -16,7 +16,7 @@
#include "mozilla/dom/FileSystemSecurity.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/IPCBlobUtils.h"
using mozilla::Unused;
@ -128,7 +128,7 @@ void FilePickerParent::IORunnable::Destroy() { mFilePickerParent = nullptr; }
void FilePickerParent::SendFilesOrDirectories(
const nsTArray<BlobImplOrString>& aData) {
ContentParent* parent = TabParent::GetFrom(Manager())->Manager();
ContentParent* parent = BrowserParent::GetFrom(Manager())->Manager();
if (mMode == nsIFilePicker::modeGetFolder) {
MOZ_ASSERT(aData.Length() <= 1);
@ -223,7 +223,7 @@ bool FilePickerParent::CreateFilePicker() {
return false;
}
Element* element = TabParent::GetFrom(Manager())->GetOwnerElement();
Element* element = BrowserParent::GetFrom(Manager())->GetOwnerElement();
if (!element) {
return false;
}

View File

@ -18,7 +18,7 @@ namespace mozilla {
namespace dom {
class BrowsingContext;
class ContentParent;
class TabParent;
class BrowserParent;
template <typename T>
class IdType {
@ -41,7 +41,7 @@ class IdType {
uint64_t mId;
};
typedef IdType<TabParent> TabId;
typedef IdType<BrowserParent> TabId;
typedef IdType<ContentParent> ContentParentId;
typedef IdType<BrowsingContext> BrowsingContextId;
} // namespace dom

View File

@ -70,8 +70,8 @@ void JSWindowActorParent::SendRawMessage(const JSWindowActorMessageMeta& aMeta,
// Cross-process case - send data over WindowGlobalParent to other side.
ClonedMessageData msgData;
RefPtr<TabParent> tabParent = mManager->GetTabParent();
ContentParent* cp = tabParent->Manager();
RefPtr<BrowserParent> browserParent = mManager->GetBrowserParent();
ContentParent* cp = browserParent->Manager();
if (NS_WARN_IF(!aData.BuildClonedMessageDataForParent(cp, msgData))) {
aRv.Throw(NS_ERROR_DOM_DATA_CLONE_ERR);
return;

View File

@ -15,7 +15,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/ipc/TaskFactory.h"
#include "mozilla/Monitor.h"
#include "mozilla/plugins/PluginBridge.h"
@ -231,7 +231,8 @@ class HangMonitorParent : public PProcessHangMonitorParent,
void Shutdown();
void PaintWhileInterruptingJS(dom::TabParent* aTabParent, bool aForceRepaint,
void PaintWhileInterruptingJS(dom::BrowserParent* aBrowserParent,
bool aForceRepaint,
const LayersObserverEpoch& aEpoch);
void TerminateScript(bool aTerminateGlobal);
@ -632,7 +633,7 @@ void HangMonitorParent::ShutdownOnThread() {
}
void HangMonitorParent::PaintWhileInterruptingJS(
dom::TabParent* aTab, bool aForceRepaint,
dom::BrowserParent* aTab, bool aForceRepaint,
const LayersObserverEpoch& aEpoch) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
if (sShouldPaintWhileInterruptingJS) {
@ -866,7 +867,7 @@ HangMonitoredProcess::GetScriptBrowser(Element** aBrowser) {
nsTArray<PBrowserParent*> tabs;
mContentParent->ManagedPBrowserParent(tabs);
for (size_t i = 0; i < tabs.Length(); i++) {
TabParent* tp = TabParent::GetFrom(tabs[i]);
BrowserParent* tp = BrowserParent::GetFrom(tabs[i]);
if (tp->GetTabId() == tabId) {
RefPtr<Element> node = tp->GetOwnerElement();
node.forget(aBrowser);
@ -1019,7 +1020,7 @@ HangMonitoredProcess::IsReportForBrowser(nsFrameLoader* aFrameLoader,
NS_ENSURE_STATE(aFrameLoader);
TabParent* tp = TabParent::GetFrom(aFrameLoader);
BrowserParent* tp = BrowserParent::GetFrom(aFrameLoader);
if (!tp) {
*aResult = false;
return NS_OK;
@ -1225,11 +1226,11 @@ void ProcessHangMonitor::ClearHang() {
/* static */
void ProcessHangMonitor::PaintWhileInterruptingJS(
PProcessHangMonitorParent* aParent, dom::TabParent* aTabParent,
PProcessHangMonitorParent* aParent, dom::BrowserParent* aBrowserParent,
bool aForceRepaint, const layers::LayersObserverEpoch& aEpoch) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
auto parent = static_cast<HangMonitorParent*>(aParent);
parent->PaintWhileInterruptingJS(aTabParent, aForceRepaint, aEpoch);
parent->PaintWhileInterruptingJS(aBrowserParent, aForceRepaint, aEpoch);
}
/* static */

View File

@ -21,7 +21,7 @@ namespace mozilla {
namespace dom {
class ContentParent;
class TabParent;
class BrowserParent;
} // namespace dom
namespace layers {
@ -49,7 +49,7 @@ class ProcessHangMonitor final : public nsIObserver {
static void ClearHang();
static void PaintWhileInterruptingJS(
PProcessHangMonitorParent* aParent, dom::TabParent* aTab,
PProcessHangMonitorParent* aParent, dom::BrowserParent* aTab,
bool aForceRepaint, const layers::LayersObserverEpoch& aEpoch);
static void ClearPaintWhileInterruptingJS(
const layers::LayersObserverEpoch& aEpoch);

View File

@ -8,7 +8,7 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/Hal.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Preferences.h"
@ -140,7 +140,7 @@ class ProcessPriorityManagerImpl final : public nsIObserver,
ParticularProcessPriorityManager* aParticularManager,
hal::ProcessPriority aOldPriority);
void TabActivityChanged(TabParent* aTabParent, bool aIsActive);
void TabActivityChanged(BrowserParent* aBrowserParent, bool aIsActive);
private:
static bool sPrefsEnabled;
@ -234,7 +234,7 @@ class ParticularProcessPriorityManager final : public WakeLockObserver,
const nsAutoCString& NameWithComma();
void OnRemoteBrowserFrameShown(nsISupports* aSubject);
void OnTabParentDestroyed(nsISupports* aSubject);
void OnBrowserParentDestroyed(nsISupports* aSubject);
ProcessPriority CurrentPriority();
ProcessPriority ComputePriority();
@ -249,7 +249,7 @@ class ParticularProcessPriorityManager final : public WakeLockObserver,
void ResetPriorityNow();
void SetPriorityNow(ProcessPriority aPriority);
void TabActivityChanged(TabParent* aTabParent, bool aIsActive);
void TabActivityChanged(BrowserParent* aBrowserParent, bool aIsActive);
void ShutDown();
@ -286,7 +286,7 @@ class ParticularProcessPriorityManager final : public WakeLockObserver,
nsCOMPtr<nsITimer> mResetPriorityTimer;
// This hashtable contains the list of active TabId for this process.
nsTHashtable<nsUint64HashKey> mActiveTabParents;
nsTHashtable<nsUint64HashKey> mActiveBrowserParents;
};
/* static */
@ -486,10 +486,10 @@ void ProcessPriorityManagerImpl::NotifyProcessPriorityChanged(
}
}
void ProcessPriorityManagerImpl::TabActivityChanged(TabParent* aTabParent,
bool aIsActive) {
void ProcessPriorityManagerImpl::TabActivityChanged(
BrowserParent* aBrowserParent, bool aIsActive) {
RefPtr<ParticularProcessPriorityManager> pppm =
GetParticularProcessPriorityManager(aTabParent->Manager());
GetParticularProcessPriorityManager(aBrowserParent->Manager());
if (!pppm) {
return;
}
@ -497,7 +497,7 @@ void ProcessPriorityManagerImpl::TabActivityChanged(TabParent* aTabParent,
Telemetry::ScalarAdd(
Telemetry::ScalarID::DOM_CONTENTPROCESS_OS_PRIORITY_CHANGE_CONSIDERED, 1);
pppm->TabActivityChanged(aTabParent, aIsActive);
pppm->TabActivityChanged(aBrowserParent, aIsActive);
}
NS_IMPL_ISUPPORTS(ParticularProcessPriorityManager, nsIObserver,
@ -620,7 +620,7 @@ ParticularProcessPriorityManager::Observe(nsISupports* aSubject,
if (topic.EqualsLiteral("remote-browser-shown")) {
OnRemoteBrowserFrameShown(aSubject);
} else if (topic.EqualsLiteral("ipc:browser-destroyed")) {
OnTabParentDestroyed(aSubject);
OnBrowserParentDestroyed(aSubject);
} else {
MOZ_ASSERT(false);
}
@ -662,7 +662,7 @@ void ParticularProcessPriorityManager::OnRemoteBrowserFrameShown(
RefPtr<nsFrameLoader> fl = do_QueryObject(aSubject);
NS_ENSURE_TRUE_VOID(fl);
TabParent* tp = TabParent::GetFrom(fl);
BrowserParent* tp = BrowserParent::GetFrom(fl);
NS_ENSURE_TRUE_VOID(tp);
MOZ_ASSERT(XRE_IsParentProcess());
@ -681,13 +681,13 @@ void ParticularProcessPriorityManager::OnRemoteBrowserFrameShown(
}
}
void ParticularProcessPriorityManager::OnTabParentDestroyed(
void ParticularProcessPriorityManager::OnBrowserParentDestroyed(
nsISupports* aSubject) {
nsCOMPtr<nsIRemoteTab> tp = do_QueryInterface(aSubject);
NS_ENSURE_TRUE_VOID(tp);
MOZ_ASSERT(XRE_IsParentProcess());
if (TabParent::GetFrom(tp)->Manager() != mContentParent) {
if (BrowserParent::GetFrom(tp)->Manager() != mContentParent) {
return;
}
@ -696,7 +696,7 @@ void ParticularProcessPriorityManager::OnTabParentDestroyed(
return;
}
mActiveTabParents.RemoveEntry(tabId);
mActiveBrowserParents.RemoveEntry(tabId);
ResetPriority();
}
@ -762,7 +762,7 @@ ProcessPriority ParticularProcessPriorityManager::CurrentPriority() {
}
ProcessPriority ParticularProcessPriorityManager::ComputePriority() {
if (!mActiveTabParents.IsEmpty() ||
if (!mActiveBrowserParents.IsEmpty() ||
mContentParent->GetRemoteType().EqualsLiteral(EXTENSION_REMOTE_TYPE) ||
mHoldsPlayingAudioWakeLock) {
return PROCESS_PRIORITY_FOREGROUND;
@ -824,14 +824,14 @@ void ParticularProcessPriorityManager::SetPriorityNow(
ProcessPriorityToString(mPriority));
}
void ParticularProcessPriorityManager::TabActivityChanged(TabParent* aTabParent,
bool aIsActive) {
MOZ_ASSERT(aTabParent);
void ParticularProcessPriorityManager::TabActivityChanged(
BrowserParent* aBrowserParent, bool aIsActive) {
MOZ_ASSERT(aBrowserParent);
if (!aIsActive) {
mActiveTabParents.RemoveEntry(aTabParent->GetTabId());
mActiveBrowserParents.RemoveEntry(aBrowserParent->GetTabId());
} else {
mActiveTabParents.PutEntry(aTabParent->GetTabId());
mActiveBrowserParents.PutEntry(aBrowserParent->GetTabId());
}
ResetPriority();
@ -989,9 +989,9 @@ bool ProcessPriorityManager::CurrentProcessIsForeground() {
}
/* static */
void ProcessPriorityManager::TabActivityChanged(TabParent* aTabParent,
void ProcessPriorityManager::TabActivityChanged(BrowserParent* aBrowserParent,
bool aIsActive) {
MOZ_ASSERT(aTabParent);
MOZ_ASSERT(aBrowserParent);
ProcessPriorityManagerImpl* singleton =
ProcessPriorityManagerImpl::GetSingleton();
@ -999,7 +999,7 @@ void ProcessPriorityManager::TabActivityChanged(TabParent* aTabParent,
return;
}
singleton->TabActivityChanged(aTabParent, aIsActive);
singleton->TabActivityChanged(aBrowserParent, aIsActive);
}
} // namespace mozilla

View File

@ -12,7 +12,7 @@
namespace mozilla {
namespace dom {
class ContentParent;
class TabParent;
class BrowserParent;
} // namespace dom
/**
@ -68,7 +68,8 @@ class ProcessPriorityManager final {
*/
static bool CurrentProcessIsForeground();
static void TabActivityChanged(dom::TabParent* aTabParent, bool aIsActive);
static void TabActivityChanged(dom::BrowserParent* aBrowserParent,
bool aIsActive);
private:
ProcessPriorityManager();

View File

@ -14,7 +14,7 @@
#endif
#include "Layers.h"
#include "ContentChild.h"
#include "TabParent.h"
#include "BrowserParent.h"
#include "js/JSON.h"
#include "mozilla/Preferences.h"
#include "mozilla/BrowserElementParent.h"
@ -1096,8 +1096,8 @@ void TabChild::DoFakeShow(const ShowInfo& aShowInfo) {
void TabChild::ApplyShowInfo(const ShowInfo& aInfo) {
// Even if we already set real show info, the dpi / rounding & scale may still
// be invalid (if TabParent wasn't able to get widget it would just send 0).
// So better to always set up-to-date values here.
// be invalid (if BrowserParent wasn't able to get widget it would just send
// 0). So better to always set up-to-date values here.
if (aInfo.dpi() > 0) {
mPuppetWidget->UpdateBackingScaleCache(aInfo.dpi(), aInfo.widgetRounding(),
aInfo.defaultScale());
@ -2430,8 +2430,8 @@ mozilla::ipc::IPCResult TabChild::RecvRenderLayers(
MOZ_ASSERT(lm);
// We send the current layer observer epoch to the compositor so that
// TabParent knows whether a layer update notification corresponds to the
// latest RecvRenderLayers request that was made.
// BrowserParent knows whether a layer update notification corresponds to
// the latest RecvRenderLayers request that was made.
lm->SetLayersObserverEpoch(mLayersObserverEpoch);
}
@ -2995,12 +2995,12 @@ void TabChild::ReinitRendering() {
// Before we establish a new PLayerTransaction, we must connect our layer tree
// id, CompositorBridge, and the widget compositor all together again.
// Normally this happens in TabParent before TabChild is given rendering
// Normally this happens in BrowserParent before TabChild is given rendering
// information.
//
// In this case, we will send a sync message to our TabParent, which in turn
// will send a sync message to the Compositor of the widget owning this tab.
// This guarantees the correct association is in place before our
// In this case, we will send a sync message to our BrowserParent, which in
// turn will send a sync message to the Compositor of the widget owning this
// tab. This guarantees the correct association is in place before our
// PLayerTransaction constructor message arrives on the cross-process
// compositor bridge.
CompositorOptions options;
@ -3077,7 +3077,7 @@ mozilla::ipc::IPCResult TabChild::RecvRequestNotifyAfterRemotePaint() {
// Tell the CompositorBridgeChild that, when it gets a RemotePaintIsReady
// message that it should forward it us so that we can bounce it to our
// TabParent.
// BrowserParent.
compositor->RequestNotifyAfterRemotePaint(this);
return IPC_OK();
}

View File

@ -645,7 +645,7 @@ class TabChild final : public TabChildBase,
WindowsHandle WidgetNativeData() { return mWidgetNativeData; }
// The transform from the coordinate space of this TabChild to the coordinate
// space of the native window its TabParent is in.
// space of the native window its BrowserParent is in.
mozilla::LayoutDeviceToLayoutDeviceMatrix4x4
GetChildToParentConversionMatrix() const;

View File

@ -6,7 +6,7 @@
#include "mozilla/dom/TabContext.h"
#include "mozilla/dom/PTabContext.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/StaticPrefs.h"
#include "nsIScriptSecurityManager.h"
@ -142,7 +142,8 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
TabContext* context;
if (ipcContext.opener().type() == PBrowserOrId::TPBrowserParent) {
context = TabParent::GetFrom(ipcContext.opener().get_PBrowserParent());
context =
BrowserParent::GetFrom(ipcContext.opener().get_PBrowserParent());
if (!context) {
mInvalidReason =
"Child is-browser process tried to "
@ -151,10 +152,10 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
}
if (context->IsMozBrowserElement() &&
!ipcContext.isMozBrowserElement()) {
// If the TabParent corresponds to a browser element, then it can only
// open other browser elements, for security reasons. We should have
// checked this before calling the TabContext constructor, so this is
// a fatal error.
// If the BrowserParent corresponds to a browser element, then it can
// only open other browser elements, for security reasons. We should
// have checked this before calling the TabContext constructor, so
// this is a fatal error.
mInvalidReason =
"Child is-browser process tried to "
"open a non-browser tab.";

View File

@ -20,8 +20,8 @@ class IPCTabContext;
/**
* TabContext encapsulates information about an iframe that may be a mozbrowser.
*
* TabParent and TabChild both inherit from TabContext, and you can also have
* standalone TabContext objects.
* BrowserParent and TabChild both inherit from TabContext, and you can also
* have standalone TabContext objects.
*
* This class is immutable except by calling one of the protected
* SetTabContext*() methods (and those methods can only be called once). See

View File

@ -11,7 +11,7 @@
#include "mozilla/dom/BrowserBridgeParent.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/WindowGlobalActorsBinding.h"
#include "mozilla/dom/WindowGlobalChild.h"
#include "mozilla/dom/ChromeUtils.h"
@ -114,7 +114,7 @@ void WindowGlobalParent::Init(const WindowGlobalInit& aInit) {
} else {
// In the cross-process case, we can get the frame element from our manager.
MOZ_ASSERT(Manager()->GetProtocolTypeId() == PBrowserMsgStart);
frameElement = static_cast<TabParent*>(Manager())->GetOwnerElement();
frameElement = static_cast<BrowserParent*>(Manager())->GetOwnerElement();
}
// Extract the nsFrameLoader from the current frame element. We may not have a
@ -147,11 +147,11 @@ already_AddRefed<WindowGlobalChild> WindowGlobalParent::GetChildActor() {
return do_AddRef(static_cast<WindowGlobalChild*>(otherSide));
}
already_AddRefed<TabParent> WindowGlobalParent::GetRemoteTab() {
already_AddRefed<BrowserParent> WindowGlobalParent::GetRemoteTab() {
if (IsInProcess() || mIPCClosed) {
return nullptr;
}
return do_AddRef(static_cast<TabParent*>(Manager()));
return do_AddRef(static_cast<BrowserParent*>(Manager()));
}
IPCResult WindowGlobalParent::RecvUpdateDocumentURI(nsIURI* aURI) {
@ -168,8 +168,8 @@ IPCResult WindowGlobalParent::RecvBecomeCurrentWindowGlobal() {
IPCResult WindowGlobalParent::RecvDestroy() {
if (!mIPCClosed) {
RefPtr<TabParent> tabParent = GetRemoteTab();
if (!tabParent || !tabParent->IsDestroyed()) {
RefPtr<BrowserParent> browserParent = GetRemoteTab();
if (!browserParent || !browserParent->IsDestroyed()) {
Unused << Send__delete__(this);
}
}
@ -213,8 +213,8 @@ already_AddRefed<JSWindowActorParent> WindowGlobalParent::GetActor(
}
nsAutoString remoteType;
if (RefPtr<TabParent> tabParent = GetRemoteTab()) {
remoteType = tabParent->Manager()->GetRemoteType();
if (RefPtr<BrowserParent> browserParent = GetRemoteTab()) {
remoteType = browserParent->Manager()->GetRemoteType();
} else {
remoteType = VoidString();
}
@ -277,12 +277,12 @@ already_AddRefed<Promise> WindowGlobalParent::ChangeFrameRemoteness(
}
// If we got a BrowserBridgeParent, the frame is out-of-process, so pull
// our target TabParent off of it. Otherwise, it's an in-process frame,
// so we can directly use ours.
// our target BrowserParent off of it. Otherwise, it's an in-process
// frame, so we can directly use ours.
if (bridge) {
promise->MaybeResolve(bridge->GetTabParent());
promise->MaybeResolve(bridge->GetBrowserParent());
} else {
promise->MaybeResolve(tabParent);
promise->MaybeResolve(browserParent);
}
};

View File

@ -9,7 +9,7 @@
#include "mozilla/RefPtr.h"
#include "mozilla/dom/PWindowGlobalParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "nsRefPtrHashtable.h"
#include "nsWrapperCache.h"
#include "nsISupports.h"
@ -63,7 +63,7 @@ class WindowGlobalParent final : public nsISupports,
// Get this actor's manager if it is not an in-process actor. Returns
// |nullptr| if the actor has been torn down, or is in-process.
already_AddRefed<TabParent> GetRemoteTab();
already_AddRefed<BrowserParent> GetRemoteTab();
void ReceiveRawMessage(const JSWindowActorMessageMeta& aMeta,
ipc::StructuredCloneData&& aData);
@ -78,8 +78,8 @@ class WindowGlobalParent final : public nsISupports,
// Get the root nsFrameLoader object for the tree of BrowsingContext nodes
// which this WindowGlobal is a part of. This will be the nsFrameLoader
// holding the TabParent for remote tabs, and the root content frameloader for
// non-remote tabs.
// holding the BrowserParent for remote tabs, and the root content frameloader
// for non-remote tabs.
nsFrameLoader* GetRootFrameLoader() { return mFrameLoader; }
// The current URI which loaded in the document.

View File

@ -36,6 +36,7 @@ EXPORTS.mozilla.dom.ipc += [
EXPORTS.mozilla.dom += [
'BrowserBridgeChild.h',
'BrowserBridgeParent.h',
'BrowserParent.h',
'CoalescedInputData.h',
'CoalescedMouseData.h',
'CoalescedWheelData.h',
@ -59,7 +60,6 @@ EXPORTS.mozilla.dom += [
'TabChild.h',
'TabContext.h',
'TabMessageUtils.h',
'TabParent.h',
'URLClassifierChild.h',
'URLClassifierParent.h',
'WindowGlobalChild.h',
@ -76,6 +76,7 @@ EXPORTS.mozilla += [
UNIFIED_SOURCES += [
'BrowserBridgeChild.cpp',
'BrowserBridgeParent.cpp',
'BrowserParent.cpp',
'CoalescedMouseData.cpp',
'CoalescedWheelData.cpp',
'ColorPickerParent.cpp',
@ -104,7 +105,6 @@ UNIFIED_SOURCES += [
'TabChild.cpp',
'TabContext.cpp',
'TabMessageUtils.cpp',
'TabParent.cpp',
'URLClassifierParent.cpp',
'WindowGlobalChild.cpp',
'WindowGlobalParent.cpp',

View File

@ -10,7 +10,7 @@
#include "nsJSUtils.h"
#include "TCPSocketParent.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
namespace mozilla {
namespace dom {

View File

@ -12,7 +12,7 @@
#include "mozilla/net/NeckoCommon.h"
#include "mozilla/net/PNeckoParent.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/HoldDropJSObjects.h"
#include "nsISocketTransportService.h"
#include "nsISocketTransport.h"

View File

@ -874,7 +874,7 @@ bool nsPluginInstanceOwner::RequestCommitOrCancel(bool aCommitted) {
// call nsIWidget::NotifyIME() directly from here.
IMEStateManager::NotifyIME(aCommitted ? widget::REQUEST_TO_COMMIT_COMPOSITION
: widget::REQUEST_TO_CANCEL_COMPOSITION,
widget, composition->GetTabParent());
widget, composition->GetBrowserParent());
// FYI: This instance may have been destroyed. Be careful if you need to
// access members of this class.
return true;

View File

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "PluginWidgetParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/ContentParent.h"
#include "nsComponentManagerUtils.h"
#include "nsWidgetsCID.h"
@ -53,8 +53,8 @@ PluginWidgetParent::~PluginWidgetParent() {
KillWidget();
}
mozilla::dom::TabParent* PluginWidgetParent::GetTabParent() {
return static_cast<mozilla::dom::TabParent*>(Manager());
mozilla::dom::BrowserParent* PluginWidgetParent::GetBrowserParent() {
return static_cast<mozilla::dom::BrowserParent*>(Manager());
}
void PluginWidgetParent::SetParent(nsIWidget* aParent) {
@ -83,7 +83,7 @@ mozilla::ipc::IPCResult PluginWidgetParent::RecvCreate(
*aResult = mWidget ? NS_OK : NS_ERROR_FAILURE;
// This returns the top level window widget
nsCOMPtr<nsIWidget> parentWidget = GetTabParent()->GetWidget();
nsCOMPtr<nsIWidget> parentWidget = GetBrowserParent()->GetWidget();
// If this fails, bail.
if (!parentWidget) {
*aResult = NS_ERROR_NOT_AVAILABLE;
@ -131,7 +131,7 @@ void PluginWidgetParent::ActorDestroy(ActorDestroyReason aWhy) {
KillWidget();
}
// Called by TabParent's Destroy() in response to an early tear down (Early
// Called by BrowserParent's Destroy() in response to an early tear down (Early
// in that this is happening before layout in the child has had a chance
// to destroy the child widget.) when the tab is closing.
void PluginWidgetParent::ParentDestroy() {

View File

@ -17,7 +17,7 @@
namespace mozilla {
namespace dom {
class TabParent;
class BrowserParent;
} // namespace dom
namespace plugins {
@ -48,7 +48,7 @@ class PluginWidgetParent : public PPluginWidgetParent {
private:
// The tab our connection is associated with.
mozilla::dom::TabParent* GetTabParent();
mozilla::dom::BrowserParent* GetBrowserParent();
private:
void KillWidget();

View File

@ -6,7 +6,7 @@
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/HTMLIFrameElementBinding.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/Logging.h"
#include "mozilla/Move.h"
#include "mozilla/Preferences.h"
@ -1501,15 +1501,15 @@ void PresentationPresentingInfo::ResolvedCallback(
return;
}
RefPtr<TabParent> tabParent = TabParent::GetFrom(frameLoader);
if (tabParent) {
RefPtr<BrowserParent> browserParent = BrowserParent::GetFrom(frameLoader);
if (browserParent) {
// OOP frame
// Notify the content process that a receiver page has launched, so it can
// start monitoring the loading progress.
mContentParent = tabParent->Manager();
Unused << NS_WARN_IF(
!static_cast<ContentParent*>(mContentParent.get())
->SendNotifyPresentationReceiverLaunched(tabParent, mSessionId));
mContentParent = browserParent->Manager();
Unused << NS_WARN_IF(!static_cast<ContentParent*>(mContentParent.get())
->SendNotifyPresentationReceiverLaunched(
browserParent, mSessionId));
} else {
// In-process frame
IgnoredErrorResult error;

View File

@ -7,7 +7,7 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/dom/PPresentation.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/ipc/InputStreamUtils.h"
#include "mozilla/ipc/URIUtils.h"
#include "nsGlobalWindow.h"
@ -65,7 +65,7 @@ PresentationIPCService::StartSession(
nsPIDOMWindowInner* window =
nsGlobalWindowInner::GetInnerWindowWithId(aWindowId);
TabId tabId = TabParent::GetTabIdFrom(window->GetDocShell());
TabId tabId = BrowserParent::GetTabIdFrom(window->GetDocShell());
return SendRequest(
aCallback,

View File

@ -359,8 +359,8 @@ nsresult PresentationRequestParent::DoRequest(
RefPtr<EventTarget> eventTarget;
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
RefPtr<TabParent> tp =
cpm->GetTopLevelTabParentByProcessAndTabId(mChildId, aRequest.tabId());
RefPtr<BrowserParent> tp = cpm->GetTopLevelBrowserParentByProcessAndTabId(
mChildId, aRequest.tabId());
if (tp) {
eventTarget = tp->GetOwnerElement();
}

View File

@ -24,7 +24,7 @@
// reference. Normal deletion occurs when the XPCOM object is being
// destroyed or after an InitFailure is received and handled.
//
// See also: TabParent::StartPersistence.
// See also: BrowserParent::StartPersistence.
namespace mozilla {

View File

@ -19,7 +19,7 @@
#include "mozilla/dom/HTMLTextAreaElement.h"
#include "mozilla/dom/NodeFilterBinding.h"
#include "mozilla/dom/ProcessingInstruction.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/TreeWalker.h"
#include "mozilla/Unused.h"
#include "nsComponentManagerUtils.h"

View File

@ -54,7 +54,7 @@
# include "nsIBidiKeyboard.h" // for nsIBidiKeyboard
#endif
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
class nsPresContext;
@ -880,7 +880,7 @@ bool EditorEventListener::CanDrop(DragEvent* aEvent) {
// If the source node is a remote browser, treat this as coming from a
// different document and allow the drop.
nsCOMPtr<nsIContent> sourceContent = do_QueryInterface(sourceNode);
TabParent* tp = TabParent::GetFrom(sourceContent);
BrowserParent* tp = BrowserParent::GetFrom(sourceContent);
if (tp) {
return true;
}

View File

@ -8,7 +8,7 @@
#include "mozilla/dom/ContentProcessManager.h"
#include "mozilla/dom/ImageBitmap.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/gfx/DrawEventRecorder.h"
#include "mozilla/gfx/InlineTranslator.h"
#include "mozilla/PresShell.h"
@ -238,7 +238,8 @@ void CrossProcessPaint::QueueRootPaint(dom::TabId aId, const IntRect& aRect,
dom::ContentProcessManager* cpm = dom::ContentProcessManager::GetSingleton();
dom::ContentParentId cpId = cpm->GetTabProcessId(aId);
RefPtr<dom::TabParent> tab = cpm->GetTabParentByProcessAndTabId(cpId, aId);
RefPtr<dom::BrowserParent> tab =
cpm->GetBrowserParentByProcessAndTabId(cpId, aId);
tab->RequestRootPaint(this, aRect, aScale, aBackgroundColor);
// This will always be the first paint, so the constructor will already have
@ -253,7 +254,8 @@ void CrossProcessPaint::QueueSubPaint(dom::TabId aId) {
dom::ContentProcessManager* cpm = dom::ContentProcessManager::GetSingleton();
dom::ContentParentId cpId = cpm->GetTabProcessId(aId);
RefPtr<dom::TabParent> tab = cpm->GetTabParentByProcessAndTabId(cpId, aId);
RefPtr<dom::BrowserParent> tab =
cpm->GetBrowserParentByProcessAndTabId(cpId, aId);
tab->RequestSubPaint(this, mScale, mBackgroundColor);
mPendingFragments += 1;

View File

@ -546,7 +546,7 @@ void GPUProcessManager::HandleProcessLost() {
// (a) [CONTENT] ContentChild::RecvReinitRendering
// (b) [CONTENT] TabChild::ReinitRendering
// (c) [CONTENT] TabChild::SendEnsureLayersConnected
// (d) [UI] TabParent::RecvEnsureLayersConnected
// (d) [UI] BrowserParent::RecvEnsureLayersConnected
// (e) [UI] RenderFrame::EnsureLayersConnected
// (f) [UI] CompositorBridgeChild::SendNotifyChildRecreated
//

View File

@ -42,7 +42,7 @@ class CompositorWidget;
} // namespace widget
namespace dom {
class ContentParent;
class TabParent;
class BrowserParent;
} // namespace dom
namespace ipc {
class GeckoChildProcessHost;

View File

@ -94,7 +94,7 @@ class APZInputBridge {
// synchronous scroll.
//
// Even if this returns Nothing(), all wheel events in APZ-aware widgets must
// be sent through APZ so they are transformed correctly for TabParent.
// be sent through APZ so they are transformed correctly for BrowserParent.
static Maybe<APZWheelAction> ActionForWheelEvent(WidgetWheelEvent* aEvent);
protected:

View File

@ -17,7 +17,7 @@
#include "InputData.h" // for InputData, etc
#include "Layers.h" // for Layer, etc
#include "mozilla/dom/MouseEventBinding.h" // for MouseEvent constants
#include "mozilla/dom/TabParent.h" // for AreRecordReplayTabsActive
#include "mozilla/dom/BrowserParent.h" // for AreRecordReplayTabsActive
#include "mozilla/dom/Touch.h" // for Touch
#include "mozilla/gfx/gfxVars.h" // for gfxVars
#include "mozilla/gfx/GPUParent.h" // for GPUParent
@ -1220,7 +1220,7 @@ nsEventStatus APZCTreeManager::ReceiveInputEvent(
// Ignore input events when there are active tabs that are recording or
// replaying. APZ does not work with the special layers constructed by
// the middleman processes being communicated with here.
if (dom::TabParent::AreRecordReplayTabsActive()) {
if (dom::BrowserParent::AreRecordReplayTabsActive()) {
return nsEventStatus_eIgnore;
}

View File

@ -8,7 +8,7 @@
#include "mozilla/dom/BrowserBridgeChild.h" // for BrowserBridgeChild
#include "mozilla/dom/EventTarget.h" // for EventTarget
#include "mozilla/dom/TabParent.h" // for TabParent
#include "mozilla/dom/BrowserParent.h" // for BrowserParent
#include "mozilla/EventDispatcher.h" // for EventDispatcher
#include "mozilla/layout/RenderFrame.h" // For RenderFrame
#include "mozilla/PresShell.h" // For PresShell
@ -157,7 +157,7 @@ FocusTarget::FocusTarget(PresShell* aRootPresShell,
}
// Check if the key event target is a remote browser
if (TabParent* browserParent = TabParent::GetFrom(keyEventTarget)) {
if (BrowserParent* browserParent = BrowserParent::GetFrom(keyEventTarget)) {
RenderFrame* rf = browserParent->GetRenderFrame();
// The globally focused element for scrolling is in a remote layer tree

View File

@ -12,7 +12,7 @@
#include "LayersLogging.h" // For Stringify
#include "mozilla/dom/Element.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/layers/LayerTransactionChild.h"
#include "mozilla/layers/ShadowLayers.h"
@ -45,7 +45,7 @@
namespace mozilla {
namespace layers {
using dom::TabParent;
using dom::BrowserParent;
uint64_t APZCCallbackHelper::sLastTargetAPZCNotificationInputBlock =
uint64_t(-1);
@ -282,7 +282,8 @@ void APZCCallbackHelper::NotifyLayerTransforms(
const nsTArray<MatrixMessage>& aTransforms) {
MOZ_ASSERT(NS_IsMainThread());
for (const MatrixMessage& msg : aTransforms) {
TabParent* parent = TabParent::GetTabParentFromLayersId(msg.GetLayersId());
BrowserParent* parent =
BrowserParent::GetBrowserParentFromLayersId(msg.GetLayersId());
if (parent) {
parent->SetChildToParentConversionMatrix(
ViewAs<LayoutDeviceToLayoutDeviceMatrix4x4>(

View File

@ -122,7 +122,7 @@ class APZCCallbackHelper {
const CSSToLayoutDeviceScale& aScale);
/* Dispatch a widget event via the widget stored in the event, if any.
* In a child process, allows the TabParent event-capture mechanism to
* In a child process, allows the BrowserParent event-capture mechanism to
* intercept the event. */
static nsEventStatus DispatchWidgetEvent(WidgetGUIEvent& aEvent);

View File

@ -7,7 +7,7 @@
#include "mozilla/layers/APZCTreeManagerChild.h"
#include "InputData.h" // for InputData
#include "mozilla/dom/TabParent.h" // for TabParent
#include "mozilla/dom/BrowserParent.h" // for BrowserParent
#include "mozilla/layers/APZCCallbackHelper.h" // for APZCCallbackHelper
#include "mozilla/layers/APZInputBridgeChild.h" // for APZInputBridgeChild
#include "mozilla/layers/RemoteCompositorSession.h" // for RemoteCompositorSession
@ -132,8 +132,8 @@ mozilla::ipc::IPCResult APZCTreeManagerChild::RecvHandleTap(
controller->HandleTap(aType, aPoint, aModifiers, aGuid, aInputBlockId);
return IPC_OK();
}
dom::TabParent* tab =
dom::TabParent::GetTabParentFromLayersId(aGuid.mLayersId);
dom::BrowserParent* tab =
dom::BrowserParent::GetBrowserParentFromLayersId(aGuid.mLayersId);
if (tab) {
tab->SendHandleTap(aType, aPoint, aModifiers, aGuid, aInputBlockId);
}

View File

@ -39,7 +39,7 @@
#include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop, etc
#include "FrameLayerBuilder.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/Unused.h"
#include "mozilla/DebugOnly.h"
@ -631,9 +631,9 @@ uint32_t CompositorBridgeChild::SharedFrameMetricsData::GetAPZCId() {
mozilla::ipc::IPCResult CompositorBridgeChild::RecvRemotePaintIsReady() {
// Used on the content thread, this bounces the message to the
// TabParent (via the TabChild) if the notification was previously requested.
// XPCOM gives a soup of compiler errors when trying to do_QueryReference
// so I'm using static_cast<>
// BrowserParent (via the TabChild) if the notification was previously
// requested. XPCOM gives a soup of compiler errors when trying to
// do_QueryReference so I'm using static_cast<>
MOZ_LAYERS_LOG(
("[RemoteGfx] CompositorBridgeChild received RemotePaintIsReady"));
RefPtr<nsISupports> iTabChildBase(do_QueryReferent(mWeakTabChild));
@ -802,8 +802,8 @@ mozilla::ipc::IPCResult CompositorBridgeChild::RecvObserveLayersUpdate(
MOZ_ASSERT(aLayersId.IsValid());
MOZ_ASSERT(XRE_IsParentProcess());
if (RefPtr<dom::TabParent> tab =
dom::TabParent::GetTabParentFromLayersId(aLayersId)) {
if (RefPtr<dom::BrowserParent> tab =
dom::BrowserParent::GetBrowserParentFromLayersId(aLayersId)) {
tab->LayerTreeUpdate(aEpoch, aActive);
}
return IPC_OK();

View File

@ -124,7 +124,7 @@ class CompositorBridgeChild final : public PCompositorBridgeChild,
/**
* Request that the parent tell us when graphics are ready on GPU.
* When we get that message, we bounce it to the TabParent via
* When we get that message, we bounce it to the BrowserParent via
* the TabChild
* @param tabChild The object to bounce the note to. Non-NULL.
*/

View File

@ -28,7 +28,7 @@
#include "mozilla/AutoRestore.h" // for AutoRestore
#include "mozilla/ClearOnShutdown.h" // for ClearOnShutdown
#include "mozilla/DebugOnly.h" // for DebugOnly
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/gfx/2D.h" // for DrawTarget
#include "mozilla/gfx/GPUChild.h" // for GfxPrefValue
#include "mozilla/gfx/Point.h" // for IntSize

View File

@ -187,8 +187,8 @@ class LayerTransactionParent final : public PLayerTransactionParent,
// These fields keep track of the latest epoch values in the child and the
// parent. mChildEpoch is the latest epoch value received from the child.
// mParentEpoch is the latest epoch value that we have told TabParent about
// (via ObserveLayerUpdate).
// mParentEpoch is the latest epoch value that we have told BrowserParent
// about (via ObserveLayerUpdate).
LayersObserverEpoch mChildEpoch;
LayersObserverEpoch mParentEpoch;

View File

@ -9,7 +9,7 @@
#include "base/message_loop.h"
#include "base/task.h"
#include "MainThreadUtils.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/layers/APZCCallbackHelper.h"
#include "mozilla/layers/APZCTreeManagerParent.h" // for APZCTreeManagerParent
#include "mozilla/layers/APZThreadUtils.h"
@ -59,8 +59,8 @@ void RemoteContentController::HandleTapOnMainThread(TapType aTapType,
uint64_t aInputBlockId) {
MOZ_ASSERT(NS_IsMainThread());
dom::TabParent* tab =
dom::TabParent::GetTabParentFromLayersId(aGuid.mLayersId);
dom::BrowserParent* tab =
dom::BrowserParent::GetBrowserParentFromLayersId(aGuid.mLayersId);
if (tab) {
tab->SendHandleTap(aTapType, aPoint, aModifiers, aGuid, aInputBlockId);
}
@ -110,9 +110,9 @@ void RemoteContentController::HandleTap(TapType aTapType,
if (NS_IsMainThread()) {
HandleTapOnMainThread(aTapType, aPoint, aModifiers, aGuid, aInputBlockId);
} else {
// We don't want to get the TabParent or call TabParent::SendHandleTap()
// from a non-main thread (this might happen on Android, where this is
// called from the Java UI thread)
// We don't want to get the BrowserParent or call
// BrowserParent::SendHandleTap() from a non-main thread (this might happen
// on Android, where this is called from the Java UI thread)
NS_DispatchToMainThread(
NewRunnableMethod<TapType, LayoutDevicePoint, Modifiers,
ScrollableLayerGuid, uint64_t>(

View File

@ -13,7 +13,7 @@
namespace mozilla {
namespace dom {
class TabParent;
class BrowserParent;
}
namespace layers {

View File

@ -463,7 +463,7 @@ class WebRenderBridgeParent final
// These fields keep track of the latest layer observer epoch values in the
// child and the parent. mChildLayersObserverEpoch is the latest epoch value
// received from the child. mParentLayersObserverEpoch is the latest epoch
// value that we have told TabParent about (via ObserveLayerUpdate).
// value that we have told BrowserParent about (via ObserveLayerUpdate).
LayersObserverEpoch mChildLayersObserverEpoch;
LayersObserverEpoch mParentLayersObserverEpoch;

View File

@ -9,7 +9,7 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/hal_sandbox/PHalChild.h"
#include "mozilla/hal_sandbox/PHalParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/fallback/FallbackScreenConfiguration.h"
#include "mozilla/EnumeratedRange.h"
@ -166,10 +166,10 @@ class HalParent : public PHalParent,
InfallibleTArray<unsigned int>&& pattern, InfallibleTArray<uint64_t>&& id,
PBrowserParent* browserParent) override {
// We give all content vibration permission.
// TabParent *tabParent = TabParent::GetFrom(browserParent);
// BrowserParent *browserParent = BrowserParent::GetFrom(browserParent);
/* xxxkhuey wtf
nsCOMPtr<nsIDOMWindow> window =
do_QueryInterface(tabParent->GetBrowserDOMWindow());
do_QueryInterface(browserParent->GetBrowserDOMWindow());
*/
WindowIdentifier newID(id, nullptr);
hal::Vibrate(pattern, newID);
@ -178,10 +178,10 @@ class HalParent : public PHalParent,
virtual mozilla::ipc::IPCResult RecvCancelVibrate(
InfallibleTArray<uint64_t>&& id, PBrowserParent* browserParent) override {
// TabParent *tabParent = TabParent::GetFrom(browserParent);
// BrowserParent *browserParent = BrowserParent::GetFrom(browserParent);
/* XXXkhuey wtf
nsCOMPtr<nsIDOMWindow> window =
tabParent->GetBrowserDOMWindow();
browserParent->GetBrowserDOMWindow();
*/
WindowIdentifier newID(id, nullptr);
hal::CancelVibrate(newID);

View File

@ -17,7 +17,7 @@ DIRECT_CALL_OVERRIDES = {
"BackgroundMutableFileParentBase", "mozilla/dom/filehandle/ActorsParent.h"
),
("PBrowser", "parent"): ("TabParent", "mozilla/dom/TabParent.h"),
("PBrowser", "parent"): ("BrowserParent", "mozilla/dom/BrowserParent.h"),
("PChromiumCDM", "parent"): ("ChromiumCDMParent", "ChromiumCDMParent.h"),

View File

@ -7518,7 +7518,7 @@ Element* PresShell::EventHandler::ComputeFocusedEventTargetElement(
sLastKeyDownEventTargetElement->GetComposedDoc());
if (keyDownIsChrome != nsContentUtils::IsChromeDoc(
eventTargetElement->GetComposedDoc()) ||
(keyDownIsChrome && TabParent::GetFrom(eventTargetElement))) {
(keyDownIsChrome && BrowserParent::GetFrom(eventTargetElement))) {
eventTargetElement = sLastKeyDownEventTargetElement;
}
}
@ -8214,7 +8214,7 @@ nsresult PresShell::EventHandler::DispatchEventToDOM(
if (aEvent->mClass == eCompositionEventClass) {
IMEStateManager::DispatchCompositionEvent(
eventTarget, GetPresContext(), TabParent::GetFocused(),
eventTarget, GetPresContext(), BrowserParent::GetFocused(),
aEvent->AsCompositionEvent(), aEventStatus, eventCBPtr);
} else {
EventDispatcher::Dispatch(eventTarget, GetPresContext(), aEvent, nullptr,

View File

@ -60,7 +60,7 @@
#include "mozilla/css/ImageLoader.h"
#include "mozilla/dom/PBrowserParent.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "nsRefreshDriver.h"
#include "Layers.h"
#include "LayerUserData.h"
@ -1273,8 +1273,8 @@ void nsPresContext::ThemeChanged() {
}
}
static bool NotifyThemeChanged(TabParent* aTabParent, void* aArg) {
aTabParent->ThemeChanged();
static bool NotifyThemeChanged(BrowserParent* aBrowserParent, void* aArg) {
aBrowserParent->ThemeChanged();
return false;
}
@ -1397,7 +1397,7 @@ bool nsPresContext::UIResolutionChangedSubdocumentCallback(
return true;
}
static void NotifyTabUIResolutionChanged(TabParent* aTab, void* aArg) {
static void NotifyTabUIResolutionChanged(BrowserParent* aTab, void* aArg) {
aTab->UIResolutionChanged();
}
@ -1582,7 +1582,7 @@ void nsPresContext::FlushPendingMediaFeatureValuesChanged() {
}
}
static bool NotifyTabSizeModeChanged(TabParent* aTab, void* aArg) {
static bool NotifyTabSizeModeChanged(BrowserParent* aTab, void* aArg) {
nsSizeMode* sizeMode = static_cast<nsSizeMode*>(aArg);
aTab->SizeModeChanged(*sizeMode);
return false;

View File

@ -123,7 +123,7 @@
#include "mozilla/dom/RemoteWorkerService.h"
#include "mozilla/dom/BlobURLProtocolHandler.h"
#include "mozilla/dom/ReportingHeader.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/quota/ActorsParent.h"
#include "mozilla/dom/localstorage/ActorsParent.h"
#include "mozilla/net/UrlClassifierFeatureFactory.h"
@ -304,7 +304,7 @@ nsresult nsLayoutStatics::Initialize() {
mozilla::dom::DOMPrefs::Initialize();
mozilla::dom::RemoteWorkerService::Initialize();
// This one should be initialized on the parent only
mozilla::dom::TabParent::InitializeStatics();
mozilla::dom::BrowserParent::InitializeStatics();
}
nsThreadManager::InitializeShutdownObserver();

View File

@ -8,7 +8,7 @@
#include "mozilla/PresShell.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/LayerTransactionParent.h"
@ -29,8 +29,9 @@ using namespace mozilla::layers;
namespace mozilla {
namespace layout {
static already_AddRefed<LayerManager> GetLayerManager(TabParent* aTabParent) {
if (Element* element = aTabParent->GetOwnerElement()) {
static already_AddRefed<LayerManager> GetLayerManager(
BrowserParent* aBrowserParent) {
if (Element* element = aBrowserParent->GetOwnerElement()) {
if (RefPtr<LayerManager> lm =
nsContentUtils::LayerManagerForContent(element)) {
return lm.forget();
@ -42,23 +43,23 @@ static already_AddRefed<LayerManager> GetLayerManager(TabParent* aTabParent) {
RenderFrame::RenderFrame()
: mLayersId{0},
mTabParent(nullptr),
mBrowserParent(nullptr),
mLayerManager(nullptr),
mInitialized(false),
mLayersConnected(false) {}
RenderFrame::~RenderFrame() {}
bool RenderFrame::Initialize(TabParent* aTabParent) {
if (mInitialized || !aTabParent) {
bool RenderFrame::Initialize(BrowserParent* aBrowserParent) {
if (mInitialized || !aBrowserParent) {
return false;
}
mTabParent = aTabParent;
RefPtr<LayerManager> lm = GetLayerManager(mTabParent);
mBrowserParent = aBrowserParent;
RefPtr<LayerManager> lm = GetLayerManager(mBrowserParent);
PCompositorBridgeChild* compositor =
lm ? lm->GetCompositorBridgeChild() : nullptr;
mTabProcessId = mTabParent->Manager()->OtherPid();
mTabProcessId = mBrowserParent->Manager()->OtherPid();
// Our remote frame will push layers updates to the compositor,
// and we'll keep an indirect reference to that tree.
@ -75,12 +76,12 @@ void RenderFrame::Destroy() {
GPUProcessManager::Get()->UnmapLayerTreeId(mLayersId, mTabProcessId);
}
mTabParent = nullptr;
mBrowserParent = nullptr;
mLayerManager = nullptr;
}
void RenderFrame::EnsureLayersConnected(CompositorOptions* aCompositorOptions) {
RefPtr<LayerManager> lm = GetLayerManager(mTabParent);
RefPtr<LayerManager> lm = GetLayerManager(mBrowserParent);
if (!lm) {
return;
}
@ -96,8 +97,8 @@ void RenderFrame::EnsureLayersConnected(CompositorOptions* aCompositorOptions) {
LayerManager* RenderFrame::AttachLayerManager() {
RefPtr<LayerManager> lm;
if (mTabParent) {
lm = GetLayerManager(mTabParent);
if (mBrowserParent) {
lm = GetLayerManager(mBrowserParent);
}
// Perhaps the document containing this frame currently has no presentation?
@ -115,7 +116,8 @@ void RenderFrame::OwnerContentChanged() { Unused << AttachLayerManager(); }
void RenderFrame::GetTextureFactoryIdentifier(
TextureFactoryIdentifier* aTextureFactoryIdentifier) const {
RefPtr<LayerManager> lm = mTabParent ? GetLayerManager(mTabParent) : nullptr;
RefPtr<LayerManager> lm =
mBrowserParent ? GetLayerManager(mBrowserParent) : nullptr;
// Perhaps the document containing this frame currently has no presentation?
if (lm) {
*aTextureFactoryIdentifier = lm->GetTextureFactoryIdentifier();
@ -180,7 +182,7 @@ nsDisplayRemote::nsDisplayRemote(nsDisplayListBuilder* aBuilder,
if (nsFrameLoader* frameLoader = GetFrameLoader()) {
// TODO: We need to handle acquiring a TabId in the remote sub-frame case
// for fission.
if (TabParent* browser = TabParent::GetFrom(frameLoader)) {
if (BrowserParent* browser = BrowserParent::GetFrom(frameLoader)) {
mTabId = browser->GetTabId();
}
}

View File

@ -22,7 +22,7 @@ class nsSubDocumentFrame;
namespace mozilla {
namespace dom {
class TabParent;
class BrowserParent;
} // namespace dom
namespace layers {
@ -33,7 +33,7 @@ namespace layout {
/**
* RenderFrame connects and manages layer trees for remote frames. It is
* directly owned by a TabParent and always lives in the parent process.
* directly owned by a BrowserParent and always lives in the parent process.
*/
class RenderFrame final {
typedef mozilla::layers::CompositorOptions CompositorOptions;
@ -45,7 +45,7 @@ class RenderFrame final {
RenderFrame();
virtual ~RenderFrame();
bool Initialize(dom::TabParent* aTabParent);
bool Initialize(dom::BrowserParent* aBrowserParent);
void Destroy();
void EnsureLayersConnected(CompositorOptions* aCompositorOptions);
@ -72,7 +72,7 @@ class RenderFrame final {
// mLayersConnected is true).
CompositorOptions mCompositorOptions;
dom::TabParent* mTabParent;
dom::BrowserParent* mBrowserParent;
RefPtr<LayerManager> mLayerManager;
bool mInitialized;

View File

@ -36,7 +36,7 @@
#include "mozilla/dom/ChromeUtils.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/TabContext.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/network/TCPSocketParent.h"
#include "mozilla/dom/network/TCPServerSocketParent.h"
#include "mozilla/dom/network/UDPSocketParent.h"
@ -57,11 +57,11 @@
using IPC::SerializedLoadContext;
using mozilla::OriginAttributes;
using mozilla::dom::BrowserParent;
using mozilla::dom::ChromeUtils;
using mozilla::dom::ContentParent;
using mozilla::dom::ServiceWorkerManager;
using mozilla::dom::TabContext;
using mozilla::dom::TabParent;
using mozilla::dom::TCPServerSocketParent;
using mozilla::dom::TCPSocketParent;
using mozilla::dom::UDPSocketParent;
@ -244,11 +244,11 @@ const char* NeckoParent::CreateChannelLoadContext(
aSerialized.mOriginAttributes.mPrivateBrowsingId > 0);
switch (aBrowser.type()) {
case PBrowserOrId::TPBrowserParent: {
RefPtr<TabParent> tabParent =
TabParent::GetFrom(aBrowser.get_PBrowserParent());
RefPtr<BrowserParent> browserParent =
BrowserParent::GetFrom(aBrowser.get_PBrowserParent());
dom::Element* topFrameElement = nullptr;
if (tabParent) {
topFrameElement = tabParent->GetOwnerElement();
if (browserParent) {
topFrameElement = browserParent->GetOwnerElement();
}
aResult = new LoadContext(aSerialized, topFrameElement, attrs);
break;
@ -333,7 +333,8 @@ bool NeckoParent::DeallocPStunAddrsRequestParent(
PWebrtcProxyChannelParent* NeckoParent::AllocPWebrtcProxyChannelParent(
const PBrowserOrId& aBrowser) {
#ifdef MOZ_WEBRTC
RefPtr<TabParent> tab = TabParent::GetFrom(aBrowser.get_PBrowserParent());
RefPtr<BrowserParent> tab =
BrowserParent::GetFrom(aBrowser.get_PBrowserParent());
WebrtcProxyChannelParent* parent = new WebrtcProxyChannelParent(tab);
parent->AddRef();
return parent;
@ -439,11 +440,11 @@ PWebSocketParent* NeckoParent::AllocPWebSocketParent(
return nullptr;
}
RefPtr<TabParent> tabParent =
TabParent::GetFrom(browser.get_PBrowserParent());
RefPtr<BrowserParent> browserParent =
BrowserParent::GetFrom(browser.get_PBrowserParent());
PBOverrideStatus overrideStatus = PBOverrideStatusFromLoadContext(serialized);
WebSocketChannelParent* p = new WebSocketChannelParent(
tabParent, loadContext, overrideStatus, aSerial);
browserParent, loadContext, overrideStatus, aSerial);
p->AddRef();
return p;
}

View File

@ -62,7 +62,7 @@ class NeckoParent : public PNeckoParent {
* This implementation of nsIAuthPrompt2 is used for nested remote iframes
* that want an auth prompt. This class lives in the parent process and
* informs the NeckoChild that we want an auth prompt, which forwards the
* request to the TabParent in the remote iframe that contains the nested
* request to the BrowserParent in the remote iframe that contains the nested
* iframe
*/
class NestedFrameAuthPrompt final : public nsIAuthPrompt2 {

View File

@ -11,7 +11,7 @@
#include "mozilla/TelemetryIPC.h"
#ifdef MOZ_WEBRTC
# include "mozilla/dom/ContentProcessManager.h"
# include "mozilla/dom/TabParent.h"
# include "mozilla/dom/BrowserParent.h"
# include "mozilla/net/WebrtcProxyChannelParent.h"
#endif
@ -143,9 +143,9 @@ PWebrtcProxyChannelParent* SocketProcessParent::AllocPWebrtcProxyChannelParent(
dom::ContentProcessManager* cpm = dom::ContentProcessManager::GetSingleton();
dom::TabId tabId = aBrowser.get_TabId();
dom::ContentParentId cpId = cpm->GetTabProcessId(tabId);
RefPtr<dom::TabParent> tab = cpm->GetTabParentByProcessAndTabId(cpId, tabId);
RefPtr<dom::BrowserParent> tab = cpm->GetBrowserParentByProcessAndTabId(cpId, tabId);
if (!tab) {
MOZ_ASSERT(false, "Cannot find the TabParent!");
MOZ_ASSERT(false, "Cannot find the BrowserParent!");
return nullptr;
}

View File

@ -8,7 +8,7 @@
#include "mozilla/net/FTPChannelParent.h"
#include "nsStringStream.h"
#include "mozilla/net/ChannelEventQueue.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "nsFTPChannel.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
@ -54,8 +54,8 @@ FTPChannelParent::FTPChannelParent(const PBrowserOrId& aIframeEmbedding,
MOZ_ASSERT(handler, "no ftp handler");
if (aIframeEmbedding.type() == PBrowserOrId::TPBrowserParent) {
mTabParent =
static_cast<dom::TabParent*>(aIframeEmbedding.get_PBrowserParent());
mBrowserParent =
static_cast<dom::BrowserParent*>(aIframeEmbedding.get_PBrowserParent());
}
mEventQ = new ChannelEventQueue(static_cast<nsIParentChannel*>(this));
@ -551,12 +551,12 @@ NS_IMETHODIMP
FTPChannelParent::GetInterface(const nsIID& uuid, void** result) {
if (uuid.Equals(NS_GET_IID(nsIAuthPromptProvider)) ||
uuid.Equals(NS_GET_IID(nsISecureBrowserUI))) {
if (mTabParent) {
return mTabParent->QueryInterface(uuid, result);
if (mBrowserParent) {
return mBrowserParent->QueryInterface(uuid, result);
}
} else if (uuid.Equals(NS_GET_IID(nsIAuthPrompt)) ||
uuid.Equals(NS_GET_IID(nsIAuthPrompt2))) {
nsCOMPtr<nsIAuthPromptProvider> provider(do_QueryObject(mTabParent));
nsCOMPtr<nsIAuthPromptProvider> provider(do_QueryObject(mBrowserParent));
if (provider) {
return provider->GetAuthPrompt(nsIAuthPromptProvider::PROMPT_NORMAL, uuid,
result);

View File

@ -21,7 +21,7 @@ class nsILoadContext;
namespace mozilla {
namespace dom {
class TabParent;
class BrowserParent;
class PBrowserOrId;
} // namespace dom
@ -132,7 +132,7 @@ class FTPChannelParent final : public PFTPChannelParent,
// Set if we successfully suspended the nsHttpChannel for diversion. Unset
// when we call ResumeForDiversion.
bool mSuspendedForDiversion;
RefPtr<mozilla::dom::TabParent> mTabParent;
RefPtr<mozilla::dom::BrowserParent> mBrowserParent;
RefPtr<ChannelEventQueue> mEventQ;

View File

@ -2205,7 +2205,7 @@ HttpBaseChannel::RedirectTo(nsIURI* targetURI) {
}
NS_IMETHODIMP
HttpBaseChannel::SwitchProcessTo(mozilla::dom::Promise* aTabParent,
HttpBaseChannel::SwitchProcessTo(mozilla::dom::Promise* aBrowserParent,
uint64_t aIdentifier) {
return NS_ERROR_NOT_AVAILABLE;
}

View File

@ -218,7 +218,7 @@ class HttpBaseChannel : public nsHashPropertyBag,
NS_IMETHOD GetResponseStatusText(nsACString &aValue) override;
NS_IMETHOD GetRequestSucceeded(bool *aValue) override;
NS_IMETHOD RedirectTo(nsIURI *newURI) override;
NS_IMETHOD SwitchProcessTo(mozilla::dom::Promise *aTabParent,
NS_IMETHOD SwitchProcessTo(mozilla::dom::Promise *aBrowserParent,
uint64_t aIdentifier) override;
NS_IMETHOD HasCrossOriginOpenerPolicyMismatch(bool *aMismatch) override;
NS_IMETHOD UpgradeToSecure() override;

View File

@ -13,7 +13,7 @@
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ServiceWorkerUtils.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/net/NeckoParent.h"
#include "mozilla/InputStreamLengthHelper.h"
#include "mozilla/IntegerPrintfMacros.h"
@ -94,8 +94,8 @@ HttpChannelParent::HttpChannelParent(const PBrowserOrId& iframeEmbedding,
mHttpHandler = gHttpHandler;
if (iframeEmbedding.type() == PBrowserOrId::TPBrowserParent) {
mTabParent =
static_cast<dom::TabParent*>(iframeEmbedding.get_PBrowserParent());
mBrowserParent =
static_cast<dom::BrowserParent*>(iframeEmbedding.get_PBrowserParent());
} else {
mNestedFrameId = iframeEmbedding.get_TabId();
}
@ -295,8 +295,8 @@ HttpChannelParent::GetInterface(const nsIID& aIID, void** result) {
if (aIID.Equals(NS_GET_IID(nsIAuthPromptProvider)) ||
aIID.Equals(NS_GET_IID(nsISecureBrowserUI)) ||
aIID.Equals(NS_GET_IID(nsIRemoteTab))) {
if (mTabParent) {
return mTabParent->QueryInterface(aIID, result);
if (mBrowserParent) {
return mBrowserParent->QueryInterface(aIID, result);
}
}
@ -313,8 +313,8 @@ HttpChannelParent::GetInterface(const nsIID& aIID, void** result) {
return NS_OK;
}
if (mTabParent && aIID.Equals(NS_GET_IID(nsIPrompt))) {
nsCOMPtr<Element> frameElement = mTabParent->GetOwnerElement();
if (mBrowserParent && aIID.Equals(NS_GET_IID(nsIPrompt))) {
nsCOMPtr<Element> frameElement = mBrowserParent->GetOwnerElement();
if (frameElement) {
nsCOMPtr<nsPIDOMWindowOuter> win = frameElement->OwnerDoc()->GetWindow();
NS_ENSURE_TRUE(win, NS_ERROR_UNEXPECTED);

View File

@ -34,7 +34,7 @@ class nsICacheEntry;
namespace mozilla {
namespace dom {
class TabParent;
class BrowserParent;
class PBrowserOrId;
} // namespace dom
@ -220,7 +220,7 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
void FailDiversion(nsresult aErrorCode);
friend class HttpChannelParentListener;
RefPtr<mozilla::dom::TabParent> mTabParent;
RefPtr<mozilla::dom::BrowserParent> mBrowserParent;
MOZ_MUST_USE nsresult ReportSecurityMessage(
const nsAString& aMessageTag, const nsAString& aMessageCategory) override;

Some files were not shown because too many files have changed in this diff Show More