client_session.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 KThread;
  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<KThread> thread, Core::Memory::Memory& memory,
  36. Core::Timing::CoreTiming& core_timing);
  37. bool IsSignaled() const override;
  38. void Finalize() override {}
  39. private:
  40. static ResultVal<std::shared_ptr<ClientSession>> Create(KernelCore& kernel,
  41. std::shared_ptr<Session> parent,
  42. std::string name = "Unknown");
  43. /// The parent session, which links to the server endpoint.
  44. std::shared_ptr<Session> parent;
  45. /// Name of the client session (optional)
  46. std::string name;
  47. };
  48. } // namespace Kernel