Mir
buffer_map.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 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  * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_COMPOSITOR_BUFFER_MAP_H_
20 #define MIR_COMPOSITOR_BUFFER_MAP_H_
21 
24 #include <mutex>
25 #include <map>
26 
27 namespace mir
28 {
29 namespace graphics { class GraphicBufferAllocator; }
30 namespace frontend { class EventSink; }
31 namespace compositor
32 {
34 {
35 public:
36  BufferMap(
38  std::shared_ptr<frontend::EventSink> const& sink,
39  std::shared_ptr<graphics::GraphicBufferAllocator> const& allocator);
40 
41  graphics::BufferID add_buffer(graphics::BufferProperties const& properties) override;
42  void remove_buffer(graphics::BufferID id) override;
43  void send_buffer(graphics::BufferID id) override;
44  std::shared_ptr<graphics::Buffer>& operator[](graphics::BufferID) override;
45 
46 private:
47  std::mutex mutable mutex;
48  typedef std::map<graphics::BufferID, std::shared_ptr<graphics::Buffer>> Map;
49  //used to keep strong reference
50  Map buffers;
51  Map::iterator checked_buffers_find(graphics::BufferID, std::unique_lock<std::mutex> const&);
52 
53  frontend::BufferStreamId const stream_id;
54  std::shared_ptr<frontend::EventSink> const sink;
55  std::shared_ptr<graphics::GraphicBufferAllocator> const allocator;
56 };
57 }
58 }
59 #endif /* MIR_COMPOSITOR_BUFFER_MAP_H_ */
All things Mir.
Definition: atomic_callback.h:25
void remove_buffer(graphics::BufferID id) override
Definition: buffer_map.cpp:47
Definition: client_buffers.h:30
void send_buffer(graphics::BufferID id) override
Definition: buffer_map.cpp:53
Definition: buffer_map.h:33
std::shared_ptr< graphics::Buffer > & operator[](graphics::BufferID) override
Definition: buffer_map.cpp:61
graphics::BufferID add_buffer(graphics::BufferProperties const &properties) override
Definition: buffer_map.cpp:38
Buffer creation properties.
Definition: buffer_properties.h:48
BufferMap(frontend::BufferStreamId id, std::shared_ptr< frontend::EventSink > const &sink, std::shared_ptr< graphics::GraphicBufferAllocator > const &allocator)
Definition: buffer_map.cpp:28

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015