Merge lp:~mterry/mir/session-for-surface into lp:~mir-team/mir/trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Alan Griffiths on 2013-08-09 | ||||
Approved revision: | 839 | ||||
Merged at revision: | 951 | ||||
Proposed branch: | lp:~mterry/mir/session-for-surface | ||||
Merge into: | lp:~mir-team/mir/trunk | ||||
Diff against target: |
691 lines (+87/-42) 23 files modified
examples/render_surfaces.cpp (+1/-0) include/server/mir/shell/organising_surface_factory.h (+2/-0) include/server/mir/shell/surface.h (+2/-0) include/server/mir/shell/surface_builder.h (+2/-1) include/server/mir/shell/surface_factory.h (+2/-0) include/server/mir/shell/surface_source.h (+2/-0) include/server/mir/surfaces/surface_controller.h (+6/-1) include/test/mir_test_doubles/mock_surface.h (+2/-2) include/test/mir_test_doubles/mock_surface_factory.h (+2/-1) include/test/mir_test_doubles/stub_surface_builder.h (+1/-1) src/server/shell/application_session.cpp (+1/-1) src/server/shell/organising_surface_factory.cpp (+2/-1) src/server/shell/surface.cpp (+2/-1) src/server/shell/surface_source.cpp (+2/-1) src/server/surfaces/surface_controller.cpp (+2/-1) tests/acceptance-tests/test_client_input.cpp (+3/-2) tests/integration-tests/graphics/android/test_internal_client.cpp (+1/-1) tests/unit-tests/shell/test_application_session.cpp (+10/-10) tests/unit-tests/shell/test_default_focus_mechanism.cpp (+2/-2) tests/unit-tests/shell/test_organising_surface_factory.cpp (+5/-5) tests/unit-tests/shell/test_session_manager.cpp (+6/-4) tests/unit-tests/shell/test_surface.cpp (+28/-6) tests/unit-tests/surfaces/test_surface_controller.cpp (+1/-1) |
||||
To merge this branch: | bzr merge lp:~mterry/mir/session-for-surface | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alan Griffiths | 2013-07-12 | Abstain on 2013-08-09 | |
PS Jenkins bot (community) | continuous-integration | Approve on 2013-08-09 | |
Kevin DuBois (community) | Abstain on 2013-08-01 | ||
Robert Carr (community) | Approve on 2013-07-30 | ||
Robert Ancell | Approve on 2013-07-29 | ||
Review via email:
|
Commit message
Pass on the owning Session when creating Surfaces.
Description of the change
This branch exposes the owning Session when creating Surfaces.
I'm not super familiar with writing real C++11 and my use of shared_ptr may be really whack. In particular, my use of std::enable_
Alan Griffiths (alan-griffiths) wrote : | # |
Hi Michael, I'm afraid your use of shared pointers is off.
shared_ptr denotes shared ownership and, in this case the session owns the surface. It doesn't make sense for the surface to also own the session - at the very least that can create an ownership cycle (and cause a memory leak).
Having said that, as the session is guaranteed to outlive the surface I imagine an ordinary raw pointer will serve your purpose.
- 834. By Michael Terry on 2013-07-12
-
Use raw pointers instead of fancy-pants shared_ptrs
Michael Terry (mterry) wrote : | # |
Ah thanks, Alan. That makes sense. I've updated the branch to use raw pointers.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:834
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 835. By Michael Terry on 2013-07-12
-
Merge from trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:835
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Kevin DuBois (kdub) wrote : | # |
We should be doing something different than passing the session ptr into the surface. This establishes a weird dependency circle, I think.
from 'bug report' "But I can't seem to get access to the session that a surface is being created for."
This is somewhat by design, at the moment, a design that probably needs rethinking to suit the requirements of the shell. I think we should meet on monday to chat about what exactly is needed.
(I think that we're exposing cracks in 1) the "depth id" stacking system that ms::SurfaceStack has that might need changing)
Alan Griffiths (alan-griffiths) wrote : | # |
The "scenegraph" should probably be the way to navigate from a surface to its parent session, so this might not be the best approach. OTOH it is simple and may be enough.
Michael Terry (mterry) wrote : | # |
Did you Mir folk discuss how you wanted to proceed on this?
Alan Griffiths (alan-griffiths) wrote : | # |
> Did you Mir folk discuss how you wanted to proceed on this?
/1/ fix the CI failures?
- 836. By Michael Terry on 2013-07-18
-
Merge from trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:836
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 837. By Michael Terry on 2013-07-18
-
Fix compile errors
Michael Terry (mterry) wrote : | # |
> /1/ fix the CI failures?
I think I fixed them now, please re-examine.
That aside, I had been more looking for guidance on the direction of this merge. Like, whether I should abandon this method and go a different route.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:837
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Robert Carr (robertcarr) wrote : | # |
I'm still trying to think of a better route that satisfies this case!
I think this route isn't the way to go as these kind of relationships tend to make testing/refactoring difficult. I am also a little worried it may be unsafe:
//
{
std::shared_
std::shared_
session.reset();
// Now while we do some other stuff or yield, a thread from frontend closes session causing it to be deleted (we didn't keep a reference)
LOG(surface-
}
Alan Griffiths (alan-griffiths) wrote : | # |
> I'm still trying to think of a better route that satisfies this case!
Maybe we need to clarify "this case" - this MP simply adds a parameter without a driving test case.
Consequentially we're probably all guessing at the problem it solves.
> I think this route isn't the way to go as these kind of relationships tend to
> make testing/refactoring difficult. I am also a little worried it may be
> unsafe:
I think the point is to make the session known at the point of building the surfaces::Surface - not long term storage. Vis:
72 + virtual std::weak_
Although, it isn't used in SurfaceControll
Michael Terry (mterry) wrote : | # |
Here's my use case:
I want to change u-s-c to be able to place a specified user session under the greeter session, so the user session can bleed through (e.g. imagine the pin unlock screen that shows a blurred user session underneath).
Here's my current thinking on how to do so:
A) Change u-s-c to override the_surface_
B) Then, have lightdm tell u-s-c which session is the greeter (by naming it something like "Greeter 1") and when to raise the appropriate user session inside of its layer.
Here's the missing piece:
u-s-c can't seem to tell me that a given surface belongs to a session called "Greeter 1", so I can't create it with the right depthId. Hence this proposal.
I'm open to other ways of achieving the use case. Including some special case API like "Keep this session above these others" or "Put this session below this other one". But this MP seemed more generally useful.
And yeah, I didn't need the session pointer to be stored long term. Just needed to inspect it momentarily. So for my specific use case, eventual segfaults from storing it is not as much a problem.
Robert Ancell (robert-ancell) wrote : | # |
Robert's concerns are valid in that we don't want the chance of the session being invalid but the surface object still existing. Can we just pass the session into create_surface() as context and u-s-c can store its own mapping and take responsibility for keeping track of invalid references?
Alan Griffiths (alan-griffiths) wrote : | # |
> Robert's concerns are valid in that we don't want the chance of the session
> being invalid but the surface object still existing.
Robert's concerns relate to an existing problem to be invalid - this MP doesn't make anything worse.
> Can we just pass the
> session into create_surface() as context and u-s-c can store its own mapping
> and take responsibility for keeping track of invalid references?
+1
However, there's a related design issue here: SurfaceBuilder has a destroy() member function. This makes management of the surfaces::Surface painful - forcing shell::Surface to take a SurfaceBuilder dependency and requiring the constructor to take the Session to pass on as a parameter to pass to the corresponding create function.
Without SurfaceBuilder:
PS It might also be thought that SurfaceBuilder:
PPS There are other MPs around that touch on this problem - basically we currently have no way to present a consistent view of our data model. (See for example, https:/
- 838. By Michael Terry on 2013-07-29
-
Merge from trunk
Michael Terry (mterry) wrote : | # |
>> Can we just pass the
>> session into create_surface() as context and u-s-c can store its own mapping
>> and take responsibility for keeping track of invalid references?
>
> +1
To be clear, that's what this branch does, eh? I don't store the pointer anywhere, that I can see. I just pass it down through the layers, and u-s-c can do what it wants with it.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:838
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Robert Ancell (robert-ancell) wrote : | # |
> >> Can we just pass the
> >> session into create_surface() as context and u-s-c can store its own
> mapping
> >> and take responsibility for keeping track of invalid references?
> >
> > +1
>
> To be clear, that's what this branch does, eh? I don't store the pointer
> anywhere, that I can see. I just pass it down through the layers, and u-s-c
> can do what it wants with it.
Oh duh. I must have misread the MP. Looks fine to me then
Robert Carr (robertcarr) wrote : | # |
What's wrong with SessionListener
Michael Terry (mterry) wrote : | # |
> What's wrong with SessionListener
Well, when I wrote this branch, that didn't exist. :) But seriously, I don't think that would help a bunch. My brief understanding is that surfaces are assigned a DepthId at creation time. And I was wanting u-s-c to be able to set DepthId based on the Session object. If we get a signal after the fact, that seems too late for DepthId purposes.
Robert Carr (robertcarr) wrote : | # |
Oh! I see. Think-o.
Ok. I still don't think this is the way to go architecturally for Mir, but I dont think it makes things worse and I don't want to block you any more! LGTM
Alan Griffiths (alan-griffiths) wrote : | # |
I too think this is a step away from where we would like to be, but we don't have a better solution proposed and I won't block if it works around a problem.
Kevin DuBois (kdub) wrote : | # |
I'll switch to abstain, I think this change will need to be rethought eventually in subsequent refactorings, it points out a problem with the class structures (or at least the classes meeting the requirements of the shell) in this part of the code.
Alan Griffiths (alan-griffiths) wrote : | # |
We've taken so long to reach "approval" that there are now merge conflicts to address.
- 839. By Michael Terry on 2013-08-09
-
Merge from trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:839
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
FAILED: Continuous integration, rev:833 jenkins. qa.ubuntu. com/job/ mir-ci/ 997/ jenkins. qa.ubuntu. com/job/ mir-android- saucy-i386- build/1295/ console jenkins. qa.ubuntu. com/job/ mir-clang- saucy-amd64- build/1180/ console jenkins. qa.ubuntu. com/job/ mir-saucy- amd64-ci/ 235/console jenkins. qa.ubuntu. com/job/ mir-vm- ci-build/ ./distribution= quantal, flavor= amd64/633
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ mir-ci/ 997/rebuild
http://