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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 378038: Add a RWH_TabSwitchPaintDuration histogram. (Closed)
Patch Set: remove tab switching test changes Created 11 years, 1 month 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include "base/histogram.h" 7 #include "base/histogram.h"
8 #import "base/scoped_nsobject.h" 8 #import "base/scoped_nsobject.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 112
113 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const { 113 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const {
114 return render_widget_host_; 114 return render_widget_host_;
115 } 115 }
116 116
117 void RenderWidgetHostViewMac::DidBecomeSelected() { 117 void RenderWidgetHostViewMac::DidBecomeSelected() {
118 if (!is_hidden_) 118 if (!is_hidden_)
119 return; 119 return;
120 120
121 if (tab_switch_paint_time_.is_null())
122 tab_switch_paint_time_ = base::TimeTicks::Now();
121 is_hidden_ = false; 123 is_hidden_ = false;
122 render_widget_host_->WasRestored(); 124 render_widget_host_->WasRestored();
123 } 125 }
124 126
125 void RenderWidgetHostViewMac::WasHidden() { 127 void RenderWidgetHostViewMac::WasHidden() {
126 if (is_hidden_) 128 if (is_hidden_)
127 return; 129 return;
128 130
129 // If we receive any more paint messages while we are hidden, we want to 131 // If we receive any more paint messages while we are hidden, we want to
130 // ignore them so we don't re-allocate the backing store. We will paint 132 // ignore them so we don't re-allocate the backing store. We will paint
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 } 818 }
817 if (!renderWidgetHostView_->whiteout_start_time_.is_null()) { 819 if (!renderWidgetHostView_->whiteout_start_time_.is_null()) {
818 base::TimeDelta whiteout_duration = base::TimeTicks::Now() - 820 base::TimeDelta whiteout_duration = base::TimeTicks::Now() -
819 renderWidgetHostView_->whiteout_start_time_; 821 renderWidgetHostView_->whiteout_start_time_;
820 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration); 822 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration);
821 823
822 // Reset the start time to 0 so that we start recording again the next 824 // Reset the start time to 0 so that we start recording again the next
823 // time the backing store is NULL... 825 // time the backing store is NULL...
824 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks(); 826 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks();
825 } 827 }
828 if (!renderWidgetHostView_->tab_switch_paint_time_.is_null()) {
829 base::TimeDelta tab_switch_paint_duration = base::TimeTicks::Now() -
830 renderWidgetHostView_->tab_switch_paint_time_;
831 UMA_HISTOGRAM_TIMES("MPArch.RWH_TabSwitchPaintDuration",
832 tab_switch_paint_duration);
833 // Reset tab_switch_paint_time_ to 0 so future tab selections are
834 // recorded.
835 renderWidgetHostView_->tab_switch_paint_time_ = base::TimeTicks();
836 }
826 } else { 837 } else {
827 [[NSColor whiteColor] set]; 838 [[NSColor whiteColor] set];
828 NSRectFill(dirtyRect); 839 NSRectFill(dirtyRect);
829 if (renderWidgetHostView_->whiteout_start_time_.is_null()) 840 if (renderWidgetHostView_->whiteout_start_time_.is_null())
830 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks::Now(); 841 renderWidgetHostView_->whiteout_start_time_ = base::TimeTicks::Now();
831 } 842 }
832 } 843 }
833 844
834 - (BOOL)canBecomeKeyView { 845 - (BOOL)canBecomeKeyView {
835 if (!renderWidgetHostView_->render_widget_host_) 846 if (!renderWidgetHostView_->render_widget_host_)
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 base::Time::Now().ToDoubleT()); 1350 base::Time::Now().ToDoubleT());
1340 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event); 1351 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event);
1341 } else { 1352 } else {
1342 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition( 1353 renderWidgetHostView_->render_widget_host_->ImeConfirmComposition(
1343 UTF8ToUTF16([im_text UTF8String])); 1354 UTF8ToUTF16([im_text UTF8String]));
1344 } 1355 }
1345 renderWidgetHostView_->im_composing_ = false; 1356 renderWidgetHostView_->im_composing_ = false;
1346 } 1357 }
1347 1358
1348 @end 1359 @end
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_mac.h ('k') | chrome/browser/renderer_host/render_widget_host_view_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698