зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1297826 - Override FatalError for IPDL protocols that access the GPU process and make it non-fatal. r=billm
This commit is contained in:
Родитель
a8c2c8fb5b
Коммит
6b75399b35
|
@ -3450,5 +3450,26 @@ ContentChild::RecvGetFilesResponse(const nsID& aUUID,
|
|||
return true;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
ContentChild::FatalErrorIfNotUsingGPUProcess(const char* const aProtocolName,
|
||||
const char* const aErrorMsg,
|
||||
base::ProcessId aOtherPid)
|
||||
{
|
||||
// If we're communicating with the same process or the UI process then we
|
||||
// want to crash normally. Otherwise we want to just warn as the other end
|
||||
// must be the GPU process and it crashing shouldn't be fatal for us.
|
||||
if (aOtherPid == base::GetCurrentProcId() ||
|
||||
(GetSingleton() && GetSingleton()->OtherPid() == aOtherPid)) {
|
||||
mozilla::ipc::FatalError(aProtocolName, aErrorMsg, false);
|
||||
} else {
|
||||
nsAutoCString formattedMessage("IPDL error [");
|
||||
formattedMessage.AppendASCII(aProtocolName);
|
||||
formattedMessage.AppendLiteral("]: \"");
|
||||
formattedMessage.AppendASCII(aErrorMsg);
|
||||
formattedMessage.AppendLiteral("\".");
|
||||
NS_WARNING(formattedMessage.get());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -671,6 +671,16 @@ public:
|
|||
virtual bool
|
||||
RecvBlobURLUnregistration(const nsCString& aURI) override;
|
||||
|
||||
/**
|
||||
* Helper function for protocols that use the GPU process when available.
|
||||
* Overrides FatalError to just be a warning when communicating with the
|
||||
* GPU process since we don't want to crash the content process when the
|
||||
* GPU process crashes.
|
||||
*/
|
||||
static void FatalErrorIfNotUsingGPUProcess(const char* const aProtocolName,
|
||||
const char* const aErrorMsg,
|
||||
base::ProcessId aOtherPid);
|
||||
|
||||
private:
|
||||
static void ForceKillTimerCallback(nsITimer* aTimer, void* aClosure);
|
||||
void StartForceKillTimer();
|
||||
|
|
|
@ -145,5 +145,11 @@ VideoDecoderManagerChild::DeallocateSurfaceDescriptorGPUVideo(const SurfaceDescr
|
|||
}), NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
void
|
||||
VideoDecoderManagerChild::FatalError(const char* const aName, const char* const aMsg) const
|
||||
{
|
||||
dom::ContentChild::FatalErrorIfNotUsingGPUProcess(aName, aMsg, OtherPid());
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -26,6 +26,8 @@ public:
|
|||
|
||||
void DeallocPVideoDecoderManagerChild() override;
|
||||
|
||||
void FatalError(const char* const aName, const char* const aMsg) const override;
|
||||
|
||||
// Main thread only
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "VsyncBridgeChild.h"
|
||||
#include "VsyncIOThreadHolder.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
@ -138,5 +139,11 @@ VsyncBridgeChild::ProcessingError(Result aCode, const char* aReason)
|
|||
MOZ_RELEASE_ASSERT(aCode == MsgDropped, "Processing error in VsyncBridgeChild");
|
||||
}
|
||||
|
||||
void
|
||||
VsyncBridgeChild::FatalError(const char* const aName, const char* const aMsg) const
|
||||
{
|
||||
dom::ContentChild::FatalErrorIfNotUsingGPUProcess(aName, aMsg, OtherPid());
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -33,6 +33,8 @@ public:
|
|||
|
||||
void NotifyVsync(TimeStamp aTimeStamp, const uint64_t& aLayersId);
|
||||
|
||||
virtual void FatalError(const char* const aName, const char* const aMsg) const override;
|
||||
|
||||
private:
|
||||
VsyncBridgeChild(RefPtr<VsyncIOThreadHolder>, const uint64_t& aProcessToken);
|
||||
~VsyncBridgeChild();
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "FrameLayerBuilder.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#if defined(XP_WIN)
|
||||
|
@ -1144,6 +1145,12 @@ CompositorBridgeChild::WillEndTransaction()
|
|||
ResetShmemCounter();
|
||||
}
|
||||
|
||||
void
|
||||
CompositorBridgeChild::FatalError(const char* const aName, const char* const aMsg) const
|
||||
{
|
||||
dom::ContentChild::FatalErrorIfNotUsingGPUProcess(aName, aMsg, OtherPid());
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -134,6 +134,8 @@ public:
|
|||
TextureFlags aFlags,
|
||||
uint64_t aSerial) override;
|
||||
|
||||
virtual void FatalError(const char* const aName, const char* const aMsg) const override;
|
||||
|
||||
/**
|
||||
* Request that the parent tell us when graphics are ready on GPU.
|
||||
* When we get that message, we bounce it to the TabParent via
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "mozilla/layers/LayersMessages.h" // for CompositableOperation
|
||||
#include "mozilla/layers/PCompositableChild.h" // for PCompositableChild
|
||||
#include "mozilla/layers/TextureClient.h" // for TextureClient
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/mozalloc.h" // for operator new, etc
|
||||
#include "mtransport/runnable_utils.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -1477,5 +1478,11 @@ ImageBridgeChild::CanSend() const
|
|||
return mCanSend;
|
||||
}
|
||||
|
||||
void
|
||||
ImageBridgeChild::FatalError(const char* const aName, const char* const aMsg) const
|
||||
{
|
||||
dom::ContentChild::FatalErrorIfNotUsingGPUProcess(aName, aMsg, OtherPid());
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -370,6 +370,8 @@ public:
|
|||
return InImageBridgeChildThread();
|
||||
}
|
||||
|
||||
virtual void FatalError(const char* const aName, const char* const aMsg) const override;
|
||||
|
||||
protected:
|
||||
ImageBridgeChild();
|
||||
bool DispatchAllocShmemInternal(size_t aSize,
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "mozilla/dom/Navigator.h"
|
||||
#include "mozilla/dom/VREventObserver.h"
|
||||
#include "mozilla/dom/WindowBinding.h" // for FrameRequestCallback
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/layers/TextureClient.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
|
@ -566,5 +567,11 @@ VRManagerChild::RemoveListener(dom::VREventObserver* aObserver)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
VRManagerChild::FatalError(const char* const aName, const char* const aMsg) const
|
||||
{
|
||||
dom::ContentChild::FatalErrorIfNotUsingGPUProcess(aName, aMsg, OtherPid());
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -83,6 +83,8 @@ public:
|
|||
void FireDOMVRDisplayDisconnectEvent();
|
||||
void FireDOMVRDisplayPresentChangeEvent();
|
||||
|
||||
virtual void FatalError(const char* const aName, const char* const aMsg) const override;
|
||||
|
||||
protected:
|
||||
explicit VRManagerChild();
|
||||
~VRManagerChild();
|
||||
|
|
Загрузка…
Ссылка в новой задаче