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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <oleacc.h> 8 #include <oleacc.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <wtsapi32.h> 10 #include <wtsapi32.h>
11 #pragma comment(lib, "wtsapi32.lib") 11 #pragma comment(lib, "wtsapi32.lib")
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/debug/trace_event.h" 14 #include "base/debug/trace_event.h"
15 #include "base/tracked_objects.h"
15 #include "base/win/scoped_gdi_object.h" 16 #include "base/win/scoped_gdi_object.h"
16 #include "base/win/win_util.h" 17 #include "base/win/win_util.h"
17 #include "base/win/windows_version.h" 18 #include "base/win/windows_version.h"
18 #include "ui/base/touch/touch_enabled.h" 19 #include "ui/base/touch/touch_enabled.h"
19 #include "ui/base/view_prop.h" 20 #include "ui/base/view_prop.h"
20 #include "ui/base/win/internal_constants.h" 21 #include "ui/base/win/internal_constants.h"
21 #include "ui/base/win/lock_state.h" 22 #include "ui/base/win/lock_state.h"
22 #include "ui/base/win/mouse_wheel_util.h" 23 #include "ui/base/win/mouse_wheel_util.h"
23 #include "ui/base/win/shell.h" 24 #include "ui/base/win/shell.h"
24 #include "ui/base/win/touch_input.h" 25 #include "ui/base/win/touch_input.h"
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 delegate_->HandleAccelerator(accelerator); 2120 delegate_->HandleAccelerator(accelerator);
2120 return; 2121 return;
2121 } 2122 }
2122 2123
2123 // If the delegate can't handle it, the system implementation will be called. 2124 // If the delegate can't handle it, the system implementation will be called.
2124 if (!delegate_->HandleCommand(notification_code)) { 2125 if (!delegate_->HandleCommand(notification_code)) {
2125 // If the window is being resized by dragging the borders of the window 2126 // If the window is being resized by dragging the borders of the window
2126 // with the mouse/touch/keyboard, we flag as being in a size loop. 2127 // with the mouse/touch/keyboard, we flag as being in a size loop.
2127 if ((notification_code & sc_mask) == SC_SIZE) 2128 if ((notification_code & sc_mask) == SC_SIZE)
2128 in_size_loop_ = true; 2129 in_size_loop_ = true;
2130 const bool runs_nested_loop = ((notification_code & sc_mask) == SC_SIZE) ||
2131 ((notification_code & sc_mask) == SC_MOVE);
2129 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); 2132 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
2133
2134 // Use task stopwatch to exclude the time spend in the move/resize loop from
2135 // the current task, if any.
2136 tracked_objects::TaskStopwatch stopwatch;
2137 if (runs_nested_loop)
2138 stopwatch.Start();
2130 DefWindowProc(hwnd(), WM_SYSCOMMAND, notification_code, 2139 DefWindowProc(hwnd(), WM_SYSCOMMAND, notification_code,
2131 MAKELPARAM(point.x(), point.y())); 2140 MAKELPARAM(point.x(), point.y()));
2141 if (runs_nested_loop)
2142 stopwatch.Stop();
2143
2132 if (!ref.get()) 2144 if (!ref.get())
2133 return; 2145 return;
2134 in_size_loop_ = false; 2146 in_size_loop_ = false;
2135 } 2147 }
2136 } 2148 }
2137 2149
2138 void HWNDMessageHandler::OnThemeChanged() { 2150 void HWNDMessageHandler::OnThemeChanged() {
2139 ui::NativeThemeWin::instance()->CloseHandles(); 2151 ui::NativeThemeWin::instance()->CloseHandles();
2140 } 2152 }
2141 2153
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); 2523 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW);
2512 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); 2524 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW);
2513 } 2525 }
2514 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want 2526 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want
2515 // to notify our children too, since we can have MDI child windows who need to 2527 // to notify our children too, since we can have MDI child windows who need to
2516 // update their appearance. 2528 // update their appearance.
2517 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); 2529 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL);
2518 } 2530 }
2519 2531
2520 } // namespace views 2532 } // namespace views
OLDNEW
« 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