2021-11-04 19:29:44 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
include protocol PWebGL;
|
|
|
|
|
Bug 1736177 - Part 9. Add plumbing to snapshot worker canvas contexts from the main thread. r=jgilbert,ipc-reviewers,nika
Right now, if we wanted to get a snapshot of an OffscreenCanvas context
on a worker thread from the main thread, we would need to block the main
thread on the worker thread, and from the worker thread, issue a sync
IPC call get the front buffer snapshot.
This patch adds an alternative which allows the main thread to go
directly to the canvas owning thread in the compositor process to get
the snapshot, thereby bypassing the worker thread in content process
entirely. All it needs as the unique ID of the CanvasManagerChild
instance, and the protocol ID of the WebGLChild instance.
This will be used for Firefox screenshots, New Tab tiles, and printing.
Differential Revision: https://phabricator.services.mozilla.com/D130785
2021-12-10 05:57:55 +03:00
|
|
|
using mozilla::webgl::FrontBufferSnapshotIpc from "mozilla/dom/WebGLIpdl.h";
|
|
|
|
|
2021-11-04 19:29:44 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The PCanvasManager protocol is the top-level protocol between the main and
|
|
|
|
* worker threads in the content process, and the renderer thread in the
|
|
|
|
* compositor process. This protocol should be used to create accelerated
|
|
|
|
* canvas instances.
|
|
|
|
*/
|
|
|
|
[RefCounted] sync protocol PCanvasManager
|
|
|
|
{
|
|
|
|
manages PWebGL;
|
|
|
|
|
|
|
|
parent:
|
|
|
|
// Actor that represents one WebGL context.
|
|
|
|
async PWebGL();
|
Bug 1736177 - Part 9. Add plumbing to snapshot worker canvas contexts from the main thread. r=jgilbert,ipc-reviewers,nika
Right now, if we wanted to get a snapshot of an OffscreenCanvas context
on a worker thread from the main thread, we would need to block the main
thread on the worker thread, and from the worker thread, issue a sync
IPC call get the front buffer snapshot.
This patch adds an alternative which allows the main thread to go
directly to the canvas owning thread in the compositor process to get
the snapshot, thereby bypassing the worker thread in content process
entirely. All it needs as the unique ID of the CanvasManagerChild
instance, and the protocol ID of the WebGLChild instance.
This will be used for Firefox screenshots, New Tab tiles, and printing.
Differential Revision: https://phabricator.services.mozilla.com/D130785
2021-12-10 05:57:55 +03:00
|
|
|
|
|
|
|
// Set the local manager ID for the canvas manager.
|
|
|
|
async Initialize(uint32_t aManagerId);
|
|
|
|
|
|
|
|
// Get the front buffer pixels for the given manager/protocol. This is
|
|
|
|
// intended to be used by the main thread in the content process to block
|
|
|
|
// reading without having to block on the worker thread that owns the context
|
|
|
|
// instance.
|
|
|
|
sync GetSnapshot(uint32_t aManagerId, int32_t aProtocolId) returns (FrontBufferSnapshotIpc ret);
|
2021-11-04 19:29:44 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // gfx
|
|
|
|
} // mozilla
|