Flutter Engine
flutter::DisplayManager Class Reference

Manages lifecycle of the connected displays. This class is thread-safe. More...

#include <display_manager.h>

Public Member Functions

 DisplayManager ()
 
 ~DisplayManager ()
 
double GetMainDisplayRefreshRate () const
 
void HandleDisplayUpdates (DisplayUpdateType update_type, std::vector< Display > displays)
 Handles the display updates. More...
 

Detailed Description

Manages lifecycle of the connected displays. This class is thread-safe.

Definition at line 27 of file display_manager.h.

Constructor & Destructor Documentation

◆ DisplayManager()

flutter::DisplayManager::DisplayManager ( )
default

◆ ~DisplayManager()

flutter::DisplayManager::~DisplayManager ( )
default

Member Function Documentation

◆ GetMainDisplayRefreshRate()

double flutter::DisplayManager::GetMainDisplayRefreshRate ( ) const

Returns the display refresh rate of the main display. In cases where there is only one display connected, it will return that. We do not yet support cases where there are multiple displays.

When there are no registered displays, it returns kUnknownDisplayRefreshRate.

Definition at line 16 of file display_manager.cc.

References flutter::kUnknownDisplayRefreshRate.

16  {
17  std::scoped_lock lock(displays_mutex_);
18  if (displays_.empty()) {
20  } else {
21  return displays_[0].GetRefreshRate();
22  }
23 }
static constexpr double kUnknownDisplayRefreshRate
To be used when the display refresh rate is unknown.
Definition: display.h:17

◆ HandleDisplayUpdates()

void flutter::DisplayManager::HandleDisplayUpdates ( DisplayUpdateType  update_type,
std::vector< Display displays 
)

Handles the display updates.

Definition at line 25 of file display_manager.cc.

References FML_CHECK, and flutter::kStartup.

26  {
27  std::scoped_lock lock(displays_mutex_);
28  CheckDisplayConfiguration(displays);
29  switch (update_type) {
31  FML_CHECK(displays_.empty());
32  displays_ = displays;
33  return;
34  default:
35  FML_CHECK(false) << "Unknown DisplayUpdateType.";
36  }
37 }
#define FML_CHECK(condition)
Definition: logging.h:68

The documentation for this class was generated from the following files: