service: Eliminate cases of member shadowing

Resolves a few localized instances of member variable shadowing. Brings
us a little closer to turning shadowing warnings into errors.
This commit is contained in:
Lioncash 2021-04-26 09:11:33 -04:00
parent 7412f314e4
commit dcb91ca4a4
15 changed files with 81 additions and 76 deletions

View file

@ -41,24 +41,22 @@ void Display::SignalVSyncEvent() {
vsync_event->GetWritableEvent()->Signal();
}
void Display::CreateLayer(u64 id, NVFlinger::BufferQueue& buffer_queue) {
void Display::CreateLayer(u64 layer_id, NVFlinger::BufferQueue& buffer_queue) {
// TODO(Subv): Support more than 1 layer.
ASSERT_MSG(layers.empty(), "Only one layer is supported per display at the moment");
layers.emplace_back(std::make_shared<Layer>(id, buffer_queue));
layers.emplace_back(std::make_shared<Layer>(layer_id, buffer_queue));
}
void Display::CloseLayer(u64 id) {
layers.erase(
std::remove_if(layers.begin(), layers.end(),
[id](const std::shared_ptr<Layer>& layer) { return layer->GetID() == id; }),
layers.end());
void Display::CloseLayer(u64 layer_id) {
std::erase_if(layers, [layer_id](const auto& layer) { return layer->GetID() == layer_id; });
}
Layer* Display::FindLayer(u64 id) {
Layer* Display::FindLayer(u64 layer_id) {
const auto itr =
std::find_if(layers.begin(), layers.end(),
[id](const std::shared_ptr<Layer>& layer) { return layer->GetID() == id; });
std::find_if(layers.begin(), layers.end(), [layer_id](const std::shared_ptr<Layer>& layer) {
return layer->GetID() == layer_id;
});
if (itr == layers.end()) {
return nullptr;
@ -67,10 +65,11 @@ Layer* Display::FindLayer(u64 id) {
return itr->get();
}
const Layer* Display::FindLayer(u64 id) const {
const Layer* Display::FindLayer(u64 layer_id) const {
const auto itr =
std::find_if(layers.begin(), layers.end(),
[id](const std::shared_ptr<Layer>& layer) { return layer->GetID() == id; });
std::find_if(layers.begin(), layers.end(), [layer_id](const std::shared_ptr<Layer>& layer) {
return layer->GetID() == layer_id;
});
if (itr == layers.end()) {
return nullptr;

View file

@ -68,34 +68,34 @@ public:
/// Creates and adds a layer to this display with the given ID.
///
/// @param id The ID to assign to the created layer.
/// @param layer_id The ID to assign to the created layer.
/// @param buffer_queue The buffer queue for the layer instance to use.
///
void CreateLayer(u64 id, NVFlinger::BufferQueue& buffer_queue);
void CreateLayer(u64 layer_id, NVFlinger::BufferQueue& buffer_queue);
/// Closes and removes a layer from this display with the given ID.
///
/// @param id The ID assigned to the layer to close.
/// @param layer_id The ID assigned to the layer to close.
///
void CloseLayer(u64 id);
void CloseLayer(u64 layer_id);
/// Attempts to find a layer with the given ID.
///
/// @param id The layer ID.
/// @param layer_id The layer ID.
///
/// @returns If found, the Layer instance with the given ID.
/// If not found, then nullptr is returned.
///
Layer* FindLayer(u64 id);
Layer* FindLayer(u64 layer_id);
/// Attempts to find a layer with the given ID.
///
/// @param id The layer ID.
/// @param layer_id The layer ID.
///
/// @returns If found, the Layer instance with the given ID.
/// If not found, then nullptr is returned.
///
const Layer* FindLayer(u64 id) const;
const Layer* FindLayer(u64 layer_id) const;
private:
u64 id;