Commit b0230092 authored by Daniel Libby's avatar Daniel Libby Committed by Commit Bot

Add tracing to track down hidden mouse cursors

We've seen a number of bug reports in Edge of the mouse cursor not
showing. There doesn't seem to be much tracing in the area, so adding
a few trace events to try and help narrow this down.s

Change-Id: I18c01a3847ae1d4cc16c36c9be3a5b9216b65e19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2140600Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Daniel Libby <dlibby@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#757501}
parent cddee29f
......@@ -6,6 +6,7 @@
#include <utility>
#include "base/trace_event/trace_event.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/cursor/cursor_loader.h"
......@@ -59,6 +60,8 @@ void DesktopNativeCursorManager::SetCursor(
void DesktopNativeCursorManager::SetVisibility(
bool visible,
wm::NativeCursorManagerDelegate* delegate) {
TRACE_EVENT1("ui,input", "DesktopNativeCursorManager::SetVisibility",
"visible", visible);
delegate->CommitVisibility(visible);
if (visible) {
......@@ -83,6 +86,7 @@ void DesktopNativeCursorManager::SetCursorSize(
void DesktopNativeCursorManager::SetMouseEventsEnabled(
bool enabled,
wm::NativeCursorManagerDelegate* delegate) {
TRACE_EVENT0("ui,input", "DesktopNativeCursorManager::SetMouseEventsEnabled");
delegate->CommitMouseEventsEnabled(enabled);
// TODO(erg): In the ash version, we set the last mouse location on Env. I'm
......
......@@ -12,6 +12,7 @@
#include "base/containers/flat_set.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/trace_event/trace_event.h"
#include "base/win/win_util.h"
#include "base/win/windows_version.h"
#include "third_party/skia/include/core/SkPath.h"
......@@ -622,6 +623,8 @@ DesktopWindowTreeHostWin::GetKeyboardLayoutMap() {
}
void DesktopWindowTreeHostWin::SetCursorNative(gfx::NativeCursor cursor) {
TRACE_EVENT1("ui,input", "DesktopWindowTreeHostWin::SetCursorNative",
"cursor", cursor.type());
ui::CursorLoaderWin cursor_loader;
cursor_loader.SetPlatformCursor(&cursor);
......
......@@ -864,6 +864,8 @@ bool HWNDMessageHandler::SetTitle(const base::string16& title) {
}
void HWNDMessageHandler::SetCursor(HCURSOR cursor) {
TRACE_EVENT2("ui,input", "HWNDMessageHandler::SetCursor", "cursor", cursor,
"previous_cursor", previous_cursor_);
if (cursor) {
previous_cursor_ = ::SetCursor(cursor);
current_cursor_ = cursor;
......
......@@ -5,6 +5,7 @@
#include "ui/wm/core/compound_event_filter.h"
#include "base/logging.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/client/drag_drop_client.h"
......@@ -157,12 +158,20 @@ void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target,
void CompoundEventFilter::SetMouseEventsEnableStateOnEvent(aura::Window* target,
ui::Event* event,
bool enable) {
TRACE_EVENT2("ui,input",
"CompoundEventFilter::SetMouseEventsEnableStateOnEvent",
"event_flags", event->flags(), "enable", enable);
if (event->flags() & ui::EF_IS_SYNTHESIZED)
return;
aura::client::CursorClient* client =
aura::client::GetCursorClient(target->GetRootWindow());
if (!client)
if (!client) {
TRACE_EVENT_INSTANT0(
"ui,input",
"CompoundEventFilter::SetMouseEventsEnableStateOnEvent - No Client",
TRACE_EVENT_SCOPE_THREAD);
return;
}
if (enable)
client->EnableMouseEvents();
......@@ -184,6 +193,8 @@ void CompoundEventFilter::OnKeyEvent(ui::KeyEvent* event) {
}
void CompoundEventFilter::OnMouseEvent(ui::MouseEvent* event) {
TRACE_EVENT2("ui,input", "CompoundEventFilter::OnMouseEvent", "event_type",
event->type(), "event_flags", event->flags());
aura::Window* window = static_cast<aura::Window*>(event->target());
// We must always update the cursor, otherwise the cursor can get stuck if an
......@@ -211,6 +222,8 @@ void CompoundEventFilter::OnScrollEvent(ui::ScrollEvent* event) {
}
void CompoundEventFilter::OnTouchEvent(ui::TouchEvent* event) {
TRACE_EVENT2("ui,input", "CompoundEventFilter::OnTouchEvent", "event_type",
event->type(), "event_handled", event->handled());
FilterTouchEvent(event);
if (!event->handled() && event->type() == ui::ET_TOUCH_PRESSED &&
ShouldHideCursorOnTouch(*event)) {
......
......@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/trace_event/trace_event.h"
#include "ui/aura/client/cursor_client_observer.h"
#include "ui/base/cursor/cursor_size.h"
#include "ui/base/mojom/cursor_type.mojom-shared.h"
......@@ -154,6 +155,7 @@ ui::CursorSize CursorManager::GetCursorSize() const {
}
void CursorManager::EnableMouseEvents() {
TRACE_EVENT0("ui,input", "CursorManager::EnableMouseEvents");
state_on_unlock_->SetMouseEventsEnabled(true);
if (cursor_lock_count_ == 0 &&
IsMouseEventsEnabled() != state_on_unlock_->mouse_events_enabled()) {
......@@ -163,6 +165,7 @@ void CursorManager::EnableMouseEvents() {
}
void CursorManager::DisableMouseEvents() {
TRACE_EVENT0("ui,input", "CursorManager::DisableMouseEvents");
state_on_unlock_->SetMouseEventsEnabled(false);
if (cursor_lock_count_ == 0 &&
IsMouseEventsEnabled() != state_on_unlock_->mouse_events_enabled()) {
......
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