client_session.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright 2019 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <memory>
  6. #include <string>
  7. #include "core/hle/kernel/k_synchronization_object.h"
  8. #include "core/hle/result.h"
  9. union ResultCode;
  10. namespace Core::Memory {
  11. class Memory;
  12. }
  13. namespace Core::Timing {
  14. class CoreTiming;
  15. }
  16. namespace Kernel {
  17. class KernelCore;
  18. class Session;
  19. class Thread;
  20. class ClientSession final : public KSynchronizationObject {
  21. public:
  22. explicit ClientSession(KernelCore& kernel);
  23. ~ClientSession() override;
  24. friend class Session;
  25. std::string GetTypeName() const override {
  26. return "ClientSession";
  27. }
  28. std::string GetName() const override {
  29. return name;
  30. }
  31. static constexpr HandleType HANDLE_TYPE = HandleType::ClientSession;
  32. HandleType GetHandleType() const override {
  33. return HANDLE_TYPE;
  34. }
  35. ResultCode SendSyncRequest(std::shared_ptr<Thread> thread, Core::Memory::Memory& memory,
  36. Core::Timing::CoreTiming& core_timing);
  37. bool IsSignaled() const override;
  38. private:
  39. static ResultVal<std::shared_ptr<ClientSession>> Create(KernelCore& kernel,
  40. std::shared_ptr<Session> parent,
  41. std::string name = "Unknown");
  42. /// The parent session, which links to the server endpoint.
  43. std::shared_ptr<Session> parent;
  44. /// Name of the client session (optional)
  45. std::string name;
  46. };
  47. } // namespace Kernel