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; ...@@ -43,16 +43,16 @@ const double approximateFrameTime = 1 / 60.0;
namespace blink { namespace blink {
unsigned AnimationClock::s_currentTask = 0; unsigned AnimationClock::s_currentlyRunningTask = 0;
void AnimationClock::updateTime(double time) { void AnimationClock::updateTime(double time) {
if (time > m_time) if (time > m_time)
m_time = time; m_time = time;
m_currentTask = s_currentTask; m_taskForWhichTimeWasCalculated = s_currentlyRunningTask;
} }
double AnimationClock::currentTime() { double AnimationClock::currentTime() {
if (m_currentTask != s_currentTask) { if (m_taskForWhichTimeWasCalculated != s_currentlyRunningTask) {
const double currentTime = m_monotonicallyIncreasingTime(); const double currentTime = m_monotonicallyIncreasingTime();
if (m_time < currentTime) { if (m_time < currentTime) {
// Advance to the first estimated frame after the current time. // Advance to the first estimated frame after the current time.
...@@ -63,7 +63,7 @@ double AnimationClock::currentTime() { ...@@ -63,7 +63,7 @@ double AnimationClock::currentTime() {
DCHECK_LE(newTime, currentTime + approximateFrameTime); DCHECK_LE(newTime, currentTime + approximateFrameTime);
updateTime(newTime); updateTime(newTime);
} else { } else {
m_currentTask = s_currentTask; m_taskForWhichTimeWasCalculated = s_currentlyRunningTask;
} }
} }
return m_time; return m_time;
...@@ -71,8 +71,8 @@ double AnimationClock::currentTime() { ...@@ -71,8 +71,8 @@ double AnimationClock::currentTime() {
void AnimationClock::resetTimeForTesting(double time) { void AnimationClock::resetTimeForTesting(double time) {
m_time = time; m_time = time;
m_currentTask = 0; m_taskForWhichTimeWasCalculated = 0;
s_currentTask = 0; s_currentlyRunningTask = 0;
} }
} // namespace blink } // namespace blink
...@@ -35,10 +35,14 @@ ...@@ -35,10 +35,14 @@
#include "wtf/Allocator.h" #include "wtf/Allocator.h"
#include "wtf/CurrentTime.h" #include "wtf/CurrentTime.h"
#include "wtf/Noncopyable.h" #include "wtf/Noncopyable.h"
#include <limits> #include <limits>
namespace blink { 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 { class CORE_EXPORT AnimationClock {
DISALLOW_NEW(); DISALLOW_NEW();
WTF_MAKE_NONCOPYABLE(AnimationClock); WTF_MAKE_NONCOPYABLE(AnimationClock);
...@@ -48,19 +52,21 @@ class CORE_EXPORT AnimationClock { ...@@ -48,19 +52,21 @@ class CORE_EXPORT AnimationClock {
WTF::monotonicallyIncreasingTime) WTF::monotonicallyIncreasingTime)
: m_monotonicallyIncreasingTime(monotonicallyIncreasingTime), : m_monotonicallyIncreasingTime(monotonicallyIncreasingTime),
m_time(0), m_time(0),
m_currentTask(std::numeric_limits<unsigned>::max()) {} m_taskForWhichTimeWasCalculated(std::numeric_limits<unsigned>::max()) {}
void updateTime(double time); void updateTime(double time);
double currentTime(); double currentTime();
void resetTimeForTesting(double time = 0); 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: private:
WTF::TimeFunction m_monotonicallyIncreasingTime; WTF::TimeFunction m_monotonicallyIncreasingTime;
double m_time; double m_time;
unsigned m_currentTask; unsigned m_taskForWhichTimeWasCalculated;
static unsigned s_currentTask; static unsigned s_currentlyRunningTask;
}; };
} // namespace blink } // 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