Move DisplayMode out of SurfaceHandler

Summary:
This diff moves DisplayMode out of SurfaceHandler, this is necessary in order to use it from react/uimanager package

changelog: [internal] internal

Reviewed By: ShikaSD

Differential Revision: D27669846

fbshipit-source-id: 274869d8f2907b1b159f51240440acece09a746f
This commit is contained in:
David Vacca 2021-04-12 00:03:16 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 84c70b2a7f
Коммит 2793bba278
4 изменённых файлов: 36 добавлений и 38 удалений

Просмотреть файл

@ -17,14 +17,13 @@ SurfaceHandlerBinding::SurfaceHandlerBinding(
: surfaceHandler_(moduleName, surfaceId) {}
void SurfaceHandlerBinding::setDisplayMode(jint mode) {
surfaceHandler_.setDisplayMode(
static_cast<SurfaceHandler::DisplayMode>(mode));
surfaceHandler_.setDisplayMode(static_cast<DisplayMode>(mode));
}
void SurfaceHandlerBinding::start() {
std::unique_lock<better::shared_mutex> lock(lifecycleMutex_);
surfaceHandler_.setDisplayMode(SurfaceHandler::DisplayMode::Visible);
surfaceHandler_.setDisplayMode(DisplayMode::Visible);
if (surfaceHandler_.getStatus() != SurfaceHandler::Status::Running) {
surfaceHandler_.start();
}

Просмотреть файл

@ -42,5 +42,39 @@ using ComponentHandle = int64_t;
*/
using ComponentName = char const *;
/*
* Defines how visual side effects (views, images, text, and so on) are
* mounted (on not) on the screen.
*/
enum class DisplayMode {
/*
* The surface is running normally. All visual side-effects will be rendered
* on the screen.
*/
Visible = 0,
/*
* The surface is `Suspended`. All new (committed after switching to the
* mode) visual side-effects will *not* be mounted on the screen (the screen
* will stop updating).
*
* The mode can be used for preparing a surface for possible future use.
* The surface will be prepared without spending computing resources
* on mounting, and then can be instantly mounted if needed.
*/
Suspended = 1,
/*
* The surface is `Hidden`. All previously mounted visual side-effects
* will be unmounted, and all new (committed after switching to the mode)
* visual side-effects will *not* be mounted on the screen until the mode is
* switched back to `normal`.
*
* The mode can be used for temporarily freeing computing resources of
* off-the-screen surfaces.
*/
Hidden = 2,
};
} // namespace react
} // namespace facebook

Просмотреть файл

@ -15,7 +15,6 @@ namespace facebook {
namespace react {
using Status = SurfaceHandler::Status;
using DisplayMode = SurfaceHandler::DisplayMode;
SurfaceHandler::SurfaceHandler(
std::string const &moduleName,

Просмотреть файл

@ -57,40 +57,6 @@ class SurfaceHandler final {
Running = 2,
};
/*
* Defines how visual side effects (views, images, text, and so on) are
* mounted (on not) on the screen.
*/
enum class DisplayMode {
/*
* The surface is running normally. All visual side-effects will be rendered
* on the screen.
*/
Visible = 0,
/*
* The surface is `Suspended`. All new (committed after switching to the
* mode) visual side-effects will *not* be mounted on the screen (the screen
* will stop updating).
*
* The mode can be used for preparing a surface for possible future use.
* The surface will be prepared without spending computing resources
* on mounting, and then can be instantly mounted if needed.
*/
Suspended = 1,
/*
* The surface is `Hidden`. All previously mounted visual side-effects
* will be unmounted, and all new (committed after switching to the mode)
* visual side-effects will *not* be mounted on the screen until the mode is
* switched back to `normal`.
*
* The mode can be used for temporarily freeing computing resources of
* off-the-screen surfaces.
*/
Hidden = 2,
};
/*
* Can be constructed anytime with a `moduleName` and a `surfaceId`.
*/