Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Enable IPCMessages debug logging for non-Cocoa ports
https://bugs.webkit.org/show_bug.cgi?id=230081

Reviewed by Alex Christensen.

r282177 temporarily disabled IPCMessages debug logging for
non-Cocoa ports because the generated
MessageArgumentDescriptions.cpp couldn't compile for them. Then,
r282190 fixed the problem. Enable it.

* Platform/IPC/HandleMessage.h:
(IPC::logMessageImpl): Reverted the change of r282177 to enable the logging.
(IPC::logReply): Ditto.
* Scripts/webkit/messages.py:
(generate_message_argument_description_implementation):
ENABLE(IPC_TESTING_API) isn't enabled for non-Cocoa ports yet.
Changed the condition.
* Scripts/webkit/tests/MessageArgumentDescriptions.cpp: Updated
this test expectation.

Canonical link: https://commits.webkit.org/241520@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282236 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fujii committed Sep 9, 2021
1 parent e368492 commit fc42959
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
22 changes: 22 additions & 0 deletions Source/WebKit/ChangeLog
@@ -1,3 +1,25 @@
2021-09-09 Fujii Hironori <Hironori.Fujii@sony.com>

Enable IPCMessages debug logging for non-Cocoa ports
https://bugs.webkit.org/show_bug.cgi?id=230081

Reviewed by Alex Christensen.

r282177 temporarily disabled IPCMessages debug logging for
non-Cocoa ports because the generated
MessageArgumentDescriptions.cpp couldn't compile for them. Then,
r282190 fixed the problem. Enable it.

* Platform/IPC/HandleMessage.h:
(IPC::logMessageImpl): Reverted the change of r282177 to enable the logging.
(IPC::logReply): Ditto.
* Scripts/webkit/messages.py:
(generate_message_argument_description_implementation):
ENABLE(IPC_TESTING_API) isn't enabled for non-Cocoa ports yet.
Changed the condition.
* Scripts/webkit/tests/MessageArgumentDescriptions.cpp: Updated
this test expectation.

2021-09-09 Alex Christensen <achristensen@webkit.org>

Add PrivateClickMeasurement daemon
Expand Down
6 changes: 3 additions & 3 deletions Source/WebKit/Platform/IPC/HandleMessage.h
Expand Up @@ -47,7 +47,7 @@ class Connection;

constexpr unsigned loggingContainerSizeLimit = 200;

#if !LOG_DISABLED && ENABLE(IPC_TESTING_API)
#if !LOG_DISABLED
enum class ForReply : bool { No, Yes };

inline TextStream textStreamForLogging(const Connection& connection, MessageName messageName, ForReply forReply)
Expand All @@ -73,7 +73,7 @@ inline TextStream textStreamForLogging(const Connection& connection, MessageName
template<typename ArgsTuple, size_t... ArgsIndex>
void logMessageImpl(const Connection& connection, MessageName messageName, const ArgsTuple& args, std::index_sequence<ArgsIndex...>)
{
#if !LOG_DISABLED && ENABLE(IPC_TESTING_API)
#if !LOG_DISABLED
auto stream = textStreamForLogging(connection, messageName, ForReply::No);

if (auto argumentDescriptions = messageArgumentDescriptions(messageName))
Expand All @@ -96,7 +96,7 @@ void logMessage(const Connection& connection, MessageName messageName, const Arg
template<typename... T>
void logReply(const Connection& connection, MessageName messageName, const T&... args)
{
#if !LOG_DISABLED && ENABLE(IPC_TESTING_API)
#if !LOG_DISABLED
if (!sizeof...(T))
return;

Expand Down
8 changes: 6 additions & 2 deletions Source/WebKit/Scripts/webkit/messages.py
Expand Up @@ -1236,7 +1236,7 @@ def generate_message_argument_description_implementation(receivers, receiver_hea
result.append('#include "config.h"\n')
result.append('#include "MessageArgumentDescriptions.h"\n')
result.append('\n')
result.append('#if ENABLE(IPC_TESTING_API)\n')
result.append('#if ENABLE(IPC_TESTING_API) || !LOG_DISABLED\n')
result.append('\n')
result.append('#include "JSIPCBinding.h"\n')

Expand All @@ -1257,13 +1257,17 @@ def generate_message_argument_description_implementation(receivers, receiver_hea

result.append('namespace IPC {\n')
result.append('\n')
result.append('#if ENABLE(IPC_TESTING_API)\n')
result.append('\n')

generate_js_value_conversion_function(result, receivers, 'jsValueForArguments', 'Arguments')

result.append('\n')

generate_js_value_conversion_function(result, receivers, 'jsValueForReplyArguments', 'ReplyArguments', lambda message: message.reply_parameters is not None and (message.has_attribute(SYNCHRONOUS_ATTRIBUTE) or message.has_attribute(ASYNC_ATTRIBUTE)))

result.append('\n')
result.append('#endif // ENABLE(IPC_TESTING_API)\n')
result.append('\n')

result += generate_js_argument_descriptions(receivers, 'messageArgumentDescriptions', lambda message: message.parameters)
Expand All @@ -1276,5 +1280,5 @@ def generate_message_argument_description_implementation(receivers, receiver_hea

result.append('} // namespace WebKit\n')
result.append('\n')
result.append('#endif\n')
result.append('#endif // ENABLE(IPC_TESTING_API) || !LOG_DISABLED\n')
return ''.join(result)
Expand Up @@ -25,7 +25,7 @@
#include "config.h"
#include "MessageArgumentDescriptions.h"

#if ENABLE(IPC_TESTING_API)
#if ENABLE(IPC_TESTING_API) || !LOG_DISABLED

#include "JSIPCBinding.h"
#include "ArgumentCoders.h"
Expand Down Expand Up @@ -132,6 +132,8 @@

namespace IPC {

#if ENABLE(IPC_TESTING_API)

std::optional<JSC::JSValue> jsValueForArguments(JSC::JSGlobalObject* globalObject, MessageName name, Decoder& decoder)
{
switch (name) {
Expand Down Expand Up @@ -348,6 +350,8 @@ std::optional<JSC::JSValue> jsValueForReplyArguments(JSC::JSGlobalObject* global
return std::nullopt;
}

#endif // ENABLE(IPC_TESTING_API)

std::optional<Vector<ArgumentDescription>> messageArgumentDescriptions(MessageName name)
{
switch (name) {
Expand Down Expand Up @@ -710,4 +714,4 @@ std::optional<Vector<ArgumentDescription>> messageReplyArgumentDescriptions(Mess

} // namespace WebKit

#endif
#endif // ENABLE(IPC_TESTING_API) || !LOG_DISABLED

0 comments on commit fc42959

Please sign in to comment.