fune/gfx/ipc/VsyncBridgeChild.h
Nika Layzell 2f2588cf4f Bug 1828389 - Ensure IPC channel is closed with error after KillHard, r=ipc-reviewers,mccr8
This patch changes KillHard() such that the IPC channel is immediately
shut down with an error after a KillHard() is performed. This is done by
fixing the previously-broken CLOSE_CHANNEL_WITH_ERROR support in
ShutDownProcess, and calling that method after KillHard().

This ensures that after the process has been killed, no further messages
will be delivered and processed, even if they were sent before the
process was killed.

In addition, the assertions and KillHard calls which are disabled for
fuzzing were changed to also shut down the channel, making fuzzing IPC
errors cause the connection to be terminated like it is in production
for these actors.

This change does not impact actors which ignore processing errors.

Differential Revision: https://phabricator.services.mozilla.com/D178383
2023-05-26 17:44:57 +00:00

55 lines
1.6 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 include_gfx_ipc_VsyncBridgeChild_h
#define include_gfx_ipc_VsyncBridgeChild_h
#include "mozilla/RefPtr.h"
#include "mozilla/gfx/PVsyncBridgeChild.h"
namespace mozilla {
namespace gfx {
class VsyncIOThreadHolder;
class VsyncBridgeChild final : public PVsyncBridgeChild {
friend class NotifyVsyncTask;
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VsyncBridgeChild, final)
static RefPtr<VsyncBridgeChild> Create(
RefPtr<VsyncIOThreadHolder> aThread, const uint64_t& aProcessToken,
Endpoint<PVsyncBridgeChild>&& aEndpoint);
void Close();
void ActorDestroy(ActorDestroyReason aWhy) override;
void ProcessingError(Result aCode, const char* aReason) override;
void NotifyVsync(const VsyncEvent& aVsync, const layers::LayersId& aLayersId);
void HandleFatalError(const char* aMsg) override;
private:
VsyncBridgeChild(RefPtr<VsyncIOThreadHolder>, const uint64_t& aProcessToken);
virtual ~VsyncBridgeChild();
void Open(Endpoint<PVsyncBridgeChild>&& aEndpoint);
void NotifyVsyncImpl(const VsyncEvent& aVsync,
const layers::LayersId& aLayersId);
bool IsOnVsyncIOThread() const;
private:
RefPtr<VsyncIOThreadHolder> mThread;
uint64_t mProcessToken;
};
} // namespace gfx
} // namespace mozilla
#endif // include_gfx_ipc_VsyncBridgeChild_h