summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk
diff options
context:
space:
mode:
authormiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-27 16:56:43 +0000
committermiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-27 16:56:43 +0000
commit8062ab2643873f883e9655d506e1f91880b923ff (patch)
tree3b1031b6e7e592c11a0d9756ec5bd337c40c41cd /ppapi/thunk
parent66bf7e2b99672c530495517abb88f5256af9d338 (diff)
downloadchromium_src-8062ab2643873f883e9655d506e1f91880b923ff.zip
chromium_src-8062ab2643873f883e9655d506e1f91880b923ff.tar.gz
chromium_src-8062ab2643873f883e9655d506e1f91880b923ff.tar.bz2
Track plugin input event latency
This CL uses LatencyInfo to track the plugin input event latency. 1.Each plugin input event has an associated LatencyInfo which includes some important components from its according ui::Event/WebInputEvent's LatencyInfo. To do that, during the scope of RenderWidget::OnHandleInputEvent(WebInputEvent, latency_info) we first cache the WebInputEvent's latency_info, then if the input event needs to be routed to plugin, we copy the important components from the cached latency_info into the plugin input event's LatencyInfo. 2.A private API InputEventPrivate::TraceInputLatency(bool has_damage) is exposed. 3.If the event is believed to cause rendering damage, private_event.TraceInputLatency(true) can be called, and the input event's LatencyInfo will be sent to renderer with next plugin frame and be tracked until it reaches screen. If the event is believed to not cause any rendering damage, private_event.TraceInputLatency(false) can be called, and the LatencyInfo tracking ends right at the call. BUG=355719 TEST=with custom test touch drawing plugin, input-to-swapbuffer latency is shown correctly in trace viewer. Review URL: https://codereview.chromium.org/252663002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk')
-rw-r--r--ppapi/thunk/interfaces_ppb_private.h3
-rw-r--r--ppapi/thunk/ppb_input_event_api.h3
-rw-r--r--ppapi/thunk/ppb_input_event_private_thunk.cc42
-rw-r--r--ppapi/thunk/ppb_instance_api.h3
4 files changed, 51 insertions, 0 deletions
diff --git a/ppapi/thunk/interfaces_ppb_private.h b/ppapi/thunk/interfaces_ppb_private.h
index 7e3988e..01f175c 100644
--- a/ppapi/thunk/interfaces_ppb_private.h
+++ b/ppapi/thunk/interfaces_ppb_private.h
@@ -63,4 +63,7 @@ PROXIED_IFACE(PPB_FONT_DEV_INTERFACE_0_6,
PPB_BrowserFont_Trusted_1_0)
#endif // !defined(OS_NACL)
+PROXIED_IFACE(PPB_INPUTEVENT_PRIVATE_INTERFACE_0_1,
+ PPB_InputEvent_Private_0_1)
+
#include "ppapi/thunk/interfaces_postamble.h"
diff --git a/ppapi/thunk/ppb_input_event_api.h b/ppapi/thunk/ppb_input_event_api.h
index 00627353..9210c85 100644
--- a/ppapi/thunk/ppb_input_event_api.h
+++ b/ppapi/thunk/ppb_input_event_api.h
@@ -47,6 +47,9 @@ class PPAPI_THUNK_EXPORT PPB_InputEvent_API {
uint32_t index) = 0;
virtual PP_TouchPoint GetTouchById(PP_TouchListType list,
uint32_t id) = 0;
+
+ // Private API.
+ virtual PP_Bool TraceInputLatency(PP_Bool has_damage) = 0;
};
} // namespace thunk
diff --git a/ppapi/thunk/ppb_input_event_private_thunk.cc b/ppapi/thunk/ppb_input_event_private_thunk.cc
new file mode 100644
index 0000000..4bc7812
--- /dev/null
+++ b/ppapi/thunk/ppb_input_event_private_thunk.cc
@@ -0,0 +1,42 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/private/ppb_input_event_private.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_input_event_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool TraceInputLatency(PP_Resource event, PP_Bool has_damage) {
+ EnterResource<PPB_InputEvent_API> enter(event, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.object()->TraceInputLatency(has_damage);
+}
+
+void StartTrackingLatency(PP_Instance instance) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return;
+ enter.functions()->StartTrackingLatency(instance);
+}
+
+const PPB_InputEvent_Private_0_1 g_ppb_input_event_private_thunk_0_1 = {
+ &TraceInputLatency,
+ &StartTrackingLatency
+};
+
+} // namespace
+
+const PPB_InputEvent_Private_0_1* GetPPB_InputEvent_Private_0_1_Thunk() {
+ return &g_ppb_input_event_private_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index 23bf18c..db73979 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -109,6 +109,9 @@ class PPB_Instance_API {
virtual void ClearInputEventRequest(PP_Instance instance,
uint32_t event_classes) = 0;
+ // InputEventPrivate.
+ virtual void StartTrackingLatency(PP_Instance instance) = 0;
+
// Messaging.
virtual void PostMessage(PP_Instance instance, PP_Var message) = 0;