Reify view ownership as a message pipe.
This patch changes the View Manager API to allow for pipelined
creation and addition of views into the view hierarchy using a
new |ViewOwner| object to mediate the transfer of ownership
between clients.
The ownership model ensures that views always belong either to
a view hierarchy (as a child of some other view or as the root
of a view tree) or to a |ViewOwner| in transit.
Previously, it was more difficult to reason about the lifetime
of views since the |ViewToken| afforded no way to track ownership
transfer and therefore lifetime had to be negotiated out-of-band
by applications themselves (a fact which was not adequately captured
by the |ViewProvider| mechanism or example programs).
Bug #654
BUG=
R=abarth@google.com
Review URL: https://codereview.chromium.org/1679023006 .
diff --git a/apps/moterm/moterm_app.cc b/apps/moterm/moterm_app.cc
index efdb0fa..e8d2e2d 100644
--- a/apps/moterm/moterm_app.cc
+++ b/apps/moterm/moterm_app.cc
@@ -10,11 +10,10 @@
MotermApp::~MotermApp() {}
-bool MotermApp::CreateView(
+void MotermApp::CreateView(
const std::string& connection_url,
+ mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request,
mojo::InterfaceRequest<mojo::ServiceProvider> services,
- mojo::ServiceProviderPtr exposed_services,
- const mojo::ui::ViewProvider::CreateViewCallback& callback) {
- new MotermView(app_impl(), services.Pass(), callback);
- return true;
+ mojo::ServiceProviderPtr exposed_services) {
+ new MotermView(app_impl(), view_owner_request.Pass(), services.Pass());
}