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
=== modified file 'src/server/frontend/buffer_stream_tracker.h'
--- src/server/frontend/buffer_stream_tracker.h 2015-04-25 10:45:30 +0000
+++ src/server/frontend/buffer_stream_tracker.h 2015-04-27 20:04:19 +0000
@@ -45,7 +45,7 @@
45 /* track a buffer as associated with a buffer stream45 /* track a buffer as associated with a buffer stream
46 * \warning the buffer must correspond to a single buffer stream id46 * \warning the buffer must correspond to a single buffer stream id
47 * \param buffer_stream_id id that the the buffer is associated with47 * \param buffer_stream_id id that the the buffer is associated with
48 * \param buffer buffer to be tracked (TODO: should be a shared_ptr)48 * \param buffer buffer to be tracked
49 * \returns true if the buffer is already tracked49 * \returns true if the buffer is already tracked
50 * false if the buffer is not tracked50 * false if the buffer is not tracked
51 */51 */
@@ -53,17 +53,16 @@
53 /* removes the buffer stream id from all tracking */53 /* removes the buffer stream id from all tracking */
54 void remove_buffer_stream(BufferStreamId);54 void remove_buffer_stream(BufferStreamId);
5555
56 /* Access the buffer resource that the id corresponds to.56 /* Access the buffer resource that the id corresponds to. */
57 TODO: should really be a weak or shared ptr */
58 graphics::Buffer* buffer_from(graphics::BufferID) const;57 graphics::Buffer* buffer_from(graphics::BufferID) const;
5958
60private:59private:
61 size_t const client_cache_size;60 size_t const client_cache_size;
62 std::unordered_map<BufferStreamId, std::shared_ptr<ClientBufferTracker>> client_buffer_tracker;61 std::unordered_map<BufferStreamId, std::shared_ptr<ClientBufferTracker>> client_buffer_tracker;
6362
64//TODO: deprecate below this line once exchange_buffer is the normal way to request a new buffer
65public:63public:
66 /* accesses the last buffer given to track_buffer() for the given BufferStreamId */64 /* accesses the last buffer given to track_buffer() for the given BufferStreamId */
65 //TODO: once next_buffer rpc call is fully deprecated, this can be removed.
67 graphics::Buffer* last_buffer(BufferStreamId) const;66 graphics::Buffer* last_buffer(BufferStreamId) const;
68private:67private:
69 mutable std::mutex mutex;68 mutable std::mutex mutex;

Subscribers

People subscribed via source and target branches