| OLD | NEW |
| 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 "content/browser/renderer_host/render_widget_host_view_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <InputScope.h> | 8 #include <InputScope.h> |
| 9 #include <wtsapi32.h> | 9 #include <wtsapi32.h> |
| 10 #pragma comment(lib, "wtsapi32.lib") | 10 #pragma comment(lib, "wtsapi32.lib") |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 // Send the invalid rect in screen coordinates. | 742 // Send the invalid rect in screen coordinates. |
| 743 gfx::Rect invalid_screen_rect(damage_bounds); | 743 gfx::Rect invalid_screen_rect(damage_bounds); |
| 744 invalid_screen_rect.Offset(GetPixelBounds().OffsetFromOrigin()); | 744 invalid_screen_rect.Offset(GetPixelBounds().OffsetFromOrigin()); |
| 745 | 745 |
| 746 PaintPluginWindowsHelper(m_hWnd, invalid_screen_rect); | 746 PaintPluginWindowsHelper(m_hWnd, invalid_screen_rect); |
| 747 } | 747 } |
| 748 | 748 |
| 749 void RenderWidgetHostViewWin::DidUpdateBackingStore( | 749 void RenderWidgetHostViewWin::DidUpdateBackingStore( |
| 750 const gfx::Rect& scroll_rect, | 750 const gfx::Rect& scroll_rect, |
| 751 const gfx::Vector2d& scroll_delta, | 751 const gfx::Vector2d& scroll_delta, |
| 752 const std::vector<gfx::Rect>& copy_rects) { | 752 const std::vector<gfx::Rect>& copy_rects, |
| 753 const ui::LatencyInfo& latency_info) { |
| 754 software_latency_info_.MergeWith(latency_info); |
| 753 if (is_hidden_) | 755 if (is_hidden_) |
| 754 return; | 756 return; |
| 755 | 757 |
| 756 // Schedule invalidations first so that the ScrollWindowEx call is closer to | 758 // Schedule invalidations first so that the ScrollWindowEx call is closer to |
| 757 // Redraw. That minimizes chances of "flicker" resulting if the screen | 759 // Redraw. That minimizes chances of "flicker" resulting if the screen |
| 758 // refreshes before we have a chance to paint the exposed area. Somewhat | 760 // refreshes before we have a chance to paint the exposed area. Somewhat |
| 759 // surprisingly, this ordering matters. | 761 // surprisingly, this ordering matters. |
| 760 | 762 |
| 761 for (size_t i = 0; i < copy_rects.size(); ++i) { | 763 for (size_t i = 0; i < copy_rects.size(); ++i) { |
| 762 gfx::Rect pixel_rect = ui::win::DIPToScreenRect(copy_rects[i]); | 764 gfx::Rect pixel_rect = ui::win::DIPToScreenRect(copy_rects[i]); |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 } | 1389 } |
| 1388 if (!web_contents_switch_paint_time_.is_null()) { | 1390 if (!web_contents_switch_paint_time_.is_null()) { |
| 1389 TimeDelta web_contents_switch_paint_duration = TimeTicks::Now() - | 1391 TimeDelta web_contents_switch_paint_duration = TimeTicks::Now() - |
| 1390 web_contents_switch_paint_time_; | 1392 web_contents_switch_paint_time_; |
| 1391 UMA_HISTOGRAM_TIMES("MPArch.RWH_TabSwitchPaintDuration", | 1393 UMA_HISTOGRAM_TIMES("MPArch.RWH_TabSwitchPaintDuration", |
| 1392 web_contents_switch_paint_duration); | 1394 web_contents_switch_paint_duration); |
| 1393 // Reset contents_switch_paint_time_ to 0 so future tab selections are | 1395 // Reset contents_switch_paint_time_ to 0 so future tab selections are |
| 1394 // recorded. | 1396 // recorded. |
| 1395 web_contents_switch_paint_time_ = TimeTicks(); | 1397 web_contents_switch_paint_time_ = TimeTicks(); |
| 1396 } | 1398 } |
| 1399 |
| 1400 software_latency_info_.swap_timestamp = TimeTicks::HighResNow(); |
| 1401 render_widget_host_->FrameSwapped(software_latency_info_); |
| 1402 software_latency_info_.Clear(); |
| 1397 } else { | 1403 } else { |
| 1398 DrawBackground(paint_dc.m_ps.rcPaint, &paint_dc); | 1404 DrawBackground(paint_dc.m_ps.rcPaint, &paint_dc); |
| 1399 if (whiteout_start_time_.is_null()) | 1405 if (whiteout_start_time_.is_null()) |
| 1400 whiteout_start_time_ = TimeTicks::Now(); | 1406 whiteout_start_time_ = TimeTicks::Now(); |
| 1401 } | 1407 } |
| 1402 } | 1408 } |
| 1403 | 1409 |
| 1404 void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, | 1410 void RenderWidgetHostViewWin::DrawBackground(const RECT& dirty_rect, |
| 1405 CPaintDC* dc) { | 1411 CPaintDC* dc) { |
| 1406 if (!background_.empty()) { | 1412 if (!background_.empty()) { |
| (...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3141 return new RenderWidgetHostViewWin(widget); | 3147 return new RenderWidgetHostViewWin(widget); |
| 3142 } | 3148 } |
| 3143 | 3149 |
| 3144 // static | 3150 // static |
| 3145 void RenderWidgetHostViewPort::GetDefaultScreenInfo( | 3151 void RenderWidgetHostViewPort::GetDefaultScreenInfo( |
| 3146 WebKit::WebScreenInfo* results) { | 3152 WebKit::WebScreenInfo* results) { |
| 3147 GetScreenInfoForWindow(results, 0); | 3153 GetScreenInfoForWindow(results, 0); |
| 3148 } | 3154 } |
| 3149 | 3155 |
| 3150 } // namespace content | 3156 } // namespace content |
| OLD | NEW |