Mir
screencast_buffer_tracker.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17 
18  #ifndef MIR_FRONTEND_SCREENCAST_BUFFER_TRACKER_H_
19  #define MIR_FRONTEND_SCREENCAST_BUFFER_TRACKER_H_
20 
22 
23 #include <functional>
24 #include <unordered_set>
25 #include <unordered_map>
26 
27 namespace mir
28 {
29 namespace graphics
30 {
31 class Buffer;
32 }
33 namespace frontend
34 {
35 
37 
39 {
40 public:
41  ScreencastBufferTracker() = default;
42  /* Track a buffer associated with a screencast session
43  * \param id id that the the buffer is associated with
44  * \param buffer buffer to be tracked
45  * \returns true if the buffer is already tracked
46  * false if the buffer is not tracked
47  */
48  bool track_buffer(ScreencastSessionId id, graphics::Buffer* buffer);
49 
50  /* removes all tracked buffers associated with id */
51  void remove_session(ScreencastSessionId id);
52 
53  /* Iterates over all tracked session ids */
54  void for_each_session(std::function<void(ScreencastSessionId)> f) const;
55 
56 
57 private:
59  ScreencastBufferTracker& operator=(ScreencastBufferTracker const&) = delete;
60 
61  std::unordered_map<ScreencastSessionId, std::unordered_set<graphics::Buffer *>> tracker;
62 };
63 
64 }
65 }
66 
67  #endif // MIR_FRONTEND_SCREENCAST_BUFFER_TRACKER_H_
All things Mir.
Definition: atomic_callback.h:25
Definition: int_wrapper.h:27
Responsible for tracking what buffers the client library knows about for a given screencast id...
Definition: screencast_buffer_tracker.h:38
Definition: buffer.h:44

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Sep 8 14:50:19 UTC 2016