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

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

Issue 816113003: Instrumenting WindowImpl::WndProc to find jank (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 | « no previous file | 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/window_impl.h" 5 #include "ui/gfx/win/window_impl.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "base/profiler/scoped_tracker.h"
12 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
13 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
14 #include "base/win/wrapped_window_proc.h" 15 #include "base/win/wrapped_window_proc.h"
15 #include "ui/gfx/win/hwnd_util.h" 16 #include "ui/gfx/win/hwnd_util.h"
16 17
17 namespace gfx { 18 namespace gfx {
18 19
19 static const DWORD kWindowDefaultChildStyle = 20 static const DWORD kWindowDefaultChildStyle =
20 WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; 21 WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
21 static const DWORD kWindowDefaultStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; 22 static const DWORD kWindowDefaultStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN;
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 void WindowImpl::ClearUserData() { 275 void WindowImpl::ClearUserData() {
275 if (::IsWindow(hwnd_)) 276 if (::IsWindow(hwnd_))
276 gfx::SetWindowUserData(hwnd_, NULL); 277 gfx::SetWindowUserData(hwnd_, NULL);
277 } 278 }
278 279
279 // static 280 // static
280 LRESULT CALLBACK WindowImpl::WndProc(HWND hwnd, 281 LRESULT CALLBACK WindowImpl::WndProc(HWND hwnd,
281 UINT message, 282 UINT message,
282 WPARAM w_param, 283 WPARAM w_param,
283 LPARAM l_param) { 284 LPARAM l_param) {
285 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
286 tracked_objects::ScopedTracker tracking_profile1(
287 FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 WindowImpl::WndProc1"));
288
cpu_(ooo_6.6-7.5) 2014/12/20 00:51:07 shouldn't be that lines 285-288 moved to 304 ?
vadimt 2014/12/20 01:02:14 Done; this is more efficient. FYI, semantically,
284 if (message == WM_NCCREATE) { 289 if (message == WM_NCCREATE) {
290 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
291 tracked_objects::ScopedTracker tracking_profile2(
292 FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 WindowImpl::WndProc2"));
293
285 CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(l_param); 294 CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(l_param);
286 WindowImpl* window = reinterpret_cast<WindowImpl*>(cs->lpCreateParams); 295 WindowImpl* window = reinterpret_cast<WindowImpl*>(cs->lpCreateParams);
287 DCHECK(window); 296 DCHECK(window);
288 gfx::SetWindowUserData(hwnd, window); 297 gfx::SetWindowUserData(hwnd, window);
289 window->hwnd_ = hwnd; 298 window->hwnd_ = hwnd;
290 window->got_create_ = true; 299 window->got_create_ = true;
291 if (hwnd) 300 if (hwnd)
292 window->got_valid_hwnd_ = true; 301 window->got_valid_hwnd_ = true;
293 return TRUE; 302 return TRUE;
294 } 303 }
295 304
296 WindowImpl* window = reinterpret_cast<WindowImpl*>(GetWindowUserData(hwnd)); 305 WindowImpl* window = reinterpret_cast<WindowImpl*>(GetWindowUserData(hwnd));
297 if (!window) 306 if (!window)
298 return 0; 307 return 0;
299 308
300 return window->OnWndProc(message, w_param, l_param); 309 return window->OnWndProc(message, w_param, l_param);
301 } 310 }
302 311
303 ATOM WindowImpl::GetWindowClassAtom() { 312 ATOM WindowImpl::GetWindowClassAtom() {
304 HICON icon = GetDefaultWindowIcon(); 313 HICON icon = GetDefaultWindowIcon();
305 HICON small_icon = GetSmallWindowIcon(); 314 HICON small_icon = GetSmallWindowIcon();
306 ClassInfo class_info(initial_class_style(), icon, small_icon); 315 ClassInfo class_info(initial_class_style(), icon, small_icon);
307 return ClassRegistrar::GetInstance()->RetrieveClassAtom(class_info); 316 return ClassRegistrar::GetInstance()->RetrieveClassAtom(class_info);
308 } 317 }
309 318
310 } // namespace gfx 319 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698