Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Unified Diff: cc/frame_rate_counter.cc

Issue 11232051: Remove static thread pointers from CC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/frame_rate_counter.cc
diff --git a/cc/frame_rate_counter.cc b/cc/frame_rate_counter.cc
index 565bcfc0b5f3c0cd054f9ba28a80b7dd9658e4a2..871af72613dd2c2ea39bb09a2a243accd45e330c 100644
--- a/cc/frame_rate_counter.cc
+++ b/cc/frame_rate_counter.cc
@@ -24,8 +24,8 @@ static inline int safeMod(int number, int modulus)
}
// static
-scoped_ptr<CCFrameRateCounter> CCFrameRateCounter::create() {
- return make_scoped_ptr(new CCFrameRateCounter());
+scoped_ptr<CCFrameRateCounter> CCFrameRateCounter::create(bool implThreadMode) {
+ return make_scoped_ptr(new CCFrameRateCounter(implThreadMode));
}
inline base::TimeDelta CCFrameRateCounter::frameInterval(int frameNumber) const
@@ -39,8 +39,9 @@ inline int CCFrameRateCounter::frameIndex(int frameNumber) const
return safeMod(frameNumber, kTimeStampHistorySize);
}
-CCFrameRateCounter::CCFrameRateCounter()
- : m_currentFrameNumber(1)
+CCFrameRateCounter::CCFrameRateCounter(bool implThreadMode)
+ : m_implThreadMode(implThreadMode)
+ , m_currentFrameNumber(1)
, m_droppedFrameCount(0)
{
m_timeStampHistory[0] = base::TimeTicks::Now();
@@ -54,7 +55,7 @@ void CCFrameRateCounter::markBeginningOfFrame(base::TimeTicks timestamp)
m_timeStampHistory[frameIndex(m_currentFrameNumber)] = timestamp;
base::TimeDelta frameIntervalSeconds = frameInterval(m_currentFrameNumber);
- if (CCProxy::hasImplThread() && m_currentFrameNumber > 0) {
+ if (m_implThreadMode && m_currentFrameNumber > 0) {
HISTOGRAM_CUSTOM_COUNTS("Renderer4.CompositorThreadImplDrawDelay", frameIntervalSeconds.InMilliseconds(), 1, 120, 60);
}
@@ -70,7 +71,7 @@ void CCFrameRateCounter::markEndOfFrame()
bool CCFrameRateCounter::isBadFrameInterval(base::TimeDelta intervalBetweenConsecutiveFrames) const
{
- bool schedulerAllowsDoubleFrames = !CCProxy::hasImplThread();
+ bool schedulerAllowsDoubleFrames = m_implThreadMode;
bool intervalTooFast = schedulerAllowsDoubleFrames && intervalBetweenConsecutiveFrames.InSecondsF() < kFrameTooFast;
bool intervalTooSlow = intervalBetweenConsecutiveFrames.InSecondsF() > kFrameTooSlow;
return intervalTooFast || intervalTooSlow;
@@ -132,4 +133,3 @@ base::TimeTicks CCFrameRateCounter::timeStampOfRecentFrame(int n)
}
} // namespace cc
-

Powered by Google App Engine
This is Rietveld 408576698