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

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 879153002: Instrumenting more of WM_ message processing for jank (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « chrome/browser/ui/omnibox/omnibox_edit_model.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>
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 1443
1444 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. 1444 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
1445 tracked_objects::ScopedTracker tracking_profile6( 1445 tracked_objects::ScopedTracker tracking_profile6(
1446 FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 HWNDMessageHandler::OnCreate6")); 1446 FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 HWNDMessageHandler::OnCreate6"));
1447 1447
1448 // We need to allow the delegate to size its contents since the window may not 1448 // We need to allow the delegate to size its contents since the window may not
1449 // receive a size notification when its initial bounds are specified at window 1449 // receive a size notification when its initial bounds are specified at window
1450 // creation time. 1450 // creation time.
1451 ClientAreaSizeChanged(); 1451 ClientAreaSizeChanged();
1452 1452
1453 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
1454 tracked_objects::ScopedTracker tracking_profile7(
1455 FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 HWNDMessageHandler::OnCreate7"));
1456
1453 delegate_->HandleCreate(); 1457 delegate_->HandleCreate();
1454 1458
1459 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
1460 tracked_objects::ScopedTracker tracking_profile8(
1461 FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 HWNDMessageHandler::OnCreate8"));
1462
1455 WTSRegisterSessionNotification(hwnd(), NOTIFY_FOR_THIS_SESSION); 1463 WTSRegisterSessionNotification(hwnd(), NOTIFY_FOR_THIS_SESSION);
1456 1464
1457 // TODO(beng): move more of NWW::OnCreate here. 1465 // TODO(beng): move more of NWW::OnCreate here.
1458 return 0; 1466 return 0;
1459 } 1467 }
1460 1468
1461 void HWNDMessageHandler::OnDestroy() { 1469 void HWNDMessageHandler::OnDestroy() {
1462 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. 1470 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
1463 tracked_objects::ScopedTracker tracking_profile( 1471 tracked_objects::ScopedTracker tracking_profile(
1464 FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 HWNDMessageHandler::OnDestroy")); 1472 FROM_HERE_WITH_EXPLICIT_FUNCTION("440919 HWNDMessageHandler::OnDestroy"));
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2768 2776
2769 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. 2777 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
2770 tracked_objects::ScopedTracker tracking_profile7( 2778 tracked_objects::ScopedTracker tracking_profile7(
2771 FROM_HERE_WITH_EXPLICIT_FUNCTION( 2779 FROM_HERE_WITH_EXPLICIT_FUNCTION(
2772 "440919 HWNDMessageHandler::HandleMouseEventInternal7")); 2780 "440919 HWNDMessageHandler::HandleMouseEventInternal7"));
2773 2781
2774 // There are cases where the code handling the message destroys the window, 2782 // There are cases where the code handling the message destroys the window,
2775 // so use the weak ptr to check if destruction occured or not. 2783 // so use the weak ptr to check if destruction occured or not.
2776 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr()); 2784 base::WeakPtr<HWNDMessageHandler> ref(weak_factory_.GetWeakPtr());
2777 bool handled = delegate_->HandleMouseEvent(event); 2785 bool handled = delegate_->HandleMouseEvent(event);
2786
2787 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
2788 tracked_objects::ScopedTracker tracking_profile8(
2789 FROM_HERE_WITH_EXPLICIT_FUNCTION(
2790 "440919 HWNDMessageHandler::HandleMouseEventInternal8"));
2791
2778 if (!ref.get()) 2792 if (!ref.get())
2779 return 0; 2793 return 0;
2780 if (!handled && message == WM_NCLBUTTONDOWN && w_param != HTSYSMENU && 2794 if (!handled && message == WM_NCLBUTTONDOWN && w_param != HTSYSMENU &&
2781 delegate_->IsUsingCustomFrame()) { 2795 delegate_->IsUsingCustomFrame()) {
2796 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
2797 tracked_objects::ScopedTracker tracking_profile9(
2798 FROM_HERE_WITH_EXPLICIT_FUNCTION(
2799 "440919 HWNDMessageHandler::HandleMouseEventInternal9"));
2800
2782 // TODO(msw): Eliminate undesired painting, or re-evaluate this workaround. 2801 // TODO(msw): Eliminate undesired painting, or re-evaluate this workaround.
2783 // DefWindowProc for WM_NCLBUTTONDOWN does weird non-client painting, so we 2802 // DefWindowProc for WM_NCLBUTTONDOWN does weird non-client painting, so we
2784 // need to call it inside a ScopedRedrawLock. This may cause other negative 2803 // need to call it inside a ScopedRedrawLock. This may cause other negative
2785 // side-effects (ex/ stifling non-client mouse releases). 2804 // side-effects (ex/ stifling non-client mouse releases).
2786 DefWindowProcWithRedrawLock(message, w_param, l_param); 2805 DefWindowProcWithRedrawLock(message, w_param, l_param);
2787 handled = true; 2806 handled = true;
2788 } 2807 }
2789 2808
2790 if (ref.get()) 2809 if (ref.get()) {
2810 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed.
2811 tracked_objects::ScopedTracker tracking_profile10(
2812 FROM_HERE_WITH_EXPLICIT_FUNCTION(
2813 "440919 HWNDMessageHandler::HandleMouseEventInternal10"));
2814
2791 SetMsgHandled(handled); 2815 SetMsgHandled(handled);
2816 }
2792 return 0; 2817 return 0;
2793 } 2818 }
2794 2819
2795 bool HWNDMessageHandler::IsSynthesizedMouseMessage(unsigned int message, 2820 bool HWNDMessageHandler::IsSynthesizedMouseMessage(unsigned int message,
2796 int message_time, 2821 int message_time,
2797 LPARAM l_param) { 2822 LPARAM l_param) {
2798 if (ui::IsMouseEventFromTouch(message)) 2823 if (ui::IsMouseEventFromTouch(message))
2799 return true; 2824 return true;
2800 // Ignore mouse messages which occur at the same location as the current 2825 // Ignore mouse messages which occur at the same location as the current
2801 // cursor position and within a time difference of 500 ms from the last 2826 // cursor position and within a time difference of 500 ms from the last
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2835 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); 2860 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW);
2836 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); 2861 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW);
2837 } 2862 }
2838 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want 2863 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want
2839 // to notify our children too, since we can have MDI child windows who need to 2864 // to notify our children too, since we can have MDI child windows who need to
2840 // update their appearance. 2865 // update their appearance.
2841 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); 2866 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL);
2842 } 2867 }
2843 2868
2844 } // namespace views 2869 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698