FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
bool FB::PluginEventSource::SendEvent ( PluginEvent evt)
virtual

Sends an event to all attached sinks.

Parameters
evtThe event to send
Returns
true if the event was handled, false if it was not

Definition at line 76 of file PluginEventSource.cpp.

References m_observerLock.

Referenced by FB::BrowserStream::~BrowserStream().

77 {
78  boost::recursive_mutex::scoped_lock _l(m_observerLock);
79 
80  // Sometimes the events cause an observer to be removed; we make a copy so that
81  // it doesn't mess with our iterator. Remember that removing an observer will only take
82  // affect on the next SendEvent call
83  ObserverMap copy(m_observers);
84  ObserverMap::iterator it = copy.begin();
85 
86  while (it != copy.end()) {
87  PluginEventSinkPtr tmp = it->lock();
88  if (tmp && tmp->HandleEvent(evt, this)) {
89  return true; // Tell the caller that the event was handled
90  }
91  ++it;
92  }
93  return false;
94 }
boost::recursive_mutex m_observerLock
List of attached observers.
std::list< PluginEventSinkWeakPtr > ObserverMap
Defines an alias representing the observer .