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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 123563002: Remove gpu side LatencyInfo merging (Closed) Base URL: http://git.chromium.org/chromium/src.git@gpu-per-event-latency-6-small
Patch Set: adding check at more places for GpuHostMsg_AcceleratedSurfaceBuffersSwapped/PostBuffer Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index a5894b284dd1ba0e14fcb0998797598ec3eb1b0b..709e2b67fe9da86d058d91110a560712bfa9f714 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -95,6 +95,10 @@ bool g_check_for_pending_resize_ack = true;
// This timeout impacts the "choppiness" of our window resize perf.
const int kPaintMsgTimeoutMS = 50;
+// Maximal number of LatencyInfo that can be contained in
+// ViewHostMsg_CompositorSurfaceBuffersSwapped_Params.
+const unsigned int kMaxLatencyInfoNumber = 100;
+
typedef std::pair<int32, int32> RenderWidgetHostID;
typedef base::hash_map<RenderWidgetHostID, RenderWidgetHostImpl*>
RoutingIDWidgetMap;
@@ -1469,6 +1473,11 @@ void RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped(
const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) {
TRACE_EVENT0("renderer_host",
"RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwapped");
+ if (params.latency_info.size() > kMaxLatencyInfoNumber) {
+ LOG(ERROR) << "ViewHostMsg_CompositorSurfaceBuffersSwapped LatencyInfo"
+ << " size " << params.latency_info.size() << " is too big.";
+ return;
+ }
if (!view_) {
AcceleratedSurfaceMsg_BufferPresented_Params ack_params;
ack_params.sync_point = 0;
@@ -2450,26 +2459,27 @@ void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) {
// static
void RenderWidgetHostImpl::CompositorFrameDrawn(
- const ui::LatencyInfo& latency_info) {
- std::set<RenderWidgetHostImpl*> rwhi_set;
-
- for (ui::LatencyInfo::LatencyMap::const_iterator b =
- latency_info.latency_components.begin();
- b != latency_info.latency_components.end();
- ++b) {
- if (b->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT ||
- b->first.first == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT) {
- // Matches with GetLatencyComponentId
- int routing_id = b->first.second & 0xffffffff;
- int process_id = (b->first.second >> 32) & 0xffffffff;
- RenderWidgetHost* rwh =
- RenderWidgetHost::FromID(process_id, routing_id);
- if (!rwh) {
- continue;
+ const std::vector<ui::LatencyInfo>& latency_info) {
+ for (size_t i = 0; i < latency_info.size(); i++) {
+ std::set<RenderWidgetHostImpl*> rwhi_set;
+ for (ui::LatencyInfo::LatencyMap::const_iterator b =
+ latency_info[i].latency_components.begin();
+ b != latency_info[i].latency_components.end();
+ ++b) {
+ if (b->first.first == ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT ||
+ b->first.first == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT) {
+ // Matches with GetLatencyComponentId
+ int routing_id = b->first.second & 0xffffffff;
+ int process_id = (b->first.second >> 32) & 0xffffffff;
+ RenderWidgetHost* rwh =
+ RenderWidgetHost::FromID(process_id, routing_id);
+ if (!rwh) {
+ continue;
+ }
+ RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh);
+ if (rwhi_set.insert(rwhi).second)
+ rwhi->FrameSwapped(latency_info[i]);
}
- RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rwh);
- if (rwhi_set.insert(rwhi).second)
- rwhi->FrameSwapped(latency_info);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698