Figure out how to fix WebFrameClient::interface{Provider,Registry} naming collision |
|||
Issue description
The naive rename strategy to just append Get doesn't work here, because RenderFrame already exposes GetInterface{Provider,Registry}, which return a service_manager::Interface{Provider,Registry}, while the blink versions return blink::Interface{Provider,Registry}.
Initially, I thought we could just have the WebFrameClient methods return a service_manager::InterfaceProvider/service_manager::InterfaceRegistry and wrap it in Blink. That way, RenderFrameImpl can use the same implementation to override two different methods--a slight abuse of C++, but nothing too horrible.
Note: an assumption is we don't want to use the service_manager interfaces directly in Blink. They do include a lot of random headers, such as <string>.
So fixing this for WebFrameClient is pretty straightforward. However, we also have Platform::interfaceProvider() in the Blink public API. Since it's in platform, any code in Blink can call out to this InterfaceProvider. This leaves several different options:
1. Change it to return a service_manager::InterfaceProvider as well, and force all callers to wrap it in an adapter.
Not very pleasant for Blink callers, but it works. But it'd be best to avoid this if possible, since the temptation to simply #include service_manager's InterfaceProvider seems pretty high. It also seems a bit heavy (we have to create an extra temporary every time just to do talk to the InterfaceProvider). It's also tricky to get the threading right with this version.
2. Remove this function and just expose getInterface() directly.
Works until you run into things like DocumentWebSocketChannel [1] which use the InterfaceProvider interface to abstract away whether it's communicating with the frame provider or the platform provider. We could create a wrapper for just this instance, but it doesn't seem like good design.
3. Change it to return a service_manager::InterfaceProvider and provide a static Platform method to return the wrapped version.
Doesn't create an adapter each time code needs to talk to the interface provider, but this will leave a non-static interfaceProvider() on Platform still, which doesn't seem good either.
4. Keep InterfaceProvider in the public API. For Platform, pass as a blink::InterfaceProvider. For WebFrameClient, pass as a service_manager::Interface{Provider,Registry} and wrap in blink.
A bit ugly, because the blink API is inconsistent. But it probably works? This is the alternative I'm currently leaning towards...
Hopefully in the future we can just use the same interface throughout and avoid all this trouble.
,
Jan 20 2017
There's another easy alternative as well: Prefix the Blink classnames with Web.
,
Jan 23 2017
FWIW, I've tried putting together approaches from - #c1 - https://crrev.com/2651583007 - #c2 - https://crrev.com/2650913002 (note that so far I've only tried webkit_unit_tests locally - the tryjobs have not yet finished... :-P). I think I like #c2 a little bit better, because: 1. This is a mechanical rename = less risk. 2. It is a bit icky to always have to pass 3 related things together (blink::WebFrameClient*, blink::InterfaceProvider*, blink::InterfaceRegistry*) when creating frames from render_frame_impl.cc.
,
Jan 23 2017
Both esprehn and I don't like the prefix. There's not really that much risk with c#1, and the same pattern of passing 3 params is already present at the LocalFrame level.
,
Jan 24 2017
c#1 also has the really nice property that RenderFrameImpl is no longer exposing two things that are confusingly similar-but-not-the-same.
,
Jan 24 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/2d6720b079b98fb9104c7274ef033a08d9e68efc commit 2d6720b079b98fb9104c7274ef033a08d9e68efc Author: lukasza <lukasza@chromium.org> Date: Tue Jan 24 19:40:45 2017 Plumbing blink::Interface{Provider|Registry} through WebLocalFrame's constructor. This CL helps remove WebFrameClient::interfaceProvider methods which would have clashed (after the Great Blink Rename) with either InterfaceProvider type and/or RenderFrameImpl::GetInterfaceProvider method. Same for interfaceRegistry method. BUG= 682560 Review-Url: https://codereview.chromium.org/2651583007 Cr-Commit-Position: refs/heads/master@{#445781} [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/components/plugins/renderer/webview_plugin.cc [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/components/printing/renderer/print_web_view_helper.cc [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/content/renderer/media/android/media_info_loader_unittest.cc [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/content/renderer/render_frame_impl.cc [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/content/renderer/render_frame_impl.h [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/extensions/renderer/scoped_web_frame.cc [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/media/blink/multibuffer_data_source_unittest.cc [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/media/blink/resource_multibuffer_data_provider_unittest.cc [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/media/blink/webmediaplayer_impl_unittest.cc [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/WebLocalFrameImpl.h [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/WebRemoteFrameImpl.h [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/WebSharedWorkerImpl.h [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/tests/FrameLoaderClientImplTest.cpp [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/tests/FrameTestHelpers.h [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/tests/WebFrameTest.cpp [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/Source/web/tests/WebViewTest.cpp [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/public/web/WebFrameClient.h [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/public/web/WebLocalFrame.h [modify] https://crrev.com/2d6720b079b98fb9104c7274ef033a08d9e68efc/third_party/WebKit/public/web/WebRemoteFrame.h
,
Jan 24 2017
This should be fixed right now, but let's keep an eye out for this when trying another dry-run of the Great Blink Rename. |
|||
►
Sign in to add a comment |
|||
Comment 1 by dcheng@chromium.org
, Jan 20 2017