Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Issue 868463008: Remove Client relationship between mojo.Shell/mojo.Application (Closed)

Created:
5 years, 11 months ago by jamesr
Modified:
5 years, 10 months ago
CC:
mojo-reviews_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, esprehn, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, darin (slow to review), ben+mojo_chromium.org, ojan
Base URL:
git@github.com:domokit/mojo.git@app_impl_init
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

Remove Client relationship between mojo.Shell/mojo.Application Instead of mojo.Shell and mojo.Application being clients of each other they are now separate interfaces. An implementation of mojo.Application receives a handle to the shell in its Initialize call, as described in this doc: https://docs.google.com/document/d/1xjt_TPjTu0elix8fNdBgWmnjJdJAtqSr1XDS_C-Ct8E/edit?usp=sharing An analogous change is made to the content handler definition. In C++, this is handled by the mojo::ApplicationImpl class which stores shell handle in its implementation of Initialize. Thus the only change for most C++ applications is the meaning of the handle in MojoMain is different, although mains that use the ApplicationRunners do the same thing with it. Connecting to other apps is largely the same although instead of grabbing the ApplicationImpl's client() to talk to the shell code must now use the ApplicationImpl::shell() getter. In JavaScript, the initialization sequence is a bit different although this is hidden mostly in the Application class which calls initialize() on its subclass with the same set of parameters. Connecting to another application looks different, especially for sky code using the shell proxy handle exposed via internals. Hans has some ideas about how to make this a bit nicer. Python apps similarly need to change their startup sequence a bit. I didn't find a common library to take care of this dance, although it's possible I just missed it. Other languages probably a bit of reworking - I fixed everything here that is covered by mojob.py test but some might be missing. This patch also uses typed handles (i.e. InterfacePtr<> or InterfaceRequest<> or their type aliases) wherever possible instead of ScopedMessagePipeHandle for clarity. R=davemoore@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/e5ae9e408fb4f1b888a93502af65c6a9615a0ad1

Patch Set 1 #

Patch Set 2 : #

Total comments: 1

Patch Set 3 : fix android #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+525 lines, -398 lines) Patch
M examples/content_handler_demo/content_handler_demo.cc View 3 chunks +11 lines, -8 lines 0 comments Download
M examples/pdf_viewer/pdf_viewer.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M examples/png_viewer/png_viewer.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M examples/python/__mojo__.py View 1 3 chunks +8 lines, -7 lines 0 comments Download
M examples/recipes/recipe_handler/recipe_handler_main.cc View 2 chunks +4 lines, -3 lines 0 comments Download
M examples/recursive_content_handler/recursive_content_handler.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M mojo/application/application_runner_chromium.cc View 2 chunks +5 lines, -4 lines 0 comments Download
M mojo/application/application_test_main_chromium.cc View 1 chunk +2 lines, -4 lines 0 comments Download
M mojo/application/content_handler_factory.h View 2 chunks +6 lines, -3 lines 0 comments Download
M mojo/application/content_handler_factory.cc View 4 chunks +12 lines, -11 lines 0 comments Download
M mojo/public/cpp/application/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M mojo/public/cpp/application/application_impl.h View 1 3 chunks +13 lines, -6 lines 4 comments Download
M mojo/public/cpp/application/application_test_base.h View 3 chunks +2 lines, -6 lines 0 comments Download
M mojo/public/cpp/application/lib/application_impl.cc View 1 3 chunks +21 lines, -16 lines 0 comments Download
M mojo/public/cpp/application/lib/application_runner.cc View 1 1 chunk +3 lines, -4 lines 0 comments Download
M mojo/public/cpp/application/lib/application_test_base.cc View 1 5 chunks +54 lines, -51 lines 0 comments Download
M mojo/public/cpp/application/lib/application_test_main.cc View 1 chunk +2 lines, -5 lines 0 comments Download
M mojo/public/cpp/bindings/binding.h View 1 chunk +7 lines, -0 lines 0 comments Download
M mojo/public/cpp/bindings/strong_binding.h View 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/public/interfaces/application/application.mojom View 2 chunks +2 lines, -1 line 0 comments Download
M mojo/public/interfaces/application/shell.mojom View 1 chunk +0 lines, -2 lines 0 comments Download
M mojo/public/js/connection.js View 1 1 chunk +2 lines, -0 lines 0 comments Download
M mojo/python/content_handler/content_handler_main.cc View 2 chunks +7 lines, -4 lines 0 comments Download
M mojo/services/content_handler/public/interfaces/content_handler.mojom View 1 chunk +2 lines, -2 lines 0 comments Download
M mojo/services/public/js/application.js View 1 2 2 chunks +23 lines, -10 lines 0 comments Download
M mojo/services/public/js/shell.js View 1 2 chunks +4 lines, -7 lines 0 comments Download
M mojo/services/view_manager/public/cpp/tests/view_manager_unittest.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M services/dart/content_handler_main.cc View 1 chunk +5 lines, -3 lines 0 comments Download
M services/dart/dart_app.h View 1 chunk +3 lines, -2 lines 0 comments Download
M services/dart/dart_app.cc View 2 chunks +6 lines, -3 lines 0 comments Download
M services/js/content_handler_main.cc View 1 chunk +5 lines, -3 lines 0 comments Download
M services/js/js_app.h View 2 chunks +3 lines, -2 lines 0 comments Download
M services/js/js_app.cc View 2 chunks +6 lines, -5 lines 0 comments Download
M services/window_manager/window_manager_api_unittest.cc View 1 chunk +4 lines, -3 lines 0 comments Download
M shell/android/android_handler.h View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M shell/android/android_handler.cc View 1 2 4 chunks +8 lines, -4 lines 0 comments Download
M shell/android/android_handler_loader.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M shell/android/android_handler_loader.cc View 1 2 1 chunk +8 lines, -6 lines 0 comments Download
M shell/android/background_application_loader.h View 1 2 2 chunks +5 lines, -4 lines 0 comments Download
M shell/android/background_application_loader.cc View 1 2 3 chunks +10 lines, -8 lines 0 comments Download
M shell/android/background_application_loader_unittest.cc View 1 2 3 chunks +4 lines, -4 lines 0 comments Download
M shell/android/native_viewport_application_loader.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M shell/android/native_viewport_application_loader.cc View 1 2 1 chunk +7 lines, -6 lines 0 comments Download
M shell/android/ui_application_loader_android.h View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M shell/android/ui_application_loader_android.cc View 1 2 2 chunks +12 lines, -10 lines 0 comments Download
M shell/app_child_process.cc View 2 chunks +7 lines, -5 lines 0 comments Download
M shell/app_child_process.mojom View 1 chunk +3 lines, -2 lines 0 comments Download
M shell/application_manager/application_loader.h View 3 chunks +5 lines, -3 lines 0 comments Download
M shell/application_manager/application_loader.cc View 1 chunk +1 line, -1 line 0 comments Download
M shell/application_manager/application_manager.h View 1 2 chunks +2 lines, -2 lines 0 comments Download
M shell/application_manager/application_manager.cc View 1 3 chunks +12 lines, -12 lines 0 comments Download
M shell/application_manager/application_manager_unittest.cc View 1 3 chunks +7 lines, -9 lines 0 comments Download
M shell/application_manager/shell_impl.h View 2 chunks +5 lines, -2 lines 0 comments Download
M shell/application_manager/shell_impl.cc View 1 chunk +11 lines, -4 lines 0 comments Download
M shell/dynamic_application_loader.h View 1 chunk +1 line, -1 line 0 comments Download
M shell/dynamic_application_loader.cc View 9 chunks +18 lines, -17 lines 0 comments Download
M shell/dynamic_application_loader_unittest.cc View 1 2 chunks +3 lines, -4 lines 0 comments Download
M shell/dynamic_service_runner.h View 4 chunks +5 lines, -2 lines 0 comments Download
M shell/dynamic_service_runner.cc View 2 chunks +3 lines, -2 lines 0 comments Download
M shell/external_application_listener.h View 1 3 chunks +12 lines, -9 lines 0 comments Download
M shell/external_application_listener.cc View 1 2 chunks +7 lines, -5 lines 0 comments Download
M shell/external_application_listener_unittest.cc View 1 7 chunks +52 lines, -42 lines 0 comments Download
M shell/external_application_registrar.mojom View 1 2 chunks +3 lines, -2 lines 0 comments Download
M shell/external_application_registrar_connection.h View 1 2 chunks +6 lines, -1 line 0 comments Download
M shell/external_application_registrar_connection.cc View 1 1 chunk +2 lines, -2 lines 0 comments Download
M shell/in_process_dynamic_service_runner.h View 2 chunks +2 lines, -2 lines 0 comments Download
M shell/in_process_dynamic_service_runner.cc View 2 chunks +4 lines, -4 lines 0 comments Download
M shell/launcher_main.cc View 1 2 chunks +7 lines, -6 lines 0 comments Download
M shell/out_of_process_dynamic_service_runner.h View 1 chunk +1 line, -1 line 0 comments Download
M shell/out_of_process_dynamic_service_runner.cc View 2 chunks +3 lines, -4 lines 0 comments Download
M sky/framework/inspector/inspector.sky View 1 2 chunks +6 lines, -3 lines 0 comments Download
M sky/tests/services/network.sky View 1 2 chunks +18 lines, -3 lines 0 comments Download
M sky/viewer/content_handler_impl.h View 1 chunk +1 line, -1 line 0 comments Download
M sky/viewer/content_handler_impl.cc View 4 chunks +13 lines, -9 lines 0 comments Download
M sky/viewer/internals.cc View 1 1 chunk +4 lines, -4 lines 0 comments Download

Messages

Total messages: 11 (1 generated)
jamesr
Dave - please review the C++ and //mojo/public/interfaces changes Hans - please review the JS ...
5 years, 11 months ago (2015-01-26 23:08:02 UTC) #2
jamesr
https://codereview.chromium.org/868463008/diff/20001/mojo/services/public/js/application.js File mojo/services/public/js/application.js (right): https://codereview.chromium.org/868463008/diff/20001/mojo/services/public/js/application.js#newcode14 mojo/services/public/js/application.js:14: serviceProvider, shell) { hah! line wrapping this (to make ...
5 years, 11 months ago (2015-01-26 23:19:49 UTC) #3
zra
On 2015/01/26 23:08:02, jamesr wrote: > Zach (FYI only) - please take a look at ...
5 years, 11 months ago (2015-01-26 23:27:01 UTC) #4
jamesr
OK, found the android stuff. The android build now compiles and the tests pass with ...
5 years, 11 months ago (2015-01-26 23:36:40 UTC) #5
DaveMoore
C++ code LGTM https://codereview.chromium.org/868463008/diff/40001/mojo/public/cpp/application/application_impl.h File mojo/public/cpp/application/application_impl.h (right): https://codereview.chromium.org/868463008/diff/40001/mojo/public/cpp/application/application_impl.h#newcode83 mojo/public/cpp/application/application_impl.h:83: // Initialize. Nit: This seems very ...
5 years, 11 months ago (2015-01-27 00:41:29 UTC) #6
jamesr
https://codereview.chromium.org/868463008/diff/40001/mojo/public/cpp/application/application_impl.h File mojo/public/cpp/application/application_impl.h (right): https://codereview.chromium.org/868463008/diff/40001/mojo/public/cpp/application/application_impl.h#newcode83 mojo/public/cpp/application/application_impl.h:83: // Initialize. On 2015/01/27 00:41:29, DaveMoore wrote: > Nit: ...
5 years, 11 months ago (2015-01-27 00:59:04 UTC) #7
jamesr
Hans - gonna go ahead and land now to minimize churn on other patches. You've ...
5 years, 11 months ago (2015-01-27 01:50:25 UTC) #8
jamesr
Committed patchset #3 (id:40001) manually as e5ae9e408fb4f1b888a93502af65c6a9615a0ad1 (presubmit successful).
5 years, 11 months ago (2015-01-27 01:53:23 UTC) #9
zra
On 2015/01/27 01:53:23, jamesr wrote: > Committed patchset #3 (id:40001) manually as > e5ae9e408fb4f1b888a93502af65c6a9615a0ad1 (presubmit ...
5 years, 11 months ago (2015-01-27 15:44:24 UTC) #10
qsr
5 years, 10 months ago (2015-01-28 13:35:33 UTC) #11
Message was sent while issue was closed.
On 2015/01/26 23:08:02, jamesr wrote:
> Dave - please review the C++ and //mojo/public/interfaces changes
> 
> Hans - please review the JS changes and TODOs I gave you
> 
> Zach (FYI only) - please take a look at the Dart changes. This compiles, but
it
> probably doesn't work correctly :).  I'd be happy to work on fixing things
> asynchronously to this patch (since this patch is already kind of a beast)
> 
> qsr - Please take a look at the Python changes.  I'm pretty sure the example I
> modified works (and it's covered by apptests) but the changes might not be
> sufficient and I noticed some stuff that's not wired up.

 Not sure to understand what you mean by not wiring up, the app in question
doesn't care about exposed_services, so it let it dies which will close the
handle.

> Also, are there java things somewhere I should be testing?

 No, there is no content handler in pure java for now.

Powered by Google App Engine
This is Rietveld 408576698