Make it possible for apps that use both WK1 and WK2 to use MessagePorts.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Jan 2018 17:45:17 +0000 (17:45 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Jan 2018 17:45:17 +0000 (17:45 +0000)
commit40beaae9c26e0c54234c6a712728284f61f2ebf1
treec7bb6dabf92e96c10833a069134094286e7bd82e
parent032ef20fbd7558f6384939757e467111c42410f2
Make it possible for apps that use both WK1 and WK2 to use MessagePorts.
https://bugs.webkit.org/show_bug.cgi?id=182229

Reviewed by Chris Dumez.

Source/WebCore:

Covered by existing LayoutTests and a new API test.

* dom/messageports/MessagePortChannel.cpp:
(WebCore::MessagePortChannel::checkRemotePortForActivity): Don't use the global singleton
  provider. Instead use the provider that belongs to the owning registry.

* dom/messageports/MessagePortChannelProviderImpl.cpp:
(WebCore::MessagePortChannelProviderImpl::MessagePortChannelProviderImpl): Pass a reference
  to *this to the Registry.
* dom/messageports/MessagePortChannelProviderImpl.h:

* dom/messageports/MessagePortChannelRegistry.cpp:
(WebCore::MessagePortChannelRegistry::MessagePortChannelRegistry): Keep a Provider member so
  MessagePortChannels can get to it instead of relying on the global singleton provider.
* dom/messageports/MessagePortChannelRegistry.h:
(WebCore::MessagePortChannelRegistry::provider):

Source/WebKit:

* UIProcess/UIMessagePortChannelProvider.cpp:
(WebKit::UIMessagePortChannelProvider::UIMessagePortChannelProvider):

* UIProcess/WebPageProxy.cpp:
(WebKit::m_configurationPreferenceValues): The UI process does not need to override the
  global singleton provider. It can remain the default ProviderImpl to allow WK1 views
  to work fine, too.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/MessagePortProviders.mm: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227737 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/messageports/MessagePortChannel.cpp
Source/WebCore/dom/messageports/MessagePortChannelProviderImpl.cpp
Source/WebCore/dom/messageports/MessagePortChannelProviderImpl.h
Source/WebCore/dom/messageports/MessagePortChannelRegistry.cpp
Source/WebCore/dom/messageports/MessagePortChannelRegistry.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/UIMessagePortChannelProvider.cpp
Source/WebKit/UIProcess/WebPageProxy.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKitCocoa/MessagePortProviders.mm [new file with mode: 0644]