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

Side by Side 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 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 "ppapi/proxy/plugin_globals.h" 5 #include "ppapi/proxy/plugin_globals.h"
6 6
7 #include "base/task_runner.h" 7 #include "base/task_runner.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "ipc/ipc_message.h" 9 #include "ipc/ipc_message.h"
10 #include "ipc/ipc_sender.h" 10 #include "ipc/ipc_sender.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 bool PluginGlobals::IsPluginGlobals() const { 228 bool PluginGlobals::IsPluginGlobals() const {
229 return true; 229 return true;
230 } 230 }
231 231
232 void PluginGlobals::OnReleaseKeepaliveThrottle() { 232 void PluginGlobals::OnReleaseKeepaliveThrottle() {
233 ppapi::ProxyLock::AssertAcquiredDebugOnly(); 233 ppapi::ProxyLock::AssertAcquiredDebugOnly();
234 plugin_recently_active_ = false; 234 plugin_recently_active_ = false;
235 } 235 }
236 236
237 void PluginGlobals::AddLatencyInfo(ui::LatencyInfo latency_info,
238 PP_Instance instance) {
239 static int64 seq_num = 0;
240 latency_info.AddLatencyNumber(
241 ui::INPUT_EVENT_LATENCY_BEGIN_PLUGIN_COMPONENT, 0, seq_num++);
242 pending_latency_info_[instance].push_back(latency_info);
243 }
244
245 void PluginGlobals::OnGraphicsInvalidation(PP_Instance instance) {
246 if (pending_latency_info_.find(instance) != pending_latency_info_.end()) {
247 const std::vector<ui::LatencyInfo>& latency
248 = pending_latency_info_[instance];
249 for (size_t i = 0; i < latency.size(); i++)
250 latency_info_for_frame_[instance].push_back(latency[i]);
251 pending_latency_info_.erase(instance);
252 }
253 }
254
255 void PluginGlobals::OnGraphicsFlush(std::vector<ui::LatencyInfo>* latency_info,
256 PP_Instance instance) {
257 latency_info->swap(latency_info_for_frame_[instance]);
258 if (pending_latency_info_.find(instance) != pending_latency_info_.end()) {
259 std::vector<ui::LatencyInfo>& latency = pending_latency_info_[instance];
260 for (size_t i = 0; i < latency.size(); i++) {
261 latency[i].AddLatencyNumber(
262 ui::INPUT_EVENT_LATENCY_TERMINATED_PLUGIN_COMPONENT, 0, 0);
263 }
264 pending_latency_info_.erase(instance);
265 }
266 }
267
237 } // namespace proxy 268 } // namespace proxy
238 } // namespace ppapi 269 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698