0

Migrated ipc_channel_mojo trace event to typed args

This CL modifies the "ChannelMojo::OnMessageReceived" trace event to use
the existing chrome_legacy_ipc perfetto message and
TRACE_IPC_MESSAGE_SEND macro.

Change-Id: I3dc7162f2a3aaceda4eae0fff5d8d4373f50d60e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2660417
Commit-Queue: Salvador Guerrero <salg@google.com>
Reviewed-by: ssid <ssid@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#849808}
This commit is contained in:
Salvador Guerrero
2021-02-02 22:43:02 +00:00
committed by Chromium LUCI CQ
parent 9c2264265a
commit 1188b40c74
3 changed files with 9 additions and 17 deletions

@ -68,6 +68,8 @@ component("ipc") {
"message_filter_router.h",
"message_router.cc",
"message_router.h",
"trace_ipc_message.cc",
"trace_ipc_message.h",
]
}
@ -92,6 +94,7 @@ component("ipc") {
"//mojo/public/cpp/base",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/system",
"//services/tracing/public/cpp",
]
if (!is_nacl_nonsfi) {
@ -105,14 +108,6 @@ component("ipc") {
if (enable_ipc_fuzzer) {
public_configs = [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
}
if (!is_nacl && !is_ios) {
sources += [
"trace_ipc_message.cc",
"trace_ipc_message.h",
]
public_deps += [ "//services/tracing/public/cpp" ]
}
}
component("message_support") {

@ -26,6 +26,7 @@
#include "ipc/ipc_mojo_bootstrap.h"
#include "ipc/ipc_mojo_handle_attachment.h"
#include "ipc/native_handle_type_converters.h"
#include "ipc/trace_ipc_message.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/lib/message_quota_checker.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
@ -269,9 +270,9 @@ void ChannelMojo::OnPeerPidReceived(int32_t peer_pid) {
}
void ChannelMojo::OnMessageReceived(const Message& message) {
TRACE_EVENT2("ipc,toplevel", "ChannelMojo::OnMessageReceived",
"class", IPC_MESSAGE_ID_CLASS(message.type()),
"line", IPC_MESSAGE_ID_LINE(message.type()));
const Message* message_ptr = &message;
TRACE_IPC_MESSAGE_SEND("ipc,toplevel", "ChannelMojo::OnMessageReceived",
message_ptr);
listener_->OnMessageReceived(message);
if (message.dispatch_error())
listener_->OnBadMessageReceived(message);

@ -28,7 +28,7 @@
#include "ipc/ipc_sync_message.h"
#include "mojo/public/cpp/bindings/sync_event_watcher.h"
#if !defined(OS_NACL) && !BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#if !BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#include "ipc/trace_ipc_message.h"
#endif
@ -614,12 +614,8 @@ bool SyncChannel::Send(Message* message) {
Logging::GetInstance()->GetMessageText(
message->type(), &name, message, nullptr);
TRACE_EVENT1("ipc", "SyncChannel::Send", "name", name);
#elif !defined(OS_NACL)
TRACE_IPC_MESSAGE_SEND("ipc", "SyncChannel::Send", message);
#else
TRACE_EVENT2("ipc", "SyncChannel::Send",
"class", IPC_MESSAGE_ID_CLASS(message->type()),
"line", IPC_MESSAGE_ID_LINE(message->type()));
TRACE_IPC_MESSAGE_SEND("ipc", "SyncChannel::Send", message);
#endif
if (!message->is_sync()) {
ChannelProxy::SendInternal(message);