Bug 167306 - [WebRTC] Add support for WK2 libwebrtc endpoint
Summary: [WebRTC] Add support for WK2 libwebrtc endpoint
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on: 167294
Blocks: 143211
  Show dependency treegraph
 
Reported: 2017-01-23 07:35 PST by youenn fablet
Modified: 2017-01-31 11:38 PST (History)
9 users (show)

See Also:


Attachments
Patch (155.07 KB, patch)
2017-01-23 08:03 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (137.43 KB, patch)
2017-01-24 09:17 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (137.51 KB, patch)
2017-01-24 10:14 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (138.02 KB, patch)
2017-01-24 13:40 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (148.80 KB, patch)
2017-01-26 18:16 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (136.29 KB, patch)
2017-01-27 16:38 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (164.80 KB, patch)
2017-01-29 14:31 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (164.58 KB, patch)
2017-01-30 18:27 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (164.53 KB, patch)
2017-01-30 20:07 PST, youenn fablet
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews122 for ios-simulator-wk2 (890.12 KB, application/zip)
2017-01-31 02:05 PST, Build Bot
no flags Details
Patch for landing (164.35 KB, patch)
2017-01-31 11:00 PST, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2017-01-23 07:35:40 PST
Add support for WK2 libwebrtc endpoint
Comment 1 youenn fablet 2017-01-23 08:03:35 PST
Created attachment 299515 [details]
Patch
Comment 2 youenn fablet 2017-01-24 09:17:52 PST
Created attachment 299606 [details]
Patch
Comment 3 WebKit Commit Bot 2017-01-24 09:19:59 PST
Attachment 299606 [details] did not pass style-queue:


ERROR: Source/WebKit2/WebProcess/Network/webrtc/WebPacketSocket.h:48:  enum members should use InterCaps with an initial capital letter or initial 'k' for C-style enums.  [readability/enum_casing] [4]
ERROR: Source/WebKit2/NetworkProcess/webrtc/NetworkNetworkManager.h:46:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/WebProcess/Network/webrtc/WebPacketSocketFactory.h:63:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.cpp:38:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.h:50:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 5 in 34 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 youenn fablet 2017-01-24 10:14:23 PST
Created attachment 299608 [details]
Patch
Comment 5 WebKit Commit Bot 2017-01-24 10:16:34 PST
Attachment 299608 [details] did not pass style-queue:


ERROR: Source/WebKit2/WebProcess/Network/webrtc/WebPacketSocket.h:48:  enum members should use InterCaps with an initial capital letter or initial 'k' for C-style enums.  [readability/enum_casing] [4]
ERROR: Source/WebKit2/CMakeLists.txt:595:  There should be exactly one empty line instead of 0 between "NetworkProcess/NetworkResourceLoader.messages.in" and "NetworkProcess/webrtc/NetworkPacketSocket.messages.in".  [list/emptyline] [5]
ERROR: Source/WebKit2/NetworkProcess/webrtc/NetworkNetworkManager.h:46:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/WebProcess/Network/webrtc/WebPacketSocketFactory.h:63:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.cpp:38:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.h:52:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 6 in 34 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 youenn fablet 2017-01-24 13:40:05 PST
Created attachment 299623 [details]
Patch
Comment 7 WebKit Commit Bot 2017-01-24 13:43:09 PST
Attachment 299623 [details] did not pass style-queue:


ERROR: Source/WebKit2/WebProcess/Network/webrtc/WebPacketSocket.h:48:  enum members should use InterCaps with an initial capital letter or initial 'k' for C-style enums.  [readability/enum_casing] [4]
ERROR: Source/WebKit2/CMakeLists.txt:595:  There should be exactly one empty line instead of 0 between "NetworkProcess/NetworkResourceLoader.messages.in" and "NetworkProcess/webrtc/NetworkPacketSocket.messages.in".  [list/emptyline] [5]
ERROR: Source/WebKit2/NetworkProcess/webrtc/NetworkNetworkManager.h:46:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/WebProcess/Network/webrtc/WebPacketSocketFactory.h:63:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.cpp:40:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.h:52:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 6 in 34 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 youenn fablet 2017-01-26 18:16:32 PST
Created attachment 299893 [details]
Patch
Comment 9 WebKit Commit Bot 2017-01-26 18:19:50 PST
Attachment 299893 [details] did not pass style-queue:


ERROR: Source/WebKit2/WebProcess/Network/webrtc/WebPacketSocket.h:49:  enum members should use InterCaps with an initial capital letter or initial 'k' for C-style enums.  [readability/enum_casing] [4]
ERROR: Source/WebKit2/NetworkProcess/webrtc/NetworkNetworkManager.h:46:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/WebProcess/Network/webrtc/WebPacketSocketFactory.h:63:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.cpp:40:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.h:52:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 5 in 34 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 Alex Christensen 2017-01-27 11:42:14 PST
Comment on attachment 299893 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=299893&action=review

> Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h:154
> +    NetworkNetworkManager m_networkManager;

Neither of these are good names.

> Source/WebKit2/NetworkProcess/webrtc/NetworkPacketSocket.cpp:100
> +void NetworkPacketSocket::OnMessage(rtc::Message* message)
> +{
> +    ASSERT(message->message_id == 1);
> +    delete this;
> +}

This seems strange.

> Source/WebKit2/WebKit2.xcodeproj/project.pbxproj:10318
> +				HEADER_SEARCH_PATHS = (
> +					"$(BUILT_PRODUCTS_DIR)/usr/local/include",
> +					"\"$(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders\"",
> +					"\"$(WEBCORE_PRIVATE_HEADERS_DIR)/icu\"",

We shouldn't need to add any more WEBCORE include directories to WebKit2.
Comment 11 youenn fablet 2017-01-27 16:38:51 PST
Created attachment 299978 [details]
Patch
Comment 12 WebKit Commit Bot 2017-01-27 16:40:33 PST
Attachment 299978 [details] did not pass style-queue:


ERROR: Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCResolver.h:46:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/WebProcess/Network/webrtc/WebPacketSocketFactory.h:63:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.cpp:39:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCPacketSocket.h:53:  enum members should use InterCaps with an initial capital letter or initial 'k' for C-style enums.  [readability/enum_casing] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.h:51:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 5 in 36 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 13 Radar WebKit Bug Importer 2017-01-27 17:41:32 PST
<rdar://problem/30245426>
Comment 14 youenn fablet 2017-01-29 14:31:29 PST
Created attachment 300074 [details]
Patch
Comment 15 WebKit Commit Bot 2017-01-29 14:33:38 PST
Attachment 300074 [details] did not pass style-queue:


ERROR: Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:34:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCResolver.h:40:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/NetworkProcess/webrtc/NetworkRTCMonitor.h:46:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/WebProcess/Network/webrtc/WebRTCResolver.h:34:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.cpp:40:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.h:52:  enum members should use InterCaps with an initial capital letter or initial 'k' for C-style enums.  [readability/enum_casing] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.h:52:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 7 in 41 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 16 Alex Christensen 2017-01-30 16:09:38 PST
Comment on attachment 300074 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=300074&action=review

partial review.  I'm not sure this is organized completely correctly.

> Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp:76
> +        m_rtcProvider->close();

Can this happen with a destructor instead of having to call close every time we might lose it?

> Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h:120
> +    RefPtr<NetworkRTCProvider> m_rtcProvider;

Does this need to be ref counted?  It seems to only have one or zero references.

> Source/WebKit2/NetworkProcess/webrtc/NetworkRTCMonitor.messages.in:25
> +messages -> NetworkRTCMonitor LegacyReceiver {

Could we not add LegacyReceiver to new IPC message types?

> Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.cpp:56
> +    std::fill_n(m_options, MAX_SOCKET_OPTION, -1);

could we use memset and sizeof?  That would feel safer, although it's the same in this case.

> Source/WebKit2/WebProcess/Network/webrtc/WebRTCResolver.h:35
> +    class Decoder;

no indent

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:384
> +#if USE(LIBWEBRTC)
> +        makeUniqueRef<WebKit::LibWebRTCProvider>()
> +#else
>          makeUniqueRef<WebCore::LibWebRTCProvider>()
> +#endif

Could we do something similar and have WebKit::LibWebRTCProvider exist and do nothing if USE(LIBWEBRTC) is false?

> Source/WebKit2/WebProcess/WebProcess.h:171
> +    LibWebRTC& libWebRTC() { return *m_libWebRTC; }
> +    void initializeLibWebRTC();

The name LibWebRTC doesn't indicate what this class does.
Also, we requiring the caller to call initializeLibWebRTC before calling libWebRTC is strange.  Could we just check if it's null and if it is then create one?  Then we'd only need one function.
Comment 17 youenn fablet 2017-01-30 18:18:26 PST
Thanks for the initial review.

> View in context:
> https://bugs.webkit.org/attachment.cgi?id=300074&action=review
> 
> partial review.  I'm not sure this is organized completely correctly.
> 
> > Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp:76
> > +        m_rtcProvider->close();
> 
> Can this happen with a destructor instead of having to call close every time
> we might lose it?

m_rtcProvider may remain live while NetworkConnectionToWebProcess is gone.
close ensures m_rtcProvider will not use its deleted NetworkConnectionToWebProcess.

> > Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h:120
> > +    RefPtr<NetworkRTCProvider> m_rtcProvider;
> 
> Does this need to be ref counted?  It seems to only have one or zero
> references.

It is refcounted each time we go to/from the rtc thread/main thread.
In the future, we should find a path to go directly from web process rtc thread to network process rtc thread

> 
> > Source/WebKit2/NetworkProcess/webrtc/NetworkRTCMonitor.messages.in:25
> > +messages -> NetworkRTCMonitor LegacyReceiver {
> 
> Could we not add LegacyReceiver to new IPC message types?

Will try.

> > Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.cpp:56
> > +    std::fill_n(m_options, MAX_SOCKET_OPTION, -1);
> 
> could we use memset and sizeof?  That would feel safer, although it's the
> same in this case.

OK

> > Source/WebKit2/WebProcess/Network/webrtc/WebRTCResolver.h:35
> > +    class Decoder;
> 
> no indent

OK

> > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:384
> > +#if USE(LIBWEBRTC)
> > +        makeUniqueRef<WebKit::LibWebRTCProvider>()
> > +#else
> >          makeUniqueRef<WebCore::LibWebRTCProvider>()
> > +#endif
> 
> Could we do something similar and have WebKit::LibWebRTCProvider exist and
> do nothing if USE(LIBWEBRTC) is false?

OK

> > Source/WebKit2/WebProcess/WebProcess.h:171
> > +    LibWebRTC& libWebRTC() { return *m_libWebRTC; }
> > +    void initializeLibWebRTC();
> 
> The name LibWebRTC doesn't indicate what this class does.

Let's change it to LibWebRTCNetwork

> Also, we requiring the caller to call initializeLibWebRTC before calling
> libWebRTC is strange.  Could we just check if it's null and if it is then
> create one?  Then we'd only need one function.

Sure, that is really a left over.
Comment 18 youenn fablet 2017-01-30 18:27:39 PST
Created attachment 300177 [details]
Patch
Comment 19 WebKit Commit Bot 2017-01-30 18:30:27 PST
Attachment 300177 [details] did not pass style-queue:


ERROR: Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCResolver.h:40:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/NetworkProcess/webrtc/NetworkRTCMonitor.h:46:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.cpp:40:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.h:52:  enum members should use InterCaps with an initial capital letter or initial 'k' for C-style enums.  [readability/enum_casing] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.h:52:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 5 in 41 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 20 youenn fablet 2017-01-30 20:07:36 PST
Created attachment 300182 [details]
Patch
Comment 21 WebKit Commit Bot 2017-01-30 20:10:05 PST
Attachment 300182 [details] did not pass style-queue:


ERROR: Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCResolver.h:40:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/NetworkProcess/webrtc/NetworkRTCMonitor.h:46:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.cpp:40:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.h:52:  enum members should use InterCaps with an initial capital letter or initial 'k' for C-style enums.  [readability/enum_casing] [4]
ERROR: Source/WebKit2/Shared/RTCNetwork.h:52:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 5 in 41 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 22 Build Bot 2017-01-31 02:05:30 PST
Comment on attachment 300182 [details]
Patch

Attachment 300182 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/2978395

New failing tests:
css3/filters/backdrop/dynamic-with-clip-path.html
Comment 23 Build Bot 2017-01-31 02:05:33 PST
Created attachment 300198 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 24 youenn fablet 2017-01-31 08:27:18 PST
Comment on attachment 300182 [details]
Patch

Failure is unrelated to this patch
Comment 25 Alex Christensen 2017-01-31 10:34:52 PST
Comment on attachment 300182 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=300182&action=review

> Source/WebKit2/ChangeLog:11
> +        1 Resolution of DNS names (RTCResikver)

RTCResolver

> Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:61
> +

extra space

> Source/WebKit2/NetworkProcess/webrtc/LibWebRTCSocketClient.cpp:91
> +    auto identifier = m_identifier;
> +    m_rtcProvider.sendFromMainThread([identifier, sentPacket](IPC::Connection& connection) {

You might be able to do identifier = m_identifier

> Source/WebKit2/NetworkProcess/webrtc/NetworkRTCProvider.cpp:133
> +    CFHostClientContext context;
> +    context.version = 0;
> +    context.info = resolver.get();
> +    context.copyDescription = nullptr;
> +    context.release = nullptr;
> +    context.retain = nullptr;

Let's use an initializer list.

> Source/WebKit2/WebProcess/Network/webrtc/LibWebRTCSocket.h:100
> +    size_t m_availableSendingBytes { 65536 };

This should be a named constant.
Comment 26 youenn fablet 2017-01-31 11:00:02 PST
Created attachment 300236 [details]
Patch for landing
Comment 27 WebKit Commit Bot 2017-01-31 11:38:49 PST
Comment on attachment 300236 [details]
Patch for landing

Clearing flags on attachment: 300236

Committed r211441: <http://trac.webkit.org/changeset/211441>
Comment 28 WebKit Commit Bot 2017-01-31 11:38:56 PST
All reviewed patches have been landed.  Closing bug.