1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "flutter/shell/common/display_manager.h"
6
7#include "flutter/fml/logging.h"
8#include "flutter/fml/macros.h"
9
10namespace flutter {
11
12DisplayManager::DisplayManager() = default;
13
14DisplayManager::~DisplayManager() = default;
15
16double DisplayManager::GetMainDisplayRefreshRate() const {
17 std::scoped_lock lock(displays_mutex_);
18 if (displays_.empty()) {
19 return kUnknownDisplayRefreshRate;
20 } else {
21 return displays_[0]->GetRefreshRate();
22 }
23}
24
25void DisplayManager::HandleDisplayUpdates(
26 std::vector<std::unique_ptr<Display>> displays) {
27 FML_DCHECK(!displays.empty());
28 std::scoped_lock lock(displays_mutex_);
29 displays_ = std::move(displays);
30}
31
32} // namespace flutter
33

source code of flutter_engine/flutter/shell/common/display_manager.cc