Commit d01cb269 authored by Salvador Guerrero's avatar Salvador Guerrero Committed by Commit Bot

Change trace events in HWNDMessageHandler to use typed arguments

This CL modifies the trace events added in
http://crrev.com/c/2229611 to used typed arguments.

It also fixes a typo in an event name (OnDwmCompositionChanged ->
OnDpiChanged).

Change-Id: I04e5c125f1d68be1be2a19414cd363992b7a7b1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2472501
Commit-Queue: Salvador Guerrero <salg@google.com>
Reviewed-by: default avataroysteine <oysteine@chromium.org>
Reviewed-by: default avatarEric Seckler <eseckler@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819059}
parent 30e5343c
...@@ -180,10 +180,15 @@ constexpr int kChromeRendererSchedulerStateIndices[] = {1, -1}; ...@@ -180,10 +180,15 @@ constexpr int kChromeRendererSchedulerStateIndices[] = {1, -1};
constexpr MessageInfo kChromeRendererSchedulerState = { constexpr MessageInfo kChromeRendererSchedulerState = {
kChromeRendererSchedulerStateIndices, nullptr}; kChromeRendererSchedulerStateIndices, nullptr};
// Proto Message: ChromeWindowHandleEventInfo
constexpr int kChromeWindowHandleEventInfoIndices[] = {1, 2, -1};
constexpr MessageInfo kChromeWindowHandleEventInfo = {
kChromeWindowHandleEventInfoIndices, nullptr};
// Proto Message: TrackEvent // Proto Message: TrackEvent
constexpr int kTrackEventIndices[] = {1, 2, 3, 5, 6, 9, 10, 11, 12, constexpr int kTrackEventIndices[] = {1, 2, 3, 5, 6, 9, 10, 11, 12,
16, 17, 24, 25, 26, 27, 28, 29, 30, 16, 17, 24, 25, 26, 27, 28, 29, 30,
31, 32, 33, 34, 35, 38, 40, -1}; 31, 32, 33, 34, 35, 38, 40, 41, -1};
constexpr MessageInfo const* kTrackEventComplexMessages[] = { constexpr MessageInfo const* kTrackEventComplexMessages[] = {
nullptr, nullptr,
nullptr, nullptr,
...@@ -209,7 +214,8 @@ constexpr MessageInfo const* kTrackEventComplexMessages[] = { ...@@ -209,7 +214,8 @@ constexpr MessageInfo const* kTrackEventComplexMessages[] = {
nullptr, nullptr,
&kChromeMessagePump, &kChromeMessagePump,
&kChromeMojoEventInfo, &kChromeMojoEventInfo,
&kChromeRendererSchedulerState}; &kChromeRendererSchedulerState,
&kChromeWindowHandleEventInfo};
constexpr MessageInfo kTrackEvent = {kTrackEventIndices, constexpr MessageInfo kTrackEvent = {kTrackEventIndices,
kTrackEventComplexMessages}; kTrackEventComplexMessages};
......
...@@ -38,7 +38,6 @@ const char* const kMemoryDumpAllowedArgs[] = { ...@@ -38,7 +38,6 @@ const char* const kMemoryDumpAllowedArgs[] = {
const char* const kRendererHostAllowedArgs[] = { const char* const kRendererHostAllowedArgs[] = {
"class", "line", "should_background", "has_pending_views", "class", "line", "should_background", "has_pending_views",
"bytes_allocated", nullptr}; "bytes_allocated", nullptr};
const char* const kUIAllowedArgs[] = {"dpi", "message_id", nullptr};
const char* const kV8GCAllowedArgs[] = {"num_items", "num_tasks", nullptr}; const char* const kV8GCAllowedArgs[] = {"num_items", "num_tasks", nullptr};
const char* const kTopLevelFlowAllowedArgs[] = {"task_queue_name", nullptr}; const char* const kTopLevelFlowAllowedArgs[] = {"task_queue_name", nullptr};
const char* const kTopLevelIpcRunTaskAllowedArgs[] = {"ipc_hash", nullptr}; const char* const kTopLevelIpcRunTaskAllowedArgs[] = {"ipc_hash", nullptr};
...@@ -96,8 +95,6 @@ const AllowlistEntry kEventArgsAllowlist[] = { ...@@ -96,8 +95,6 @@ const AllowlistEntry kEventArgsAllowlist[] = {
{TRACE_DISABLED_BY_DEFAULT("memory-infra"), "*", kMemoryDumpAllowedArgs}, {TRACE_DISABLED_BY_DEFAULT("memory-infra"), "*", kMemoryDumpAllowedArgs},
{TRACE_DISABLED_BY_DEFAULT("system_stats"), "*", nullptr}, {TRACE_DISABLED_BY_DEFAULT("system_stats"), "*", nullptr},
{TRACE_DISABLED_BY_DEFAULT("v8.gc"), "*", kV8GCAllowedArgs}, {TRACE_DISABLED_BY_DEFAULT("v8.gc"), "*", kV8GCAllowedArgs},
{"ui", "HWNDMessageHandler::OnWndProc", kUIAllowedArgs},
{"ui", "HWNDMessageHandler::OnDwmCompositionChanged", kUIAllowedArgs},
{"ui", "RenderTextHarfBuzz::FallbackFont", kFallbackFontAllowedArgs}, {"ui", "RenderTextHarfBuzz::FallbackFont", kFallbackFontAllowedArgs},
{"ui", "RenderTextHarfBuzz::GetFallbackFonts", {"ui", "RenderTextHarfBuzz::GetFallbackFonts",
kGetFallbackFontsAllowedArgs}, kGetFallbackFontsAllowedArgs},
......
...@@ -13,6 +13,8 @@ include_rules = [ ...@@ -13,6 +13,8 @@ include_rules = [
"-ui/views", "-ui/views",
"+base", "+base",
"+services/tracing/public",
"+third_party/perfetto/protos/perfetto/trace/track_event",
"+ui/base", "+ui/base",
"+ui/gfx", "+ui/gfx",
"+ui/latency", "+ui/latency",
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "base/win/scoped_gdi_object.h" #include "base/win/scoped_gdi_object.h"
#include "base/win/win_util.h" #include "base/win/win_util.h"
#include "base/win/windows_version.h" #include "base/win/windows_version.h"
#include "services/tracing/public/cpp/perfetto/macros.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/chrome_window_handle_event_info.pbzero.h"
#include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkPath.h"
#include "ui/accessibility/accessibility_switches.h" #include "ui/accessibility/accessibility_switches.h"
#include "ui/accessibility/platform/ax_fragment_root_win.h" #include "ui/accessibility/platform/ax_fragment_root_win.h"
...@@ -988,7 +990,12 @@ HICON HWNDMessageHandler::GetSmallWindowIcon() const { ...@@ -988,7 +990,12 @@ HICON HWNDMessageHandler::GetSmallWindowIcon() const {
LRESULT HWNDMessageHandler::OnWndProc(UINT message, LRESULT HWNDMessageHandler::OnWndProc(UINT message,
WPARAM w_param, WPARAM w_param,
LPARAM l_param) { LPARAM l_param) {
TRACE_EVENT1("ui", "HWNDMessageHandler::OnWndProc", "message_id", message); TRACE_EVENT("ui", "HWNDMessageHandler::OnWndProc",
[&](perfetto::EventContext ctx) {
perfetto::protos::pbzero::ChromeWindowHandleEventInfo* args =
ctx.event()->set_chrome_window_handle_event_info();
args->set_message_id(message);
});
HWND window = hwnd(); HWND window = hwnd();
LRESULT result = 0; LRESULT result = 0;
...@@ -1696,8 +1703,12 @@ LRESULT HWNDMessageHandler::OnDpiChanged(UINT msg, ...@@ -1696,8 +1703,12 @@ LRESULT HWNDMessageHandler::OnDpiChanged(UINT msg,
if (LOWORD(w_param) != HIWORD(w_param)) if (LOWORD(w_param) != HIWORD(w_param))
NOTIMPLEMENTED() << "Received non-square scaling factors"; NOTIMPLEMENTED() << "Received non-square scaling factors";
TRACE_EVENT1("ui", "HWNDMessageHandler::OnDwmCompositionChanged", "dpi", TRACE_EVENT("ui", "HWNDMessageHandler::OnDpiChanged",
LOWORD(w_param)); [&](perfetto::EventContext ctx) {
perfetto::protos::pbzero::ChromeWindowHandleEventInfo* args =
ctx.event()->set_chrome_window_handle_event_info();
args->set_dpi(LOWORD(w_param));
});
int dpi; int dpi;
float scaling_factor; float scaling_factor;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment