From 0d6bfc1a6b052fc7f1a70dd8797726fc4d4eba52 Mon Sep 17 00:00:00 2001 From: gibbed Date: Mon, 29 Jul 2019 13:43:13 -0500 Subject: [PATCH] [Kernel] Rename NotifyListener to XNotifyListener to bring it in line with the naming scheme of kernel objects. --- src/xenia/kernel/kernel_state.cc | 6 ++-- src/xenia/kernel/kernel_state.h | 8 +++--- src/xenia/kernel/xam/xam_notify.cc | 6 ++-- ...{notify_listener.cc => xnotifylistener.cc} | 28 +++++++++---------- .../{notify_listener.h => xnotifylistener.h} | 16 +++++------ src/xenia/kernel/xobject.cc | 4 +-- 6 files changed, 34 insertions(+), 34 deletions(-) rename src/xenia/kernel/{notify_listener.cc => xnotifylistener.cc} (76%) rename src/xenia/kernel/{notify_listener.h => xnotifylistener.h} (79%) diff --git a/src/xenia/kernel/kernel_state.cc b/src/xenia/kernel/kernel_state.cc index 94a3beac5..3d28b374a 100644 --- a/src/xenia/kernel/kernel_state.cc +++ b/src/xenia/kernel/kernel_state.cc @@ -19,13 +19,13 @@ #include "xenia/base/string.h" #include "xenia/cpu/processor.h" #include "xenia/emulator.h" -#include "xenia/kernel/notify_listener.h" #include "xenia/kernel/user_module.h" #include "xenia/kernel/util/shim_utils.h" #include "xenia/kernel/xam/xam_module.h" #include "xenia/kernel/xboxkrnl/xboxkrnl_module.h" #include "xenia/kernel/xevent.h" #include "xenia/kernel/xmodule.h" +#include "xenia/kernel/xnotifylistener.h" #include "xenia/kernel/xobject.h" #include "xenia/kernel/xthread.h" @@ -573,7 +573,7 @@ object_ref KernelState::GetThreadByID(uint32_t thread_id) { return retain_object(thread); } -void KernelState::RegisterNotifyListener(NotifyListener* listener) { +void KernelState::RegisterNotifyListener(XNotifyListener* listener) { auto global_lock = global_critical_region_.Acquire(); notify_listeners_.push_back(retain_object(listener)); @@ -597,7 +597,7 @@ void KernelState::RegisterNotifyListener(NotifyListener* listener) { } } -void KernelState::UnregisterNotifyListener(NotifyListener* listener) { +void KernelState::UnregisterNotifyListener(XNotifyListener* listener) { auto global_lock = global_critical_region_.Acquire(); for (auto it = notify_listeners_.begin(); it != notify_listeners_.end(); ++it) { diff --git a/src/xenia/kernel/kernel_state.h b/src/xenia/kernel/kernel_state.h index d78eaf421..cc92a9813 100644 --- a/src/xenia/kernel/kernel_state.h +++ b/src/xenia/kernel/kernel_state.h @@ -48,7 +48,7 @@ class Dispatcher; class XHostThread; class KernelModule; class XModule; -class NotifyListener; +class XNotifyListener; class XThread; class UserModule; @@ -158,8 +158,8 @@ class KernelState { void OnThreadExit(XThread* thread); object_ref GetThreadByID(uint32_t thread_id); - void RegisterNotifyListener(NotifyListener* listener); - void UnregisterNotifyListener(NotifyListener* listener); + void RegisterNotifyListener(XNotifyListener* listener); + void UnregisterNotifyListener(XNotifyListener* listener); void BroadcastNotification(XNotificationID id, uint32_t data); util::NativeList* dpc_list() { return &dpc_list_; } @@ -196,7 +196,7 @@ class KernelState { // Must be guarded by the global critical region. util::ObjectTable object_table_; std::unordered_map threads_by_id_; - std::vector> notify_listeners_; + std::vector> notify_listeners_; bool has_notified_startup_ = false; uint32_t process_type_ = X_PROCTYPE_USER; diff --git a/src/xenia/kernel/xam/xam_notify.cc b/src/xenia/kernel/xam/xam_notify.cc index e3765af25..d65b0906a 100644 --- a/src/xenia/kernel/xam/xam_notify.cc +++ b/src/xenia/kernel/xam/xam_notify.cc @@ -9,9 +9,9 @@ #include "xenia/base/logging.h" #include "xenia/kernel/kernel_state.h" -#include "xenia/kernel/notify_listener.h" #include "xenia/kernel/util/shim_utils.h" #include "xenia/kernel/xam/xam_private.h" +#include "xenia/kernel/xnotifylistener.h" #include "xenia/xbox.h" namespace xe { @@ -23,7 +23,7 @@ dword_result_t XamNotifyCreateListenerInternal(qword_t mask, dword_t unk, // r4=1 may indicate user process? auto listener = - object_ref(new NotifyListener(kernel_state())); + object_ref(new XNotifyListener(kernel_state())); listener->Initialize(mask); // Handle ref is incremented, so return that. @@ -48,7 +48,7 @@ dword_result_t XNotifyGetNext(dword_t handle, dword_t match_id, // Grab listener. auto listener = - kernel_state()->object_table()->LookupObject(handle); + kernel_state()->object_table()->LookupObject(handle); if (!listener) { return 0; } diff --git a/src/xenia/kernel/notify_listener.cc b/src/xenia/kernel/xnotifylistener.cc similarity index 76% rename from src/xenia/kernel/notify_listener.cc rename to src/xenia/kernel/xnotifylistener.cc index 81cc1d35b..e1127433c 100644 --- a/src/xenia/kernel/notify_listener.cc +++ b/src/xenia/kernel/xnotifylistener.cc @@ -7,7 +7,7 @@ ****************************************************************************** */ -#include "xenia/kernel/notify_listener.h" +#include "xenia/kernel/xnotifylistener.h" #include "xenia/base/byte_stream.h" #include "xenia/kernel/kernel_state.h" @@ -15,12 +15,12 @@ namespace xe { namespace kernel { -NotifyListener::NotifyListener(KernelState* kernel_state) +XNotifyListener::XNotifyListener(KernelState* kernel_state) : XObject(kernel_state, kTypeNotifyListener) {} -NotifyListener::~NotifyListener() {} +XNotifyListener::~XNotifyListener() {} -void NotifyListener::Initialize(uint64_t mask) { +void XNotifyListener::Initialize(uint64_t mask) { assert_false(wait_handle_); wait_handle_ = xe::threading::Event::CreateManualResetEvent(false); @@ -29,7 +29,7 @@ void NotifyListener::Initialize(uint64_t mask) { kernel_state_->RegisterNotifyListener(this); } -void NotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) { +void XNotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) { // Ignore if the notification doesn't match our mask. if ((mask_ & uint64_t(1ULL << (id >> 25))) == 0) { return; @@ -47,8 +47,8 @@ void NotifyListener::EnqueueNotification(XNotificationID id, uint32_t data) { wait_handle_->Set(); } -bool NotifyListener::DequeueNotification(XNotificationID* out_id, - uint32_t* out_data) { +bool XNotifyListener::DequeueNotification(XNotificationID* out_id, + uint32_t* out_data) { auto global_lock = global_critical_region_.Acquire(); bool dequeued = false; if (notification_count_) { @@ -65,8 +65,8 @@ bool NotifyListener::DequeueNotification(XNotificationID* out_id, return dequeued; } -bool NotifyListener::DequeueNotification(XNotificationID id, - uint32_t* out_data) { +bool XNotifyListener::DequeueNotification(XNotificationID id, + uint32_t* out_data) { auto global_lock = global_critical_region_.Acquire(); bool dequeued = false; if (notification_count_) { @@ -84,7 +84,7 @@ bool NotifyListener::DequeueNotification(XNotificationID id, return dequeued; } -bool NotifyListener::Save(ByteStream* stream) { +bool XNotifyListener::Save(ByteStream* stream) { SaveObject(stream); stream->Write(mask_); @@ -99,9 +99,9 @@ bool NotifyListener::Save(ByteStream* stream) { return true; } -object_ref NotifyListener::Restore(KernelState* kernel_state, - ByteStream* stream) { - auto notify = new NotifyListener(nullptr); +object_ref XNotifyListener::Restore(KernelState* kernel_state, + ByteStream* stream) { + auto notify = new XNotifyListener(nullptr); notify->kernel_state_ = kernel_state; notify->RestoreObject(stream); @@ -115,7 +115,7 @@ object_ref NotifyListener::Restore(KernelState* kernel_state, notify->notifications_.insert(pair); } - return object_ref(notify); + return object_ref(notify); } } // namespace kernel diff --git a/src/xenia/kernel/notify_listener.h b/src/xenia/kernel/xnotifylistener.h similarity index 79% rename from src/xenia/kernel/notify_listener.h rename to src/xenia/kernel/xnotifylistener.h index 47428252a..83599dd0b 100644 --- a/src/xenia/kernel/notify_listener.h +++ b/src/xenia/kernel/xnotifylistener.h @@ -7,8 +7,8 @@ ****************************************************************************** */ -#ifndef XENIA_KERNEL_NOTIFY_LISTENER_H_ -#define XENIA_KERNEL_NOTIFY_LISTENER_H_ +#ifndef XENIA_KERNEL_XNOTIFYLISTENER_H_ +#define XENIA_KERNEL_XNOTIFYLISTENER_H_ #include #include @@ -21,12 +21,12 @@ namespace xe { namespace kernel { -class NotifyListener : public XObject { +class XNotifyListener : public XObject { public: static const Type kType = kTypeNotifyListener; - explicit NotifyListener(KernelState* kernel_state); - ~NotifyListener() override; + explicit XNotifyListener(KernelState* kernel_state); + ~XNotifyListener() override; uint64_t mask() const { return mask_; } @@ -37,8 +37,8 @@ class NotifyListener : public XObject { bool DequeueNotification(XNotificationID id, uint32_t* out_data); bool Save(ByteStream* stream) override; - static object_ref Restore(KernelState* kernel_state, - ByteStream* stream); + static object_ref Restore(KernelState* kernel_state, + ByteStream* stream); protected: xe::threading::WaitHandle* GetWaitHandle() override { @@ -56,4 +56,4 @@ class NotifyListener : public XObject { } // namespace kernel } // namespace xe -#endif // XENIA_KERNEL_NOTIFY_LISTENER_H_ +#endif // XENIA_KERNEL_XNOTIFYLISTENER_H_ diff --git a/src/xenia/kernel/xobject.cc b/src/xenia/kernel/xobject.cc index 91fad29ce..19434d97a 100644 --- a/src/xenia/kernel/xobject.cc +++ b/src/xenia/kernel/xobject.cc @@ -14,13 +14,13 @@ #include "xenia/base/byte_stream.h" #include "xenia/base/clock.h" #include "xenia/kernel/kernel_state.h" -#include "xenia/kernel/notify_listener.h" #include "xenia/kernel/xboxkrnl/xboxkrnl_private.h" #include "xenia/kernel/xenumerator.h" #include "xenia/kernel/xevent.h" #include "xenia/kernel/xfile.h" #include "xenia/kernel/xmodule.h" #include "xenia/kernel/xmutant.h" +#include "xenia/kernel/xnotifylistener.h" #include "xenia/kernel/xsemaphore.h" #include "xenia/kernel/xthread.h" @@ -139,7 +139,7 @@ object_ref XObject::Restore(KernelState* kernel_state, Type type, case kTypeMutant: return XMutant::Restore(kernel_state, stream); case kTypeNotifyListener: - return NotifyListener::Restore(kernel_state, stream); + return XNotifyListener::Restore(kernel_state, stream); case kTypeSemaphore: return XSemaphore::Restore(kernel_state, stream); case kTypeSession: