gecko-dev/dom/ipc/ProcessHangMonitor.h
Emilio Cobos Álvarez fa6f012317 Bug 1582042 - Remove useless threading of aForceRepaint around various IPC messages. r=mconley
aForceRepaint wasn't doing what it claimed to do at all, as we've recently
learned. In current mozilla-central:

 * All those arguments ended up in a RecvRenderLayers with aForceRepaint = true
   (so far so good, that's expected).

 * But it was ignored (so that aForceRepaint is always true to calls to
   MakeVisible) from UpdateVisibility:

https://searchfox.org/mozilla-central/rev/f43ae7e1c43a4a940b658381157a6ea6c5a185c1/dom/ipc/BrowserChild.cpp#2523

 * Plus that argument only does anything useful on current central if we get to
   the end of MakeVisible(true). And MakeVisible() early returns if already
   visible.

So all in all this seems somewhat useless, and nobody has complained about such
a thing in a long time.

It seemed to do what it promised when it was introduced in
https://hg.mozilla.org/mozilla-central/rev/27f6f789b194, but it seems the
refactoring in https://hg.mozilla.org/mozilla-central/rev/4df5fa6fa785 broke it.

I think the new setup is somewhat easier to reason about, and nobody seems to be
missing that.

I'll try to remove the forceRepaint() call itself on a follow-up.

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

--HG--
extra : moz-landing-system : lando
2019-09-26 22:11:17 +00:00

96 lines
2.5 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_ProcessHangMonitor_h
#define mozilla_ProcessHangMonitor_h
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Atomics.h"
#include "nsCOMPtr.h"
#include "nsIObserver.h"
#include "nsIRemoteTab.h"
#include "nsStringFwd.h"
class nsIRunnable;
class nsIBrowserChild;
class nsIThread;
namespace mozilla {
namespace dom {
class ContentParent;
class BrowserParent;
struct CancelContentJSOptions;
} // namespace dom
namespace layers {
struct LayersObserverEpoch;
} // namespace layers
class PProcessHangMonitorParent;
class ProcessHangMonitor final : public nsIObserver {
private:
ProcessHangMonitor();
virtual ~ProcessHangMonitor();
public:
static ProcessHangMonitor* Get() { return sInstance; }
static ProcessHangMonitor* GetOrCreate();
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
static PProcessHangMonitorParent* AddProcess(
dom::ContentParent* aContentParent);
static void RemoveProcess(PProcessHangMonitorParent* aParent);
static void ClearHang();
static void PaintWhileInterruptingJS(
PProcessHangMonitorParent* aParent, dom::BrowserParent* aTab,
const layers::LayersObserverEpoch& aEpoch);
static void ClearPaintWhileInterruptingJS(
const layers::LayersObserverEpoch& aEpoch);
static void MaybeStartPaintWhileInterruptingJS();
static void CancelContentJSExecutionIfRunning(
PProcessHangMonitorParent* aParent, dom::BrowserParent* aTab,
nsIRemoteTab::NavigationType aNavigationType,
const dom::CancelContentJSOptions& aCancelContentJSOptions);
enum SlowScriptAction {
Continue,
Terminate,
StartDebugger,
TerminateGlobal,
};
SlowScriptAction NotifySlowScript(nsIBrowserChild* aBrowserChild,
const char* aFileName,
const nsString& aAddonId);
void NotifyPluginHang(uint32_t aPluginId);
bool IsDebuggerStartupComplete();
void InitiateCPOWTimeout();
bool ShouldTimeOutCPOWs();
void Dispatch(already_AddRefed<nsIRunnable> aRunnable);
bool IsOnThread();
private:
static ProcessHangMonitor* sInstance;
Atomic<bool> mCPOWTimeout;
nsCOMPtr<nsIThread> mThread;
};
} // namespace mozilla
#endif // mozilla_ProcessHangMonitor_h