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

Unified Diff: ppapi/proxy/plugin_globals.cc

Issue 252663002: Track plugin input event latency (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add more comments Created 6 years, 8 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: ppapi/proxy/plugin_globals.cc
diff --git a/ppapi/proxy/plugin_globals.cc b/ppapi/proxy/plugin_globals.cc
index d361ae1191950b56cf9844ab0aa0983536199bf8..f2c38674c9b84bb293c858e81235bbd070b4c8bc 100644
--- a/ppapi/proxy/plugin_globals.cc
+++ b/ppapi/proxy/plugin_globals.cc
@@ -234,5 +234,36 @@ void PluginGlobals::OnReleaseKeepaliveThrottle() {
plugin_recently_active_ = false;
}
+void PluginGlobals::AddLatencyInfo(ui::LatencyInfo latency_info,
+ PP_Instance instance) {
+ static int64 seq_num = 0;
+ latency_info.AddLatencyNumber(
+ ui::INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT, 0, seq_num++);
+ pending_latency_info_[instance].push_back(latency_info);
+}
+
+void PluginGlobals::OnGraphicsInvalidation(PP_Instance instance) {
+ if (pending_latency_info_.find(instance) != pending_latency_info_.end()) {
+ const std::vector<ui::LatencyInfo>& latency
+ = pending_latency_info_[instance];
+ for (size_t i = 0; i < latency.size(); i++)
+ latency_info_for_frame_[instance].push_back(latency[i]);
+ pending_latency_info_.erase(instance);
+ }
+}
+
+void PluginGlobals::OnGraphicsFlush(std::vector<ui::LatencyInfo>* latency_info,
+ PP_Instance instance) {
+ latency_info->swap(latency_info_for_frame_[instance]);
+ if (pending_latency_info_.find(instance) != pending_latency_info_.end()) {
+ std::vector<ui::LatencyInfo>& latency = pending_latency_info_[instance];
+ for (size_t i = 0; i < latency.size(); i++) {
+ latency[i].AddLatencyNumber(
+ ui::INPUT_EVENT_LATENCY_TERMINATED_PLUGIN_COMPONENT, 0, 0);
+ }
+ pending_latency_info_.erase(instance);
+ }
+}
+
} // namespace proxy
} // namespace ppapi

Powered by Google App Engine
This is Rietveld 408576698