Backed out changeset 5b92f3ac380c (bug 1139220) for bustage on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2015-04-02 09:13:53 +02:00
parent daaba64d03
commit 5d7cba0e16
3 changed files with 55 additions and 79 deletions

View File

@ -1,77 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et tw=80 : */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_layers_AsyncPanZoomAnimation_h_
#define mozilla_layers_AsyncPanZoomAnimation_h_
#include "base/message_loop.h"
#include "mozilla/RefPtr.h"
#include "mozilla/TimeStamp.h"
#include "FrameMetrics.h"
#include "nsISupportsImpl.h"
namespace mozilla {
namespace layers {
class AsyncPanZoomAnimation {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AsyncPanZoomAnimation)
public:
explicit AsyncPanZoomAnimation(const TimeDuration& aRepaintInterval =
TimeDuration::Forever())
: mRepaintInterval(aRepaintInterval)
{ }
virtual bool DoSample(FrameMetrics& aFrameMetrics,
const TimeDuration& aDelta) = 0;
bool Sample(FrameMetrics& aFrameMetrics,
const TimeDuration& aDelta) {
// In some situations, particularly when handoff is involved, it's possible
// for |aDelta| to be negative on the first call to sample. Ignore such a
// sample here, to avoid each derived class having to deal with this case.
if (aDelta.ToMilliseconds() <= 0) {
return true;
}
return DoSample(aFrameMetrics, aDelta);
}
/**
* Get the deferred tasks in |mDeferredTasks|. See |mDeferredTasks|
* for more information.
* Clears |mDeferredTasks|.
*/
Vector<Task*> TakeDeferredTasks() {
Vector<Task*> result;
mDeferredTasks.swap(result);
return result;
}
/**
* Specifies how frequently (at most) we want to do repaints during the
* animation sequence. TimeDuration::Forever() will cause it to only repaint
* at the end of the animation.
*/
TimeDuration mRepaintInterval;
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~AsyncPanZoomAnimation()
{ }
/**
* Tasks scheduled for execution after the APZC's mMonitor is released.
* Derived classes can add tasks here in Sample(), and the APZC can call
* ExecuteDeferredTasks() to execute them.
*/
Vector<Task*> mDeferredTasks;
};
} // namespace layers
} // namespace mozilla
#endif // mozilla_layers_AsyncPanZoomAnimation_h_

View File

@ -10,7 +10,6 @@
#include "CrossProcessMutex.h"
#include "mozilla/layers/GeckoContentController.h"
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/AsyncPanZoomAnimation.h"
#include "mozilla/Attributes.h"
#include "mozilla/EventForwards.h"
#include "mozilla/Monitor.h"
@ -1077,6 +1076,61 @@ private:
bool mAsyncTransformAppliedToContent;
};
class AsyncPanZoomAnimation {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AsyncPanZoomAnimation)
public:
explicit AsyncPanZoomAnimation(const TimeDuration& aRepaintInterval =
TimeDuration::Forever())
: mRepaintInterval(aRepaintInterval)
{ }
virtual bool DoSample(FrameMetrics& aFrameMetrics,
const TimeDuration& aDelta) = 0;
bool Sample(FrameMetrics& aFrameMetrics,
const TimeDuration& aDelta) {
// In some situations, particularly when handoff is involved, it's possible
// for |aDelta| to be negative on the first call to sample. Ignore such a
// sample here, to avoid each derived class having to deal with this case.
if (aDelta.ToMilliseconds() <= 0) {
return true;
}
return DoSample(aFrameMetrics, aDelta);
}
/**
* Get the deferred tasks in |mDeferredTasks|. See |mDeferredTasks|
* for more information.
* Clears |mDeferredTasks|.
*/
Vector<Task*> TakeDeferredTasks() {
Vector<Task*> result;
mDeferredTasks.swap(result);
return result;
}
/**
* Specifies how frequently (at most) we want to do repaints during the
* animation sequence. TimeDuration::Forever() will cause it to only repaint
* at the end of the animation.
*/
TimeDuration mRepaintInterval;
protected:
// Protected destructor, to discourage deletion outside of Release():
virtual ~AsyncPanZoomAnimation()
{ }
/**
* Tasks scheduled for execution after the APZC's mMonitor is released.
* Derived classes can add tasks here in Sample(), and the APZC can call
* ExecuteDeferredTasks() to execute them.
*/
Vector<Task*> mDeferredTasks;
};
}
}

View File

@ -94,7 +94,6 @@ EXPORTS.mozilla.layers += [
# proper interface for the code there
'apz/src/APZCTreeManager.h',
'apz/src/APZUtils.h',
'apz/src/AsyncPanZoomAnimation.h',
'apz/testutil/APZTestData.h',
'apz/util/ActiveElementManager.h',
'apz/util/APZCCallbackHelper.h',