| 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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 1750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 } | 1761 } |
| 1762 | 1762 |
| 1763 void RenderWidgetHostImpl::OnGpuSwapBuffersCompletedInternal( | 1763 void RenderWidgetHostImpl::OnGpuSwapBuffersCompletedInternal( |
| 1764 const ui::LatencyInfo& latency_info) { | 1764 const ui::LatencyInfo& latency_info) { |
| 1765 ui::LatencyInfo::LatencyComponent window_snapshot_component; | 1765 ui::LatencyInfo::LatencyComponent window_snapshot_component; |
| 1766 if (latency_info.FindLatency(ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT, | 1766 if (latency_info.FindLatency(ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT, |
| 1767 GetLatencyComponentId(), | 1767 GetLatencyComponentId(), |
| 1768 &window_snapshot_component)) { | 1768 &window_snapshot_component)) { |
| 1769 int sequence_number = | 1769 int sequence_number = |
| 1770 static_cast<int>(window_snapshot_component.sequence_number); | 1770 static_cast<int>(window_snapshot_component.sequence_number); |
| 1771 #if defined(OS_MACOSX) | 1771 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 1772 // On Mac, when using CoreAnimation, there is a delay between when content | 1772 // On Mac, when using CoreAnimation, or Win32 when using GDI, there is a |
| 1773 // is drawn to the screen, and when the snapshot will actually pick up | 1773 // delay between when content is drawn to the screen, and when the |
| 1774 // that content. Insert a manual delay of 1/6th of a second (to simulate | 1774 // snapshot will actually pick up that content. Insert a manual delay of |
| 1775 // 10 frames at 60 fps) before actually taking the snapshot. | 1775 // 1/6th of a second (to simulate 10 frames at 60 fps) before actually |
| 1776 // taking the snapshot. |
| 1776 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1777 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 1777 FROM_HERE, | 1778 FROM_HERE, |
| 1778 base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen, | 1779 base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen, |
| 1779 weak_factory_.GetWeakPtr(), sequence_number), | 1780 weak_factory_.GetWeakPtr(), sequence_number), |
| 1780 base::TimeDelta::FromSecondsD(1. / 6)); | 1781 base::TimeDelta::FromSecondsD(1. / 6)); |
| 1781 #else | 1782 #else |
| 1782 WindowSnapshotReachedScreen(sequence_number); | 1783 WindowSnapshotReachedScreen(sequence_number); |
| 1783 #endif | 1784 #endif |
| 1784 } | 1785 } |
| 1785 | 1786 |
| (...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2656 | 2657 |
| 2657 // After navigation, if a frame belonging to the new page is received, stop | 2658 // After navigation, if a frame belonging to the new page is received, stop |
| 2658 // the timer that triggers clearing the graphics of the last page. | 2659 // the timer that triggers clearing the graphics of the last page. |
| 2659 if (last_received_content_source_id_ >= current_content_source_id_ && | 2660 if (last_received_content_source_id_ >= current_content_source_id_ && |
| 2660 new_content_rendering_timeout_->IsRunning()) { | 2661 new_content_rendering_timeout_->IsRunning()) { |
| 2661 new_content_rendering_timeout_->Stop(); | 2662 new_content_rendering_timeout_->Stop(); |
| 2662 } | 2663 } |
| 2663 } | 2664 } |
| 2664 | 2665 |
| 2665 } // namespace content | 2666 } // namespace content |
| OLD | NEW |