Commit 1f0dfac7 authored by lukasza's avatar lukasza Committed by Commit bot

Rename m_currentTask and s_currentTask/ to help rewrite_to_chrome_style tool.

This CL helps rewrite_to_chrome_style tool, by preventing the tool from
suggesting the following conflicting renames:
- |s_field| -> |field_|
- |m_field| -> |field_|

BUG=641004

Review-Url: https://codereview.chromium.org/2569433002
Cr-Commit-Position: refs/heads/master@{#438058}
parent 13f6e06e
......@@ -43,16 +43,16 @@ const double approximateFrameTime = 1 / 60.0;
namespace blink {
unsigned AnimationClock::s_currentTask = 0;
unsigned AnimationClock::s_currentlyRunningTask = 0;
void AnimationClock::updateTime(double time) {
if (time > m_time)
m_time = time;
m_currentTask = s_currentTask;
m_taskForWhichTimeWasCalculated = s_currentlyRunningTask;
}
double AnimationClock::currentTime() {
if (m_currentTask != s_currentTask) {
if (m_taskForWhichTimeWasCalculated != s_currentlyRunningTask) {
const double currentTime = m_monotonicallyIncreasingTime();
if (m_time < currentTime) {
// Advance to the first estimated frame after the current time.
......@@ -63,7 +63,7 @@ double AnimationClock::currentTime() {
DCHECK_LE(newTime, currentTime + approximateFrameTime);
updateTime(newTime);
} else {
m_currentTask = s_currentTask;
m_taskForWhichTimeWasCalculated = s_currentlyRunningTask;
}
}
return m_time;
......@@ -71,8 +71,8 @@ double AnimationClock::currentTime() {
void AnimationClock::resetTimeForTesting(double time) {
m_time = time;
m_currentTask = 0;
s_currentTask = 0;
m_taskForWhichTimeWasCalculated = 0;
s_currentlyRunningTask = 0;
}
} // namespace blink
......@@ -35,10 +35,14 @@
#include "wtf/Allocator.h"
#include "wtf/CurrentTime.h"
#include "wtf/Noncopyable.h"
#include <limits>
namespace blink {
// Maintains a stationary clock time during script execution. Tries to track
// the glass time (the moment photons leave the screen) of the current animation
// frame.
class CORE_EXPORT AnimationClock {
DISALLOW_NEW();
WTF_MAKE_NONCOPYABLE(AnimationClock);
......@@ -48,19 +52,21 @@ class CORE_EXPORT AnimationClock {
WTF::monotonicallyIncreasingTime)
: m_monotonicallyIncreasingTime(monotonicallyIncreasingTime),
m_time(0),
m_currentTask(std::numeric_limits<unsigned>::max()) {}
m_taskForWhichTimeWasCalculated(std::numeric_limits<unsigned>::max()) {}
void updateTime(double time);
double currentTime();
void resetTimeForTesting(double time = 0);
static void notifyTaskStart() { ++s_currentTask; }
// notifyTaskStart should be called right before the main message loop starts
// to run the next task from the message queue.
static void notifyTaskStart() { ++s_currentlyRunningTask; }
private:
WTF::TimeFunction m_monotonicallyIncreasingTime;
double m_time;
unsigned m_currentTask;
static unsigned s_currentTask;
unsigned m_taskForWhichTimeWasCalculated;
static unsigned s_currentlyRunningTask;
};
} // namespace blink
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment