LLDB
mainline
|
BroadcasterImpl contains the actual Broadcaster implementation. More...
#include <Broadcaster.h>
Public Member Functions | |
BroadcasterImpl (Broadcaster &broadcaster) | |
~BroadcasterImpl ()=default | |
void | BroadcastEvent (lldb::EventSP &event_sp) |
void | BroadcastEventIfUnique (lldb::EventSP &event_sp) |
void | BroadcastEvent (uint32_t event_type, EventData *event_data=nullptr) |
void | BroadcastEvent (uint32_t event_type, const lldb::EventDataSP &event_data_sp) |
void | BroadcastEventIfUnique (uint32_t event_type, EventData *event_data=nullptr) |
void | Clear () |
uint32_t | AddListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask) |
const char * | GetBroadcasterName () const |
Broadcaster * | GetBroadcaster () |
bool | GetEventNames (Stream &s, const uint32_t event_mask, bool prefix_with_broadcaster_name) const |
void | SetEventName (uint32_t event_mask, const char *name) |
const char * | GetEventName (uint32_t event_mask) const |
bool | EventTypeHasListeners (uint32_t event_type) |
bool | RemoveListener (lldb_private::Listener *listener, uint32_t event_mask=UINT32_MAX) |
bool | RemoveListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX) |
bool | HijackBroadcaster (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX) |
bool | IsHijackedForEvent (uint32_t event_mask) |
void | RestoreBroadcaster () |
Protected Types | |
typedef llvm::SmallVector< std::pair< lldb::ListenerWP, uint32_t >, 4 > | collection |
typedef std::map< uint32_t, std::string > | event_names_map |
Protected Member Functions | |
void | PrivateBroadcastEvent (lldb::EventSP &event_sp, bool unique) |
const char * | GetHijackingListenerName () |
llvm::SmallVector< std::pair< lldb::ListenerSP, uint32_t & >, 4 > | GetListeners () |
Protected Attributes | |
Broadcaster & | m_broadcaster |
The broadcaster that this implements. More... | |
event_names_map | m_event_names |
Optionally define event names for readability and logging for each event bit. More... | |
collection | m_listeners |
A list of Listener / event_mask pairs that are listening to this broadcaster. More... | |
std::recursive_mutex | m_listeners_mutex |
A mutex that protects m_listeners. More... | |
std::vector< lldb::ListenerSP > | m_hijacking_listeners |
A simple mechanism to intercept events from a broadcaster. More... | |
std::vector< uint32_t > | m_hijacking_masks |
At some point we may want to have a stack or Listener collections, but for now this is just for private hijacking. More... | |
Private Member Functions | |
BroadcasterImpl (const BroadcasterImpl &)=delete | |
const BroadcasterImpl & | operator= (const BroadcasterImpl &)=delete |
Friends | |
class | Listener |
class | Broadcaster |
BroadcasterImpl contains the actual Broadcaster implementation.
The Broadcaster makes a BroadcasterImpl which lives as long as it does. The Listeners & the Events hold a weak pointer to the BroadcasterImpl, so that they can survive if a Broadcaster they were listening to is destroyed w/o their being able to unregister from it (which can happen if the Broadcasters & Listeners are being destroyed on separate threads simultaneously. The Broadcaster itself can't be shared out as a weak pointer, because some things that are broadcasters (e.g. the Target and the Process) are shared in their own right.
For the most part, the Broadcaster functions dispatch to the BroadcasterImpl, and are documented in the public Broadcaster API above.
Definition at line 422 of file Broadcaster.h.
|
protected |
Definition at line 489 of file Broadcaster.h.
|
protected |
Definition at line 490 of file Broadcaster.h.
Broadcaster::BroadcasterImpl::BroadcasterImpl | ( | Broadcaster & | broadcaster | ) |
Definition at line 34 of file Broadcaster.cpp.
|
default |
|
privatedelete |
uint32_t Broadcaster::BroadcasterImpl::AddListener | ( | const lldb::ListenerSP & | listener_sp, |
uint32_t | event_mask | ||
) |
Definition at line 114 of file Broadcaster.cpp.
void lldb_private::Broadcaster::BroadcasterImpl::BroadcastEvent | ( | lldb::EventSP & | event_sp | ) |
void Broadcaster::BroadcasterImpl::BroadcastEvent | ( | uint32_t | event_type, |
const lldb::EventDataSP & | event_data_sp | ||
) |
Definition at line 250 of file Broadcaster.cpp.
void Broadcaster::BroadcasterImpl::BroadcastEvent | ( | uint32_t | event_type, |
EventData * | event_data = nullptr |
||
) |
Definition at line 244 of file Broadcaster.cpp.
void lldb_private::Broadcaster::BroadcasterImpl::BroadcastEventIfUnique | ( | lldb::EventSP & | event_sp | ) |
void Broadcaster::BroadcasterImpl::BroadcastEventIfUnique | ( | uint32_t | event_type, |
EventData * | event_data = nullptr |
||
) |
Definition at line 256 of file Broadcaster.cpp.
void Broadcaster::BroadcasterImpl::Clear | ( | ) |
Definition at line 69 of file Broadcaster.cpp.
bool Broadcaster::BroadcasterImpl::EventTypeHasListeners | ( | uint32_t | event_type | ) |
Definition at line 148 of file Broadcaster.cpp.
Broadcaster * Broadcaster::BroadcasterImpl::GetBroadcaster | ( | ) |
Definition at line 80 of file Broadcaster.cpp.
|
inline |
Definition at line 448 of file Broadcaster.h.
References lldb_private::ConstString::AsCString(), lldb_private::Broadcaster::GetBroadcasterName(), and m_broadcaster.
|
inline |
Definition at line 461 of file Broadcaster.h.
References m_event_names.
bool Broadcaster::BroadcasterImpl::GetEventNames | ( | Stream & | s, |
const uint32_t | event_mask, | ||
bool | prefix_with_broadcaster_name | ||
) | const |
Definition at line 84 of file Broadcaster.cpp.
References lldb_private::bit(), lldb_private::Broadcaster::GetBroadcasterName(), lldb_private::Stream::PutChar(), and lldb_private::Stream::PutCString().
|
protected |
Definition at line 285 of file Broadcaster.cpp.
|
protected |
Definition at line 53 of file Broadcaster.cpp.
bool Broadcaster::BroadcasterImpl::HijackBroadcaster | ( | const lldb::ListenerSP & | listener_sp, |
uint32_t | event_mask = UINT32_MAX |
||
) |
Definition at line 262 of file Broadcaster.cpp.
References lldb_private::Events, lldb_private::Broadcaster::GetBroadcasterName(), lldb_private::GetLog(), and LLDB_LOG.
bool Broadcaster::BroadcasterImpl::IsHijackedForEvent | ( | uint32_t | event_mask | ) |
Definition at line 277 of file Broadcaster.cpp.
|
privatedelete |
|
protected |
Definition at line 189 of file Broadcaster.cpp.
References lldb_private::Events, lldb_private::Broadcaster::GetBroadcasterName(), lldb_private::StreamString::GetData(), lldb_private::GetLog(), and LLDB_LOGF.
bool Broadcaster::BroadcasterImpl::RemoveListener | ( | const lldb::ListenerSP & | listener_sp, |
uint32_t | event_mask = UINT32_MAX |
||
) |
Definition at line 176 of file Broadcaster.cpp.
References lldb_private::Broadcaster::RemoveListener().
bool Broadcaster::BroadcasterImpl::RemoveListener | ( | lldb_private::Listener * | listener, |
uint32_t | event_mask = UINT32_MAX |
||
) |
Definition at line 161 of file Broadcaster.cpp.
void Broadcaster::BroadcasterImpl::RestoreBroadcaster | ( | ) |
Definition at line 292 of file Broadcaster.cpp.
References lldb_private::Events, lldb_private::Broadcaster::GetBroadcasterName(), lldb_private::GetLog(), and LLDB_LOG.
|
inline |
Definition at line 457 of file Broadcaster.h.
References m_event_names.
|
friend |
Definition at line 424 of file Broadcaster.h.
|
friend |
Definition at line 423 of file Broadcaster.h.
|
protected |
The broadcaster that this implements.
Definition at line 496 of file Broadcaster.h.
Referenced by GetBroadcasterName().
|
protected |
Optionally define event names for readability and logging for each event bit.
Definition at line 500 of file Broadcaster.h.
Referenced by GetEventName(), and SetEventName().
|
protected |
A simple mechanism to intercept events from a broadcaster.
Definition at line 510 of file Broadcaster.h.
|
protected |
At some point we may want to have a stack or Listener collections, but for now this is just for private hijacking.
Definition at line 514 of file Broadcaster.h.
|
protected |
A list of Listener / event_mask pairs that are listening to this broadcaster.
Definition at line 504 of file Broadcaster.h.
|
protected |
A mutex that protects m_listeners.
Definition at line 507 of file Broadcaster.h.