gecko-dev/gfx/vr/FxRWindowManager.h
thomasmo ab2f648351 Bug 1581855:Part 2 - Present VR output to VR Host r=kip,jrmuizel,sotaro,bryce
This change is a continuation of Part 1 (Bug 1570128), where the 2D content rendered by Firefox for Firefox Reality on Desktop is marshalled through VRHost so that it can be presented in a VR environment.
A new class, FxrOutputHandler, is created to manage creating a sharable texture, sharing it through VRShMem, and updating it when content updates. This class updates content with both WebRender and conventional rendering output.
This initial iteration of FxrOutputHandler does not have synchronization between reading and writing this shared texture across processes. A subsequent fix (Bug 1581881) is pending, which will reuse WebVR code to manage writing to and reading from a pool of textures.
This also presents issues with rendering protected media, so an additional class, FxrWindowManager, is created to manage all windows created for Firefox Reality on Desktop so that it can inform whether or not protected media can be presented.
The automated manual tests in vrhosttest.cpp now show the real shared texture handle rather than a fake value, which shows that marshaling succeeded.

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

--HG--
extra : moz-landing-system : lando
2019-09-26 12:50:44 +00:00

28 lines
938 B
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#pragma once
#include <cstdint>
class nsPIDOMWindowOuter;
// FxRWindowManager is a singleton that is responsible for tracking all of
// the top-level windows created for Firefox Reality on Desktop. Only a
// single window is initially supported.
class FxRWindowManager final {
public:
static FxRWindowManager* GetInstance();
void AddWindow(nsPIDOMWindowOuter* aWindow);
bool IsFxRWindow(uint64_t aOuterWindowID);
private:
FxRWindowManager();
// Only a single window is supported for tracking. Support for multiple
// windows will require a data structure to collect windows as they are
// created.
nsPIDOMWindowOuter* mWindow;
};