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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2914023002: Remove LatencyInfo::sequence_number. (May break metrics).
Patch Set: Rebase Created 3 years, 5 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
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 "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 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 } 1496 }
1497 1497
1498 void RenderWidgetHostImpl::GetSnapshotFromBrowser( 1498 void RenderWidgetHostImpl::GetSnapshotFromBrowser(
1499 const GetSnapshotFromBrowserCallback& callback, 1499 const GetSnapshotFromBrowserCallback& callback,
1500 bool from_surface) { 1500 bool from_surface) {
1501 int id = next_browser_snapshot_id_++; 1501 int id = next_browser_snapshot_id_++;
1502 if (from_surface) { 1502 if (from_surface) {
1503 pending_surface_browser_snapshots_.insert(std::make_pair(id, callback)); 1503 pending_surface_browser_snapshots_.insert(std::make_pair(id, callback));
1504 ui::LatencyInfo latency_info; 1504 ui::LatencyInfo latency_info;
1505 latency_info.AddLatencyNumber(ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT, 1505 latency_info.AddLatencyNumber(ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT,
1506 0, id); 1506 id);
1507 Send(new ViewMsg_ForceRedraw(GetRoutingID(), latency_info)); 1507 Send(new ViewMsg_ForceRedraw(GetRoutingID(), latency_info));
1508 return; 1508 return;
1509 } 1509 }
1510 1510
1511 #if defined(OS_MACOSX) 1511 #if defined(OS_MACOSX)
1512 // MacOS version of underlying GrabViewSnapshot() blocks while 1512 // MacOS version of underlying GrabViewSnapshot() blocks while
1513 // display/GPU are in a power-saving mode, so make sure display 1513 // display/GPU are in a power-saving mode, so make sure display
1514 // does not go to sleep for the duration of reading a snapshot. 1514 // does not go to sleep for the duration of reading a snapshot.
1515 if (pending_browser_snapshots_.empty()) 1515 if (pending_browser_snapshots_.empty())
1516 GetWakeLock()->RequestWakeLock(); 1516 GetWakeLock()->RequestWakeLock();
1517 #endif 1517 #endif
1518 pending_browser_snapshots_.insert(std::make_pair(id, callback)); 1518 pending_browser_snapshots_.insert(std::make_pair(id, callback));
1519 ui::LatencyInfo latency_info; 1519 ui::LatencyInfo latency_info;
1520 latency_info.AddLatencyNumber(ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT, 0, 1520 latency_info.AddLatencyNumber(ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT,
1521 id); 1521 id);
1522 Send(new ViewMsg_ForceRedraw(GetRoutingID(), latency_info)); 1522 Send(new ViewMsg_ForceRedraw(GetRoutingID(), latency_info));
1523 } 1523 }
1524 1524
1525 const NativeWebKeyboardEvent* 1525 const NativeWebKeyboardEvent*
1526 RenderWidgetHostImpl::GetLastKeyboardEvent() const { 1526 RenderWidgetHostImpl::GetLastKeyboardEvent() const {
1527 return input_router_->GetLastKeyboardEvent(); 1527 return input_router_->GetLastKeyboardEvent();
1528 } 1528 }
1529 1529
1530 void RenderWidgetHostImpl::SelectionChanged(const base::string16& text, 1530 void RenderWidgetHostImpl::SelectionChanged(const base::string16& text,
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 NotifyNewContentRenderingTimeoutForTesting(); 1825 NotifyNewContentRenderingTimeoutForTesting();
1826 if (view_) 1826 if (view_)
1827 view_->ClearCompositorFrame(); 1827 view_->ClearCompositorFrame();
1828 } 1828 }
1829 1829
1830 void RenderWidgetHostImpl::OnGpuSwapBuffersCompletedInternal( 1830 void RenderWidgetHostImpl::OnGpuSwapBuffersCompletedInternal(
1831 const ui::LatencyInfo& latency_info) { 1831 const ui::LatencyInfo& latency_info) {
1832 ui::LatencyInfo::LatencyComponent window_snapshot_component; 1832 ui::LatencyInfo::LatencyComponent window_snapshot_component;
1833 if (latency_info.FindLatency(ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT, 1833 if (latency_info.FindLatency(ui::BROWSER_SNAPSHOT_FRAME_NUMBER_COMPONENT,
1834 GetLatencyComponentId(), 1834 GetLatencyComponentId(),
1835 &window_snapshot_component)) { 1835 &window_snapshot_component)) {
ccameron 2017/06/29 20:52:18 Looks reasonable (first not-just-delete change).
1836 int sequence_number = 1836 static int snapshot_id = 0;
1837 static_cast<int>(window_snapshot_component.sequence_number); 1837 ++snapshot_id;
1838 #if defined(OS_MACOSX) || defined(OS_WIN) 1838 #if defined(OS_MACOSX) || defined(OS_WIN)
1839 // On Mac, when using CoreAnimation, or Win32 when using GDI, there is a 1839 // On Mac, when using CoreAnimation, or Win32 when using GDI, there is a
1840 // delay between when content is drawn to the screen, and when the 1840 // delay between when content is drawn to the screen, and when the
1841 // snapshot will actually pick up that content. Insert a manual delay of 1841 // snapshot will actually pick up that content. Insert a manual delay of
1842 // 1/6th of a second (to simulate 10 frames at 60 fps) before actually 1842 // 1/6th of a second (to simulate 10 frames at 60 fps) before actually
1843 // taking the snapshot. 1843 // taking the snapshot.
1844 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1844 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1845 FROM_HERE, 1845 FROM_HERE,
1846 base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen, 1846 base::Bind(&RenderWidgetHostImpl::WindowSnapshotReachedScreen,
1847 weak_factory_.GetWeakPtr(), sequence_number), 1847 weak_factory_.GetWeakPtr(), snapshot_id),
1848 base::TimeDelta::FromSecondsD(1. / 6)); 1848 base::TimeDelta::FromSecondsD(1. / 6));
1849 #else 1849 #else
1850 WindowSnapshotReachedScreen(sequence_number); 1850 WindowSnapshotReachedScreen(snapshot_id);
1851 #endif 1851 #endif
1852 } 1852 }
1853 1853
1854 latency_tracker_.OnGpuSwapBuffersCompleted(latency_info); 1854 latency_tracker_.OnGpuSwapBuffersCompleted(latency_info);
1855 } 1855 }
1856 1856
1857 void RenderWidgetHostImpl::OnRenderProcessGone(int status, int exit_code) { 1857 void RenderWidgetHostImpl::OnRenderProcessGone(int status, int exit_code) {
1858 // RenderFrameHost owns a RenderWidgetHost when it needs one, in which case 1858 // RenderFrameHost owns a RenderWidgetHost when it needs one, in which case
1859 // it handles destruction. 1859 // it handles destruction.
1860 if (!owned_by_render_frame_host_) { 1860 if (!owned_by_render_frame_host_) {
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
2696 device::mojom::WakeLockType::PreventDisplaySleep, 2696 device::mojom::WakeLockType::PreventDisplaySleep,
2697 device::mojom::WakeLockReason::ReasonOther, "GetSnapshot", 2697 device::mojom::WakeLockReason::ReasonOther, "GetSnapshot",
2698 std::move(request)); 2698 std::move(request));
2699 } 2699 }
2700 } 2700 }
2701 return wake_lock_.get(); 2701 return wake_lock_.get();
2702 } 2702 }
2703 #endif 2703 #endif
2704 2704
2705 } // namespace content 2705 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698