flutter_flutter/shell/common/layer_tree_holder.cc
Kaushik Iska 983de2c402
Remove pipeline in favor of layer tree holder (#17688)
go/flutter-pipeline-improvements for more details.
2020-05-08 10:51:10 -07:00

29 lines
791 B
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/shell/common/layer_tree_holder.h"
namespace flutter {
std::unique_ptr<LayerTree> LayerTreeHolder::Get() {
std::scoped_lock lock(layer_tree_mutex);
return std::move(layer_tree_);
}
void LayerTreeHolder::ReplaceIfNewer(
std::unique_ptr<LayerTree> proposed_layer_tree) {
std::scoped_lock lock(layer_tree_mutex);
if (!layer_tree_ ||
layer_tree_->target_time() < proposed_layer_tree->target_time()) {
layer_tree_ = std::move(proposed_layer_tree);
}
}
bool LayerTreeHolder::IsEmpty() const {
std::scoped_lock lock(layer_tree_mutex);
return !layer_tree_;
}
}; // namespace flutter