FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
BrowserStreamManager.h
1 #pragma once
2 #ifndef BrowserStreamManager_h__
3 #define BrowserStreamManager_h__
4 
5 /**********************************************************\
6 Original Author: Richard Bateman
7 
8 Created: Jan 25, 2011
9 License: Dual license model; choose one of two:
10  New BSD License
11  http://www.opensource.org/licenses/bsd-license.php
12  - or -
13  GNU Lesser General Public License, version 2.1
14  http://www.gnu.org/licenses/lgpl-2.1.html
15 
16 Copyright 2011 Richard Bateman,
17  Firebreath development team
18 \**********************************************************/
19 
20 #include <set>
21 #include <boost/noncopyable.hpp>
22 #include <boost/thread/recursive_mutex.hpp>
23 #include "PluginEventSink.h"
24 #include "PluginEvents/StreamEvents.h"
25 #include "BrowserStream.h"
26 #include "FBPointers.h"
27 
28 namespace FB {
29 
30  class BrowserStreamManager : public FB::PluginEventSink
31  {
32  public:
33  BrowserStreamManager();
34  ~BrowserStreamManager();
35 
36  void retainStream(const BrowserStreamPtr& stream);
37  void releaseStream(const BrowserStreamPtr& stream);
38 
39  BEGIN_PLUGIN_EVENT_MAP()
40  EVENTTYPE_CASE(FB::StreamCompletedEvent, onStreamCompleted, FB::BrowserStream)
41  END_PLUGIN_EVENT_MAP()
42  virtual bool onStreamCompleted(FB::StreamCompletedEvent *evt, FB::BrowserStream *stream);
43  private:
44  std::set<BrowserStreamPtr> m_retainedStreams;
45  mutable boost::recursive_mutex m_xtmutex;
46  };
47 
48 };
49 #endif // BrowserStreamManager_h__
50 
Plugin event sink; all objects that can receive PluginEvent s should inherit from this class...