bcat: Make ProgressServiceBackend's constructor take a std::string_view

Given the string is appended to another, we can make it a view so a
redundant full copy of the string isn't made.
This commit is contained in:
Lioncash 2019-10-06 14:05:37 -04:00
parent f2fa16b609
commit 3fcd2180e4
2 changed files with 7 additions and 3 deletions

View File

@ -10,10 +10,11 @@
namespace Service::BCAT { namespace Service::BCAT {
ProgressServiceBackend::ProgressServiceBackend(std::string event_name) : impl{} { ProgressServiceBackend::ProgressServiceBackend(std::string_view event_name) : impl{} {
auto& kernel{Core::System::GetInstance().Kernel()}; auto& kernel{Core::System::GetInstance().Kernel()};
event = Kernel::WritableEvent::CreateEventPair( event = Kernel::WritableEvent::CreateEventPair(
kernel, Kernel::ResetType::Automatic, "ProgressServiceBackend:UpdateEvent:" + event_name); kernel, Kernel::ResetType::Automatic,
std::string("ProgressServiceBackend:UpdateEvent:").append(event_name));
} }
Kernel::SharedPtr<Kernel::ReadableEvent> ProgressServiceBackend::GetEvent() const { Kernel::SharedPtr<Kernel::ReadableEvent> ProgressServiceBackend::GetEvent() const {

View File

@ -6,6 +6,9 @@
#include <functional> #include <functional>
#include <optional> #include <optional>
#include <string>
#include <string_view>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/file_sys/vfs_types.h" #include "core/file_sys/vfs_types.h"
#include "core/hle/kernel/readable_event.h" #include "core/hle/kernel/readable_event.h"
@ -85,7 +88,7 @@ public:
void FinishDownload(ResultCode result); void FinishDownload(ResultCode result);
private: private:
explicit ProgressServiceBackend(std::string event_name); explicit ProgressServiceBackend(std::string_view event_name);
Kernel::SharedPtr<Kernel::ReadableEvent> GetEvent() const; Kernel::SharedPtr<Kernel::ReadableEvent> GetEvent() const;
DeliveryCacheProgressImpl& GetImpl(); DeliveryCacheProgressImpl& GetImpl();