Bug 552020. Part 3: Enable creation of mozilla::TimeStamp from system Timestamps. r=roc

This commit is contained in:
Mason Chang 2014-11-14 08:31:04 -08:00
Родитель 4fddbd3845
Коммит 89dd1bd2d2
3 изменённых файлов: 15 добавлений и 6 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;

Просмотреть файл

@ -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