[webkit-reviews] review granted: [Bug 217870] IPC testing API should have the capability to observe messages being sent and received : [Attachment 411963] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Oct 21 09:18:35 PDT 2020


Darin Adler <darin at apple.com> has granted Ryosuke Niwa <rniwa at webkit.org>'s
request for review:
Bug 217870: IPC testing API should have the capability to observe messages
being sent and received
https://bugs.webkit.org/show_bug.cgi?id=217870

Attachment 411963: Patch

https://bugs.webkit.org/attachment.cgi?id=411963&action=review




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 411963
  --> https://bugs.webkit.org/attachment.cgi?id=411963
Patch

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

> Source/WebKit/Platform/IPC/Connection.cpp:1044
> +	   if (hasDeadObservers)
> +	       m_messageObservers.removeAllMatching([](auto& observer) { return
!observer; });

Seems like we could use removeAllMatching to remove while iterating, and call
didReceiveMessage on the ones we don’t remove instead of having two loops and a
boolean.

> Source/WebKit/Platform/IPC/JSIPCBinding.h:55
> +    object->putDirect(vm, JSC::Identifier::fromString(vm, "type"_s),
JSC::jsNontrivialString(vm, type));

What guarantees non-trivial for this string? Maybe these are always string
constants. If so, consider making the argument ASCIILiteral instead of const
String&.

Even type could be ASCIILiteral instead of const String&.

> Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp:909
> +    JSObjectCallAsFunction(m_context, m_callback, m_callback,
WTF_ARRAY_LENGTH(arguments), arguments, nullptr);

Should be able to use std::size instead of WTF_ARRAY_LENGTH in new code. We can
probably get rid of WTF_ARRAY_LENGTH.

> Tools/TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm:257
> +    RetainPtr<WKWebViewConfiguration> configuration =
adoptNS([[WKWebViewConfiguration alloc] init]);

auto?

> Tools/TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm:302
> +    RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc]
initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get()]);

auto?


More information about the webkit-reviews mailing list