Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 788883004: Not counting nested loops as time spent in a task (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/hwnd_message_handler.cc
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index c374289cd16c3f077f5e13c5f5d251761c2153ef..6e130c2d8928f3632602e701081817f849e2815f 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -12,6 +12,7 @@
#include "base/bind.h"
#include "base/debug/trace_event.h"
+#include "base/tracked_objects.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/win_util.h"
#include "base/win/windows_version.h"
@@ -2126,9 +2127,20 @@ void HWNDMessageHandler::OnSysCommand(UINT notification_code,
// with the mouse/touch/keyboard, we flag as being in a size loop.
if ((notification_code & sc_mask) == SC_SIZE)
in_size_loop_ = true;
+ const bool runs_nested_loop = ((notification_code & sc_mask) == SC_SIZE) ||
+ ((notification_code & sc_mask) == SC_MOVE);
base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
+
+ // Use task stopwatch to exclude the time spend in the move/resize loop from
+ // the current task, if any.
+ tracked_objects::TaskStopwatch stopwatch;
+ if (runs_nested_loop)
+ stopwatch.Start();
DefWindowProc(hwnd(), WM_SYSCOMMAND, notification_code,
MAKELPARAM(point.x(), point.y()));
+ if (runs_nested_loop)
+ stopwatch.Stop();
+
if (!ref.get())
return;
in_size_loop_ = false;
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698