bug 552020 Part 3: Enable Creation of mozilla::TimeStamp from system timestamps. r=roc

This commit is contained in:
Mason Chang 2014-11-18 13:28:42 -08:00
parent 0818de546a
commit de0e409177
3 changed files with 15 additions and 6 deletions

View File

@ -231,7 +231,7 @@ HwcComposer2D::RunVsyncEventControl(bool aEnable)
void
HwcComposer2D::Vsync(int aDisplay, nsecs_t aVsyncTimestamp)
{
TimeStamp vsyncTime = mozilla::TimeStamp(aVsyncTimestamp);
TimeStamp vsyncTime = mozilla::TimeStamp::FromSystemTime(aVsyncTimestamp);
nsecs_t vsyncInterval = aVsyncTimestamp - mLastVsyncTime;
if (vsyncInterval < 16000000 || vsyncInterval > 17000000) {
LOGE("Non-uniform vsync interval: %lld\n", vsyncInterval);

View File

@ -715,7 +715,7 @@ GeckoInputDispatcher::notifyMotion(const NotifyMotionArgs* args)
int32_t action = args->action & AMOTION_EVENT_ACTION_MASK;
int touchCount = args->pointerCount;
MOZ_ASSERT(touchCount <= MAX_POINTERS);
TimeStamp timestamp = TimeStamp(args->eventTime);
TimeStamp timestamp = mozilla::TimeStamp::FromSystemTime(args->eventTime);
Modifiers modifiers = getDOMModifiers(args->metaState);
MultiTouchInput::MultiTouchType touchType = MultiTouchInput::MULTITOUCH_CANCEL;

View File

@ -387,11 +387,20 @@ public:
MOZ_CONSTEXPR TimeStamp() : mValue(0) {}
// Default copy-constructor and assignment are OK
#ifdef MOZ_WIDGET_GONK
TimeStamp(int64_t aAndroidTime) : mValue(aAndroidTime)
/**
* The system timestamps are the same as the TimeStamp
* retrieved by mozilla::TimeStamp. Since we need this for
* vsync timestamps, we enable the creation of mozilla::TimeStamps
* on platforms that support vsync aligned refresh drivers / compositors
* Verified true as of Nov 7, 2014: B2G and OS X
* UNTESTED ON OTHER PLATFORMS
*/
#if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_COCOA)
static TimeStamp FromSystemTime(int64_t aSystemTime)
{
static_assert(sizeof(aAndroidTime) == sizeof(TimeStampValue),
"Android timestamp should be same units as TimeStampValue");
static_assert(sizeof(aSystemTime) == sizeof(TimeStampValue),
"System timestamp should be same units as TimeStampValue");
return TimeStamp(aSystemTime);
}
#endif