bulbazord requested changes to this revision.
bulbazord added a comment.
This revision now requires changes to proceed.

Thanks for all the work to clean up some of those interfaces! I know that was 
not straightforward. :)

I left a few more comments about minor things I noticed while re-reading this. 
I'm going to request changes to put this back into your queue.



================
Comment at: lldb/include/lldb/Utility/Event.h:233
+    m_pending_listeners.push_back(pending_listener_sp);
+  };
+
----------------
nit: trailing semicolon


================
Comment at: lldb/source/Target/Process.cpp:620-621
 
-  if (m_listener_sp->GetEventForBroadcaster(this, event_sp,
+  if (GetPrimaryListener()->GetEventForBroadcaster(this, event_sp,
                                             std::chrono::seconds(0)) &&
       event_sp)
----------------
Do you need to check for the validity of the primary listener before using it? 
It can point to nullptr from what I can tell


================
Comment at: lldb/source/Utility/Broadcaster.cpp:59
+    max_count++;
+  listeners.reserve(max_count);
 
----------------
I wonder if we should be reserving at all considering we're using an 
`llvm::SmallVector<$type, 4>`.  The point of a SmallVector is that on average 
it should be small and only sometimes should we be exceeding that hardcoded 
size. This means that if there are 8 listeners but only 2 are relevant, we're 
taking a SmallVector of size 4 and allocating space for 8 listeners (always 
triggering a memory allocation) even if it will only ever have 2 listeners in 
it.

I know that's the existing behavior and you're just preserving it, but 
something to think about for the future.


================
Comment at: lldb/source/Utility/Broadcaster.cpp:179-181
+  // The primary listener listens for all event bits:
+  if (m_primary_listener_sp)
+    return true;
----------------
This check is a bit redundant since `HasListeners` performs the exact same check


================
Comment at: lldb/source/Utility/Broadcaster.cpp:198
+
   std::lock_guard<std::recursive_mutex> guard(m_listeners_mutex);
+  for (auto it = m_listeners.begin(); it != m_listeners.end();) {
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157556/new/

https://reviews.llvm.org/D157556

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to