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

Side by Side Diff: ui/gfx/win/hwnd_util.cc

Issue 835183002: Further instrumentations to find jank in Windows message processing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months 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 | « base/message_loop/message_pump_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/gfx/win/hwnd_util.h" 5 #include "ui/gfx/win/hwnd_util.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/profiler/scoped_tracker.h"
8 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
9 #include "base/tracked_objects.h" 10 #include "base/tracked_objects.h"
10 #include "base/win/metro.h" 11 #include "base/win/metro.h"
11 #include "base/win/win_util.h" 12 #include "base/win/win_util.h"
12 #include "ui/gfx/geometry/point.h" 13 #include "ui/gfx/geometry/point.h"
13 #include "ui/gfx/geometry/rect.h" 14 #include "ui/gfx/geometry/rect.h"
14 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
15 16
16 namespace gfx { 17 namespace gfx {
17 18
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return oldwindow_proc; 106 return oldwindow_proc;
106 } 107 }
107 108
108 void* SetWindowUserData(HWND hwnd, void* user_data) { 109 void* SetWindowUserData(HWND hwnd, void* user_data) {
109 return 110 return
110 reinterpret_cast<void*>(SetWindowLongPtr(hwnd, GWLP_USERDATA, 111 reinterpret_cast<void*>(SetWindowLongPtr(hwnd, GWLP_USERDATA,
111 reinterpret_cast<LONG_PTR>(user_data))); 112 reinterpret_cast<LONG_PTR>(user_data)));
112 } 113 }
113 114
114 void* GetWindowUserData(HWND hwnd) { 115 void* GetWindowUserData(HWND hwnd) {
116 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
117 tracked_objects::ScopedTracker tracking_profile(
118 FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 GetWindowUserData"));
119
115 DWORD process_id = 0; 120 DWORD process_id = 0;
116 GetWindowThreadProcessId(hwnd, &process_id); 121 GetWindowThreadProcessId(hwnd, &process_id);
117 // A window outside the current process needs to be ignored. 122 // A window outside the current process needs to be ignored.
118 if (process_id != ::GetCurrentProcessId()) 123 if (process_id != ::GetCurrentProcessId())
119 return NULL; 124 return NULL;
cpu_(ooo_6.6-7.5) 2015/01/06 20:46:13 It would be very surprising if this is a bottlenec
120 return reinterpret_cast<void*>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); 125 return reinterpret_cast<void*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
121 } 126 }
122 127
123 #pragma warning(pop) 128 #pragma warning(pop)
124 129
125 bool DoesWindowBelongToActiveWindow(HWND window) { 130 bool DoesWindowBelongToActiveWindow(HWND window) {
126 DCHECK(window); 131 DCHECK(window);
127 HWND top_window = ::GetAncestor(window, GA_ROOT); 132 HWND top_window = ::GetAncestor(window, GA_ROOT);
128 if (!top_window) 133 if (!top_window)
129 return false; 134 return false;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 HMODULE metro = base::win::GetMetroModule(); 249 HMODULE metro = base::win::GetMetroModule();
245 if (!metro) 250 if (!metro)
246 return get_real_hwnd ? ::GetDesktopWindow() : HWND_DESKTOP; 251 return get_real_hwnd ? ::GetDesktopWindow() : HWND_DESKTOP;
247 // In windows 8 metro-mode the root window is not the desktop. 252 // In windows 8 metro-mode the root window is not the desktop.
248 RootWindow root_window = 253 RootWindow root_window =
249 reinterpret_cast<RootWindow>(::GetProcAddress(metro, "GetRootWindow")); 254 reinterpret_cast<RootWindow>(::GetProcAddress(metro, "GetRootWindow"));
250 return root_window(); 255 return root_window();
251 } 256 }
252 257
253 } // namespace gfx 258 } // namespace gfx
OLDNEW
« no previous file with comments | « base/message_loop/message_pump_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698