Callbacks on InterfaceRegistry::AddInterface can be called on the IO thread |
|
Issue descriptionThere are cases where callbacks on InterfaceRegistry::AddInterface can be called on the IO thread. People are adding CrossThreadBind to make it work. e.g., https://chromium-review.googlesource.com/c/chromium/src/+/750562/3/third_party/WebKit/Source/controller/BlinkInitializer.cpp#121 This is not nice that many things (e.g., object allocations on Oilpan) are not supported on the IO thread. Can we make sure that the callbacks are called on some task runner of the main thread? I think this is the place that calls the callbacks on the IO thread: https://cs.chromium.org/chromium/src/services/service_manager/public/cpp/interface_binder.h?gsn=AddInterface&g=0&l=62
,
Oct 19
Right, so the BinderRegistry (it's no longer InterfaceRegistry, that's oooold) which we give to Blink initialization is ultimately added to a connection filter here[1], which means not *all* callbacks are *always* called on the IO thread. This does seem unfortunate. Also unfortunate is that some callbacks must be called on the IO thread though, because we need to be able to handle them while the main thread is blocked. I assume those cases are all specific to content or chrome though, so we could always introduce a second BinderRegistry to give to blink only. It probably is just something to keep in mind as we migrate to DocumentInterfaceBroker et al though. [1] https://cs.chromium.org/chromium/src/content/renderer/render_thread_impl.cc?rcl=510accecfcfe640659c8cb01c5b78adbf8908bfd&l=807 |
|
►
Sign in to add a comment |
|
Comment 1 by dcheng@chromium.org
, Oct 19