hle: kernel: Migrate KProcess to KAutoObject.
This commit is contained in:
parent
5e5933256b
commit
7ccbdd4d8d
14 changed files with 80 additions and 58 deletions
|
@ -17,9 +17,8 @@ constexpr ResultCode ERROR_PROCESS_NOT_FOUND{ErrorModule::PM, 1};
|
|||
|
||||
constexpr u64 NO_PROCESS_FOUND_PID{0};
|
||||
|
||||
std::optional<std::shared_ptr<Kernel::Process>> SearchProcessList(
|
||||
const std::vector<std::shared_ptr<Kernel::Process>>& process_list,
|
||||
std::function<bool(const std::shared_ptr<Kernel::Process>&)> predicate) {
|
||||
std::optional<Kernel::Process*> SearchProcessList(const std::vector<Kernel::Process*>& process_list,
|
||||
std::function<bool(Kernel::Process*)> predicate) {
|
||||
const auto iter = std::find_if(process_list.begin(), process_list.end(), predicate);
|
||||
|
||||
if (iter == process_list.end()) {
|
||||
|
@ -30,7 +29,7 @@ std::optional<std::shared_ptr<Kernel::Process>> SearchProcessList(
|
|||
}
|
||||
|
||||
void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx,
|
||||
const std::vector<std::shared_ptr<Kernel::Process>>& process_list) {
|
||||
const std::vector<Kernel::Process*>& process_list) {
|
||||
const auto process = SearchProcessList(process_list, [](const auto& process) {
|
||||
return process->GetProcessID() == Kernel::Process::ProcessIDMin;
|
||||
});
|
||||
|
@ -125,8 +124,7 @@ private:
|
|||
|
||||
class Info final : public ServiceFramework<Info> {
|
||||
public:
|
||||
explicit Info(Core::System& system_,
|
||||
const std::vector<std::shared_ptr<Kernel::Process>>& process_list_)
|
||||
explicit Info(Core::System& system_, const std::vector<Kernel::Process*>& process_list_)
|
||||
: ServiceFramework{system_, "pm:info"}, process_list{process_list_} {
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, &Info::GetTitleId, "GetTitleId"},
|
||||
|
@ -156,7 +154,7 @@ private:
|
|||
rb.Push((*process)->GetTitleID());
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<Kernel::Process>>& process_list;
|
||||
const std::vector<Kernel::Process*>& process_list;
|
||||
};
|
||||
|
||||
class Shell final : public ServiceFramework<Shell> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue