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

Unified Diff: content/renderer/pepper/pepper_plugin_instance_impl.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: content/renderer/pepper/pepper_plugin_instance_impl.cc
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index d79c9f96630f73cfa6955beb71b592498802292d..711a7e9424ece1abe979e536b2f1e6fd28099a0e 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -16,7 +16,9 @@
#include "base/strings/utf_offset_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
+#include "cc/base/latency_info_swap_promise.h"
#include "cc/layers/texture_layer.h"
+#include "cc/trees/layer_tree_host.h"
#include "content/common/content_constants_internal.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/page_zoom.h"
@@ -1094,8 +1096,22 @@ bool PepperPluginInstanceImpl::HandleInputEvent(
pending_user_gesture_token_.setOutOfProcess();
}
+ const ui::LatencyInfo* current_event_latency_info = NULL;
+ if (render_frame_->GetRenderWidget()) {
+ current_event_latency_info =
+ render_frame_->GetRenderWidget()->current_event_latency_info();
piman 2014/04/25 01:59:43 In the future (e.g. after the blink merge), I'm ho
Yufeng Shen (Slow to review) 2014/04/25 20:42:42 Right. I always want to couple WebInputEvent with
+ }
+
// Each input event may generate more than one PP_InputEvent.
for (size_t i = 0; i < events.size(); i++) {
+ if (current_event_latency_info) {
+ events[i].latency_info.CopyLatencyFrom(
+ *current_event_latency_info,
+ ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT);
+ events[i].latency_info.CopyLatencyFrom(
+ *current_event_latency_info,
+ ui::INPUT_EVENT_LATENCY_UI_COMPONENT);
+ }
if (filtered_input_event_mask_ & event_class)
events[i].is_filtered = true;
else
@@ -1983,6 +1999,20 @@ bool PepperPluginInstanceImpl::PrepareTextureMailbox(
void PepperPluginInstanceImpl::OnDestruct() { render_frame_ = NULL; }
+void PepperPluginInstanceImpl::AddLatencyInfo(
+ const std::vector<ui::LatencyInfo>& latency_info) {
+ if (texture_layer_) {
+ cc::LayerTreeHost* layer_tree_host = texture_layer_->layer_tree_host();
piman 2014/04/25 01:59:43 I'd rather we went to the compositor via the Rende
Yufeng Shen (Slow to review) 2014/04/25 20:42:42 done. It now goes through render_frame_->GetRender
+ if (layer_tree_host) {
+ for (size_t i = 0; i < latency_info.size(); i++) {
+ scoped_ptr<cc::SwapPromise> swap_promise(
+ new cc::LatencyInfoSwapPromise(latency_info[i]));
+ layer_tree_host->QueueSwapPromise(swap_promise.Pass());
+ }
+ }
+ }
+}
+
void PepperPluginInstanceImpl::AddPluginObject(PluginObject* plugin_object) {
DCHECK(live_plugin_objects_.find(plugin_object) ==
live_plugin_objects_.end());

Powered by Google App Engine
This is Rietveld 408576698