Mir

Merge lp:~kdub/mir/update-bufferstream-tracker-todos into lp:mir

Proposed by Kevin DuBois
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 2535
Proposed branch: lp:~kdub/mir/update-bufferstream-tracker-todos
Merge into: lp:mir
Diff against target: 32 lines (+3/-4)
1 file modified
src/server/frontend/buffer_stream_tracker.h (+3/-4)
To merge this branch: bzr merge lp:~kdub/mir/update-bufferstream-tracker-todos
Reviewer Review Type Date Requested Status
Daniel van Vugt Abstain
Alexandros Frantzis (community) Approve
Alan Griffiths Approve
PS Jenkins bot (community) continuous-integration Approve
Robert Carr (community) Approve
Review via email: mp+257577@code.launchpad.net

Commit message

update the TODO comments in mf::BufferStreamTracker. The first two were TODOs from long ago that don't apply anymore, and the last todo was clarified.

Description of the change

update the TODO comments in mf::BufferStreamTracker. The first two were TODOs from long ago that don't apply anymore, and the last todo was clarified.

To post a comment you must log in.
Revision history for this message
Robert Carr (robertcarr) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

We're committing to using raw pointers? Are you sure?

17 - /* Access the buffer resource that the id corresponds to.
18 - TODO: should really be a weak or shared ptr */
19 + /* Access the buffer resource that the id corresponds to. */
20 graphics::Buffer* buffer_from(graphics::BufferID) const;

review: Needs Information
Revision history for this message
Kevin DuBois (kdub) wrote :

It came up on irc yesterday that the comments are out-of-date. It seems like using a smart pointer (or a moveable resource containing the buffer perhaps) might be better, but I'm not aware of any drive to revert from the raw-ptr interfaces that we have now.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

OK

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I think that TODO should remain. In systems as complicated as Mir, raw pointers are scary and a risk...

Revision history for this message
Daniel van Vugt (vanvugt) :
review: Needs Fixing
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

> It seems like using a smart pointer (or a moveable resource containing the buffer perhaps)
> might be better, but I'm not aware of any drive to revert from the raw-ptr interfaces
> that we have now.

> I think that TODO should remain. In systems as complicated as Mir, raw pointers are scary
> and a risk...

Raw *non-owning* pointers are OK in general, but, in any case, the root cause is not in the BufferStreamTracker interface, but rather in the BufferStream/BufferBundle interfaces. BST is forced to use a raw pointer because this is what it gets from BufferStream. If we think that a raw pointer is not sufficient we should have a TODO in BufferStream/BufferBundle.

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Bah, "TODO" or not. A simple grep can find these issues still.

review: Abstain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/frontend/buffer_stream_tracker.h'
2--- src/server/frontend/buffer_stream_tracker.h 2015-04-25 10:45:30 +0000
3+++ src/server/frontend/buffer_stream_tracker.h 2015-04-27 20:04:19 +0000
4@@ -45,7 +45,7 @@
5 /* track a buffer as associated with a buffer stream
6 * \warning the buffer must correspond to a single buffer stream id
7 * \param buffer_stream_id id that the the buffer is associated with
8- * \param buffer buffer to be tracked (TODO: should be a shared_ptr)
9+ * \param buffer buffer to be tracked
10 * \returns true if the buffer is already tracked
11 * false if the buffer is not tracked
12 */
13@@ -53,17 +53,16 @@
14 /* removes the buffer stream id from all tracking */
15 void remove_buffer_stream(BufferStreamId);
16
17- /* Access the buffer resource that the id corresponds to.
18- TODO: should really be a weak or shared ptr */
19+ /* Access the buffer resource that the id corresponds to. */
20 graphics::Buffer* buffer_from(graphics::BufferID) const;
21
22 private:
23 size_t const client_cache_size;
24 std::unordered_map<BufferStreamId, std::shared_ptr<ClientBufferTracker>> client_buffer_tracker;
25
26-//TODO: deprecate below this line once exchange_buffer is the normal way to request a new buffer
27 public:
28 /* accesses the last buffer given to track_buffer() for the given BufferStreamId */
29+ //TODO: once next_buffer rpc call is fully deprecated, this can be removed.
30 graphics::Buffer* last_buffer(BufferStreamId) const;
31 private:
32 mutable std::mutex mutex;

Subscribers

People subscribed via source and target branches