| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_latency_tracker.h" | 5 #include "content/browser/renderer_host/render_widget_host_latency_tracker.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "content/browser/renderer_host/render_widget_host_impl.h" | 9 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 10 | 10 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 | 252 |
| 253 // LatencyComponents generated in the renderer must have component IDs | 253 // LatencyComponents generated in the renderer must have component IDs |
| 254 // provided to them by the browser process. This function adds the correct | 254 // provided to them by the browser process. This function adds the correct |
| 255 // component ID where necessary. | 255 // component ID where necessary. |
| 256 void AddLatencyInfoComponentIds(LatencyInfo* latency, | 256 void AddLatencyInfoComponentIds(LatencyInfo* latency, |
| 257 int64 latency_component_id) { | 257 int64 latency_component_id) { |
| 258 LatencyInfo::LatencyMap new_components; | 258 LatencyInfo::LatencyMap new_components; |
| 259 auto lc = latency->latency_components.begin(); | 259 auto lc = latency->latency_components.begin(); |
| 260 while (lc != latency->latency_components.end()) { | 260 while (lc != latency->latency_components.end()) { |
| 261 ui::LatencyComponentType component_type = lc->first.first; | 261 ui::LatencyComponentType component_type = lc->first.first; |
| 262 if (component_type == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT || | 262 if (component_type == ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT) { |
| 263 component_type == ui::WINDOW_OLD_SNAPSHOT_FRAME_NUMBER_COMPONENT) { | |
| 264 // Generate a new component entry with the correct component ID | 263 // Generate a new component entry with the correct component ID |
| 265 auto key = std::make_pair(component_type, latency_component_id); | 264 auto key = std::make_pair(component_type, latency_component_id); |
| 266 new_components[key] = lc->second; | 265 new_components[key] = lc->second; |
| 267 | 266 |
| 268 // Remove the old entry | 267 // Remove the old entry |
| 269 latency->latency_components.erase(lc++); | 268 latency->latency_components.erase(lc++); |
| 270 } else { | 269 } else { |
| 271 ++lc; | 270 ++lc; |
| 272 } | 271 } |
| 273 } | 272 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 // cause regressions. | 431 // cause regressions. |
| 433 return std::max( | 432 return std::max( |
| 434 browser_composite_latency_history_.Percentile( | 433 browser_composite_latency_history_.Percentile( |
| 435 kBrowserCompositeLatencyEstimationPercentile) * | 434 kBrowserCompositeLatencyEstimationPercentile) * |
| 436 kBrowserCompositeLatencyEstimationSlack, | 435 kBrowserCompositeLatencyEstimationSlack, |
| 437 base::TimeDelta::FromMicroseconds( | 436 base::TimeDelta::FromMicroseconds( |
| 438 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60))); | 437 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60))); |
| 439 } | 438 } |
| 440 | 439 |
| 441 } // namespace content | 440 } // namespace content |
| OLD | NEW |