Commit 2e7c4448 authored by vadimt's avatar vadimt Committed by Commit bot

Instrumenting more of WM_ message processing for jank

This covers some Omnibox stuff, which is probably responsible for the jank in keyboard messages processing and drilling down some of issues.
There are some issues that require advanced investigations that are not included in this CL:
1. PeekMessage, which is probably processing hooks
2. DispatchMessage, maybe, having same issues
3. GetQueueStatus (!!!)
4. DefWndProc

BUG=440919

Review URL: https://codereview.chromium.org/879153002

Cr-Commit-Position: refs/heads/master@{#313529}
parent 719d8624
......@@ -165,9 +165,9 @@ void MessagePumpForUI::ScheduleDelayedWork(const TimeTicks& delayed_work_time) {
LRESULT CALLBACK MessagePumpForUI::WndProcThunk(
HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
tracked_objects::ScopedTracker tracking_profile(
tracked_objects::ScopedTracker tracking_profile1(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"440919 MessagePumpForUI::WndProcThunk"));
"440919 MessagePumpForUI::WndProcThunk1"));
switch (message) {
case kMsgHaveWork:
......@@ -177,6 +177,12 @@ LRESULT CALLBACK MessagePumpForUI::WndProcThunk(
reinterpret_cast<MessagePumpForUI*>(wparam)->HandleTimerMessage();
break;
}
// TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
tracked_objects::ScopedTracker tracking_profile2(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"440919 MessagePumpForUI::WndProcThunk2"));
return DefWindowProc(hwnd, message, wparam, lparam);
}
......
......@@ -11,6 +11,7 @@
#include "base/format_macros.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
#include "base/profiler/scoped_tracker.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
......@@ -553,6 +554,10 @@ void OmniboxEditModel::Revert() {
void OmniboxEditModel::StartAutocomplete(
bool has_selected_text,
bool prevent_inline_autocomplete) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"440919 OmniboxEditModel::StartAutocomplete"));
size_t cursor_position;
if (inline_autocomplete_text_.empty()) {
// Cursor position is equivalent to the current selection's end.
......
......@@ -1450,8 +1450,16 @@ LRESULT HWNDMessageHandler::OnCreate(CREATESTRUCT* create_struct) {
// creation time.
ClientAreaSizeChanged();
// TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
tracked_objects::ScopedTracker tracking_profile7(
FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 HWNDMessageHandler::OnCreate7"));
delegate_->HandleCreate();
// TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
tracked_objects::ScopedTracker tracking_profile8(
FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 HWNDMessageHandler::OnCreate8"));
WTSRegisterSessionNotification(hwnd(), NOTIFY_FOR_THIS_SESSION);
// TODO(beng): move more of NWW::OnCreate here.
......@@ -2775,10 +2783,21 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
// so use the weak ptr to check if destruction occured or not.
base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
bool handled = delegate_->HandleMouseEvent(event);
// TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
tracked_objects::ScopedTracker tracking_profile8(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"440919 HWNDMessageHandler::HandleMouseEventInternal8"));
if (!ref.get())
return 0;
if (!handled && message == WM_NCLBUTTONDOWN && w_param != HTSYSMENU &&
delegate_->IsUsingCustomFrame()) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
tracked_objects::ScopedTracker tracking_profile9(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"440919 HWNDMessageHandler::HandleMouseEventInternal9"));
// TODO(msw): Eliminate undesired painting, or re-evaluate this workaround.
// DefWindowProc for WM_NCLBUTTONDOWN does weird non-client painting, so we
// need to call it inside a ScopedRedrawLock. This may cause other negative
......@@ -2787,8 +2806,14 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
handled = true;
}
if (ref.get())
if (ref.get()) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
tracked_objects::ScopedTracker tracking_profile10(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"440919 HWNDMessageHandler::HandleMouseEventInternal10"));
SetMsgHandled(handled);
}
return 0;
}
......
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