| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_win.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/gfx/gdi_util.h" | 8 #include "app/gfx/gdi_util.h" |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/l10n_util_win.h" | 10 #include "app/l10n_util_win.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 248 } |
| 249 | 249 |
| 250 RenderWidgetHost* RenderWidgetHostViewWin::GetRenderWidgetHost() const { | 250 RenderWidgetHost* RenderWidgetHostViewWin::GetRenderWidgetHost() const { |
| 251 return render_widget_host_; | 251 return render_widget_host_; |
| 252 } | 252 } |
| 253 | 253 |
| 254 void RenderWidgetHostViewWin::DidBecomeSelected() { | 254 void RenderWidgetHostViewWin::DidBecomeSelected() { |
| 255 if (!is_hidden_) | 255 if (!is_hidden_) |
| 256 return; | 256 return; |
| 257 | 257 |
| 258 if (tab_switch_paint_time_.is_null()) |
| 259 tab_switch_paint_time_ = TimeTicks::Now(); |
| 258 is_hidden_ = false; | 260 is_hidden_ = false; |
| 259 EnsureTooltip(); | 261 EnsureTooltip(); |
| 260 render_widget_host_->WasRestored(); | 262 render_widget_host_->WasRestored(); |
| 261 } | 263 } |
| 262 | 264 |
| 263 void RenderWidgetHostViewWin::WasHidden() { | 265 void RenderWidgetHostViewWin::WasHidden() { |
| 264 if (is_hidden_) | 266 if (is_hidden_) |
| 265 return; | 267 return; |
| 266 | 268 |
| 267 // If we receive any more paint messages while we are hidden, we want to | 269 // If we receive any more paint messages while we are hidden, we want to |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 DrawBackground(r, &paint_dc); | 788 DrawBackground(r, &paint_dc); |
| 787 } | 789 } |
| 788 if (!whiteout_start_time_.is_null()) { | 790 if (!whiteout_start_time_.is_null()) { |
| 789 TimeDelta whiteout_duration = TimeTicks::Now() - whiteout_start_time_; | 791 TimeDelta whiteout_duration = TimeTicks::Now() - whiteout_start_time_; |
| 790 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration); | 792 UMA_HISTOGRAM_TIMES("MPArch.RWHH_WhiteoutDuration", whiteout_duration); |
| 791 | 793 |
| 792 // Reset the start time to 0 so that we start recording again the next | 794 // Reset the start time to 0 so that we start recording again the next |
| 793 // time the backing store is NULL... | 795 // time the backing store is NULL... |
| 794 whiteout_start_time_ = TimeTicks(); | 796 whiteout_start_time_ = TimeTicks(); |
| 795 } | 797 } |
| 798 if (!tab_switch_paint_time_.is_null()) { |
| 799 TimeDelta tab_switch_paint_duration = TimeTicks::Now() - |
| 800 tab_switch_paint_time_; |
| 801 UMA_HISTOGRAM_TIMES("MPArch.RWH_TabSwitchPaintDuration", |
| 802 tab_switch_paint_duration); |
| 803 // Reset tab_switch_paint_time_ to 0 so future tab selections are |
| 804 // recorded. |
| 805 tab_switch_paint_time_ = TimeTicks(); |
| 806 } |
| 796 } else { | 807 } else { |
| 797 DrawBackground(paint_dc.m_ps.rcPaint, &paint_dc); | 808 DrawBackground(paint_dc.m_ps.rcPaint, &paint_dc); |
| 798 if (whiteout_start_time_.is_null()) | 809 if (whiteout_start_time_.is_null()) |
| 799 whiteout_start_time_ = TimeTicks::Now(); | 810 whiteout_start_time_ = TimeTicks::Now(); |
| 800 } | 811 } |
| 801 } | 812 } |
| 802 | 813 |
| 803 void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, | 814 void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, |
| 804 CPaintDC* dc) { | 815 CPaintDC* dc) { |
| 805 if (!background_.empty()) { | 816 if (!background_.empty()) { |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 SetFocus(); | 1413 SetFocus(); |
| 1403 } | 1414 } |
| 1404 } | 1415 } |
| 1405 | 1416 |
| 1406 void RenderWidgetHostViewWin::ShutdownHost() { | 1417 void RenderWidgetHostViewWin::ShutdownHost() { |
| 1407 shutdown_factory_.RevokeAll(); | 1418 shutdown_factory_.RevokeAll(); |
| 1408 if (render_widget_host_) | 1419 if (render_widget_host_) |
| 1409 render_widget_host_->Shutdown(); | 1420 render_widget_host_->Shutdown(); |
| 1410 // Do not touch any members at this point, |this| has been deleted. | 1421 // Do not touch any members at this point, |this| has been deleted. |
| 1411 } | 1422 } |
| OLD | NEW |