service/nvflinger: Store BufferQueue instances as regular data members

The NVFlinger service is already passed into services that need to
guarantee its lifetime, so the BufferQueue instances will already live
as long as they're needed. Making them std::shared_ptr instances in this
case is unnecessary.
This commit is contained in:
Lioncash
2019-02-21 11:31:53 -05:00
parent fd15730767
commit 90528f1326
7 changed files with 39 additions and 36 deletions

View File

@@ -2,16 +2,11 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include "common/assert.h"
#include "core/hle/service/vi/layer/vi_layer.h"
namespace Service::VI {
Layer::Layer(u64 id, std::shared_ptr<NVFlinger::BufferQueue> queue)
: id{id}, buffer_queue{std::move(queue)}
{
ASSERT_MSG(buffer_queue != nullptr, "buffer_queue may not be null.");
}
Layer::Layer(u64 id, NVFlinger::BufferQueue& queue) : id{id}, buffer_queue{queue} {}
Layer::~Layer() = default;

View File

@@ -4,8 +4,6 @@
#pragma once
#include <memory>
#include "common/common_types.h"
namespace Service::NVFlinger {
@@ -22,14 +20,14 @@ public:
/// @param id The ID to assign to this layer.
/// @param queue The buffer queue for this layer to use.
///
Layer(u64 id, std::shared_ptr<NVFlinger::BufferQueue> queue);
Layer(u64 id, NVFlinger::BufferQueue& queue);
~Layer();
Layer(const Layer&) = delete;
Layer& operator=(const Layer&) = delete;
Layer(Layer&&) = default;
Layer& operator=(Layer&&) = default;
Layer& operator=(Layer&&) = delete;
/// Gets the ID for this layer.
u64 GetID() const {
@@ -38,17 +36,17 @@ public:
/// Gets a reference to the buffer queue this layer is using.
NVFlinger::BufferQueue& GetBufferQueue() {
return *buffer_queue;
return buffer_queue;
}
/// Gets a const reference to the buffer queue this layer is using.
const NVFlinger::BufferQueue& GetBufferQueue() const {
return *buffer_queue;
return buffer_queue;
}
private:
u64 id;
std::shared_ptr<NVFlinger::BufferQueue> buffer_queue;
NVFlinger::BufferQueue& buffer_queue;
};
} // namespace Service::VI