Bug 1362866 - Get rid of MozTabChildNotReady event and all of its required infrastructure. r=billm

This event is no longer necessary, since checking nsITabParent.hasPresented is enough to know
if we need to blank out the tab or not.

MozReview-Commit-ID: 445XMqhorxC

--HG--
extra : rebase_source : 1a05de827502c409d979a621471978b08ce39fb2
This commit is contained in:
Mike Conley 2017-05-07 21:26:08 -04:00
Родитель 59e5e40e1f
Коммит a6e4cd7b77
7 изменённых файлов: 1 добавлений и 136 удалений

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

@ -4263,23 +4263,6 @@ ContentParent::RecvNotifyTabDestroying(const TabId& aTabId,
return IPC_OK();
}
mozilla::ipc::IPCResult
ContentParent::RecvTabChildNotReady(const TabId& aTabId)
{
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
RefPtr<TabParent> tp =
cpm->GetTopLevelTabParentByProcessAndTabId(this->ChildID(), aTabId);
if (!tp) {
NS_WARNING("Couldn't find TabParent for TabChildNotReady message.");
return IPC_OK();
}
tp->DispatchTabChildNotReadyEvent();
return IPC_OK();
}
nsTArray<TabContext>
ContentParent::GetManagedTabContext()
{

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

@ -493,8 +493,6 @@ public:
virtual mozilla::ipc::IPCResult RecvNotifyTabDestroying(const TabId& aTabId,
const ContentParentId& aCpId) override;
virtual mozilla::ipc::IPCResult RecvTabChildNotReady(const TabId& aTabId) override;
nsTArray<TabContext> GetManagedTabContext();
virtual POfflineCacheUpdateParent*

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

@ -930,9 +930,6 @@ parent:
*/
async NotifyTabDestroying(TabId tabId,
ContentParentId cpId);
async TabChildNotReady(TabId tabId);
/**
* Starts an offline application cache update.
* @param manifestURI

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

@ -33,7 +33,6 @@ protocol PProcessHangMonitor
parent:
async HangEvidence(HangData data);
async ClearHang();
async Ready();
child:
async TerminateScript();

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

@ -12,7 +12,6 @@
#include "mozilla/Atomics.h"
#include "mozilla/BackgroundHangMonitor.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ScriptSettings.h"
@ -193,8 +192,6 @@ public:
mDumpId.Truncate();
}
void DispatchTabChildNotReady(TabId aTabId);
private:
~HangMonitoredProcess() = default;
@ -214,7 +211,6 @@ public:
void Bind(Endpoint<PProcessHangMonitorParent>&& aEndpoint);
mozilla::ipc::IPCResult RecvReady() override;
mozilla::ipc::IPCResult RecvHangEvidence(const HangData& aHangData) override;
mozilla::ipc::IPCResult RecvClearHang() override;
@ -249,8 +245,6 @@ private:
void ClearHangNotification();
void DispatchTabChildNotReady(TabId aTabId);
void ForcePaintOnThread(TabId aTabId, uint64_t aLayerObserverEpoch);
void ShutdownOnThread();
@ -260,12 +254,6 @@ private:
// This field is read-only after construction.
bool mReportHangs;
// This field is only accessed on the hang thread. Inits to
// false, and will flip to true once the HangMonitorChild is
// constructed in the child process, and sends a message saying
// so.
bool mReady;
// This field is only accessed on the hang thread.
bool mIPCOpen;
@ -339,11 +327,6 @@ HangMonitorChild::InterruptCallback()
if (tabChild) {
js::AutoAssertNoContentJS nojs(mContext);
tabChild->ForcePaint(forcePaintEpoch);
} else {
auto cc = ContentChild::GetSingleton();
if (cc) {
cc->SendTabChildNotReady(forcePaintTab);
}
}
}
}
@ -449,8 +432,6 @@ HangMonitorChild::Bind(Endpoint<PProcessHangMonitorChild>&& aEndpoint)
DebugOnly<bool> ok = aEndpoint.Bind(this);
MOZ_ASSERT(ok);
Unused << SendReady();
}
void
@ -571,7 +552,6 @@ HangMonitorChild::ClearHangAsync()
HangMonitorParent::HangMonitorParent(ProcessHangMonitor* aMonitor)
: mHangMonitor(aMonitor),
mReady(false),
mIPCOpen(true),
mMonitor("HangMonitorParent lock"),
mShutdownDone(false),
@ -651,38 +631,13 @@ HangMonitorParent::ForcePaint(dom::TabParent* aTab, uint64_t aLayerObserverEpoch
}
}
void
HangMonitorParent::DispatchTabChildNotReady(TabId aTabId)
{
MOZ_RELEASE_ASSERT(NS_IsMainThread());
if (!mProcess) {
return;
}
mProcess->DispatchTabChildNotReady(aTabId);
}
void
HangMonitorParent::ForcePaintOnThread(TabId aTabId, uint64_t aLayerObserverEpoch)
{
MOZ_RELEASE_ASSERT(MessageLoop::current() == MonitorLoop());
if (mIPCOpen) {
if (mReady) {
Unused << SendForcePaint(aTabId, aLayerObserverEpoch);
} else {
// We've never heard from the HangMonitorChild before, so
// it's either not finished setting up, or has only recently
// finished setting up. In either case, we're dealing with
// a new content process that probably hasn't had time to
// get the ContentChild, let alone the TabChild for aTabId,
// set up, and so attempting to force paint on the non-existant
// TabChild is not going to work. Instead, we tell the main
// thread that we're waiting on a TabChild to be created.
NS_DispatchToMainThread(
mMainThreadTaskFactory.NewRunnableMethod(
&HangMonitorParent::DispatchTabChildNotReady, aTabId));
}
Unused << SendForcePaint(aTabId, aLayerObserverEpoch);
}
}
@ -770,14 +725,6 @@ HangMonitorParent::TakeBrowserMinidump(const PluginHangData& aPhd,
return false;
}
mozilla::ipc::IPCResult
HangMonitorParent::RecvReady()
{
MOZ_RELEASE_ASSERT(MessageLoop::current() == MonitorLoop());
mReady = true;
return IPC_OK();
}
mozilla::ipc::IPCResult
HangMonitorParent::RecvHangEvidence(const HangData& aHangData)
{
@ -1083,17 +1030,6 @@ HangMonitoredProcess::UserCanceled()
return NS_OK;
}
void
HangMonitoredProcess::DispatchTabChildNotReady(TabId aTabId)
{
MOZ_RELEASE_ASSERT(NS_IsMainThread());
if (!mContentParent) {
return;
}
Unused << mContentParent->RecvTabChildNotReady(aTabId);
}
static bool
InterruptCallback(JSContext* cx)
{

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

@ -3267,52 +3267,6 @@ TabParent::LiveResizeStopped()
SuppressDisplayport(false);
}
void
TabParent::DispatchTabChildNotReadyEvent()
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<mozilla::dom::EventTarget> target = do_QueryInterface(mFrameElement);
if (!target) {
NS_WARNING("Could not locate target for tab child not ready event.");
return;
}
if (mHasPresented) {
// We shouldn't dispatch this event because clearly the
// TabChild _became_ ready by the time we were told to
// dispatch.
return;
}
if (!mDocShellIsActive) {
return;
}
RefPtr<nsFrameLoader> frameLoader = GetFrameLoader(true);
if (!frameLoader) {
return;
}
nsCOMPtr<Element> frameElement(mFrameElement);
nsCOMPtr<nsIFrameLoaderOwner> owner = do_QueryInterface(frameElement);
if (!owner) {
return;
}
RefPtr<nsFrameLoader> currentFrameLoader = owner->GetFrameLoader();
if (currentFrameLoader != frameLoader) {
return;
}
RefPtr<Event> event = NS_NewDOMEvent(mFrameElement, nullptr, nullptr);
event->InitEvent(NS_LITERAL_STRING("MozTabChildNotReady"), true, false);
event->SetTrusted(true);
event->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
bool dummy;
mFrameElement->DispatchEvent(event, &dummy);
}
NS_IMETHODIMP
FakeChannel::OnAuthAvailable(nsISupports *aContext, nsIAuthInformation *aAuthInfo)
{

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

@ -587,8 +587,6 @@ public:
void LiveResizeStarted() override;
void LiveResizeStopped() override;
void DispatchTabChildNotReadyEvent();
protected:
bool ReceiveMessage(const nsString& aMessage,
bool aSync,