In the Android side of ARC, the threading story is much more complicated than the one in Chrome. Requests typically come into a pool of Binder threads, and these do not have a Chrome message loop attached to them, so it's difficult to have an ergonomic way of making Mojo calls.
The current workaround we have is wrapping all the accesses to Mojo objects with a synchronized block, which effectively serializes them all and that gets rid of the vast majority of the problems, but there are still a few places where this technique is not enough. Namely, if there is a disconnect event, that can be dispatched from the main thread and modify internal state in a way the synchronized blocks cannot protect.
So, it'd be a good idea to solve this problem the right way and instead of us wrapping stuff, the bindings would allow us to expose a thread-safe object that can be called from any thread without any worries. Having an automatic proxy like ThreadSafeInterfacePtr in Java would completely solve the issue, but due to the lack of template metaprogramming, this _might_ need to come from the bindings, probably under a flag.
Comment 1 by bugdroid1@chromium.org
, Jul 24