summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl
diff options
context:
space:
mode:
authormajidvp <majidvp@chromium.org>2015-10-07 09:25:17 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-07 16:26:02 +0000
commitfc4610f55cee65ac28c702e11619ae1d121f3b50 (patch)
tree58af2d9043c04d8b573f4a4f21e3247b8b550277 /ppapi/shared_impl
parentd48315ddba058fc6db44e49e8c4d169897f6bdf8 (diff)
downloadchromium_src-fc4610f55cee65ac28c702e11619ae1d121f3b50.zip
chromium_src-fc4610f55cee65ac28c702e11619ae1d121f3b50.tar.gz
chromium_src-fc4610f55cee65ac28c702e11619ae1d121f3b50.tar.bz2
Preserve monotonic timestamp when converting from Core -> Web Input Event.
This fixes a idiosyncrasy in blink input pipeline where when transforming Core -> Web Input Events, WebInputEvent::timeStampSeconds field would get and epoch timestamp value instead of a monotonic timestamp. This occurs for any input event that gets passed to plugins including Pepper plugins. The patch does the following: - Use platform timestamp to populate WebInputEvent::timeStampSeconds - Teach Pepper to expect monotonic time in theat field and remove all unnecessary machinery in Pepper to convert event time. BUG=538199 Review URL: https://codereview.chromium.org/1369333009 Cr-Commit-Position: refs/heads/master@{#352856}
Diffstat (limited to 'ppapi/shared_impl')
-rw-r--r--ppapi/shared_impl/time_conversion.cc27
-rw-r--r--ppapi/shared_impl/time_conversion.h7
-rw-r--r--ppapi/shared_impl/time_conversion_unittest.cc16
3 files changed, 0 insertions, 50 deletions
diff --git a/ppapi/shared_impl/time_conversion.cc b/ppapi/shared_impl/time_conversion.cc
index 8da1483..651274a 100644
--- a/ppapi/shared_impl/time_conversion.cc
+++ b/ppapi/shared_impl/time_conversion.cc
@@ -6,25 +6,6 @@
namespace ppapi {
-namespace {
-
-// Since WebKit doesn't use ticks for event times, we have to compute what
-// the time ticks would be assuming the wall clock time doesn't change.
-//
-// This should only be used for WebKit times which we can't change the
-// definition of.
-double GetTimeToTimeTicksDeltaInSeconds() {
- static double time_to_ticks_delta_seconds = 0.0;
- if (time_to_ticks_delta_seconds == 0.0) {
- double wall_clock = TimeToPPTime(base::Time::Now());
- double ticks = TimeTicksToPPTimeTicks(base::TimeTicks::Now());
- time_to_ticks_delta_seconds = ticks - wall_clock;
- }
- return time_to_ticks_delta_seconds;
-}
-
-} // namespace
-
PP_Time TimeToPPTime(base::Time t) { return t.ToDoubleT(); }
base::Time PPTimeToTime(PP_Time t) {
@@ -42,14 +23,6 @@ PP_TimeTicks TimeTicksToPPTimeTicks(base::TimeTicks t) {
base::Time::kMicrosecondsPerSecond;
}
-PP_TimeTicks EventTimeToPPTimeTicks(double event_time) {
- return event_time + GetTimeToTimeTicksDeltaInSeconds();
-}
-
-double PPTimeTicksToEventTime(PP_TimeTicks t) {
- return t - GetTimeToTimeTicksDeltaInSeconds();
-}
-
double PPGetLocalTimeZoneOffset(const base::Time& time) {
// Explode it to local time and then unexplode it as if it were UTC. Also
// explode it to UTC and unexplode it (this avoids mismatching rounding or
diff --git a/ppapi/shared_impl/time_conversion.h b/ppapi/shared_impl/time_conversion.h
index bbc0865..888f1f2 100644
--- a/ppapi/shared_impl/time_conversion.h
+++ b/ppapi/shared_impl/time_conversion.h
@@ -16,13 +16,6 @@ PPAPI_SHARED_EXPORT base::Time PPTimeToTime(PP_Time t);
PPAPI_SHARED_EXPORT PP_TimeTicks TimeTicksToPPTimeTicks(base::TimeTicks t);
-// Converts between WebKit event times and time ticks. WebKit event times are
-// currently expressed in terms of wall clock time. This function does the
-// proper mapping to time ticks, assuming the wall clock time doesn't change
-// (which isn't necessarily the case).
-PPAPI_SHARED_EXPORT PP_TimeTicks EventTimeToPPTimeTicks(double event_time);
-PPAPI_SHARED_EXPORT double PPTimeTicksToEventTime(PP_TimeTicks t);
-
// Gets the local time zone offset for a given time. This works in the plugin
// process only on Windows (the sandbox prevents this from working properly on
// other platforms).
diff --git a/ppapi/shared_impl/time_conversion_unittest.cc b/ppapi/shared_impl/time_conversion_unittest.cc
index 1ec70bf..4d8c77e 100644
--- a/ppapi/shared_impl/time_conversion_unittest.cc
+++ b/ppapi/shared_impl/time_conversion_unittest.cc
@@ -34,22 +34,6 @@ TEST(TimeConversion, Time) {
EXPECT_GE(kTimeSecondsSlop, fabs(converted_one_second_from_now - 1));
}
-TEST(TimeConversion, EventTime) {
- // Should be able to round-trip.
- base::Time now = base::Time::Now();
- double event_now = now.ToDoubleT();
- double converted =
- ppapi::EventTimeToPPTimeTicks(ppapi::PPTimeTicksToEventTime(event_now));
- EXPECT_GE(kTimeSecondsSlop, fabs(converted - event_now));
-
- // Units should be in seconds.
- base::Time one_second_from_now = now + base::TimeDelta::FromSeconds(1);
- double event_one_second_from_now = one_second_from_now.ToDoubleT();
- EXPECT_GE(kTimeSecondsSlop,
- 1.0 - ppapi::EventTimeToPPTimeTicks(event_one_second_from_now) -
- ppapi::EventTimeToPPTimeTicks(event_now));
-}
-
TEST(TimeConversion, EpochTime) {
// Should be able to round-trip from epoch time.
base::Time epoch = base::Time::UnixEpoch();