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

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: Address code review comments and fix all cc_unittests 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
« no previous file with comments | « cc/frame_rate_counter.h ('k') | cc/gl_renderer.h » ('j') | cc/gl_renderer.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/frame_rate_counter.cc
diff --git a/cc/frame_rate_counter.cc b/cc/frame_rate_counter.cc
index 7ff1edc54fa50d017b88288979e018526c94c2d6..72027797956481efabb9c326c413b84f1f6b97c0 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<FrameRateCounter> FrameRateCounter::create() {
- return make_scoped_ptr(new FrameRateCounter());
+scoped_ptr<FrameRateCounter> FrameRateCounter::create(bool hasImplThread) {
+ return make_scoped_ptr(new FrameRateCounter(hasImplThread));
}
inline base::TimeDelta FrameRateCounter::frameInterval(int frameNumber) const
@@ -39,8 +39,9 @@ inline int FrameRateCounter::frameIndex(int frameNumber) const
return safeMod(frameNumber, kTimeStampHistorySize);
}
-FrameRateCounter::FrameRateCounter()
- : m_currentFrameNumber(1)
+FrameRateCounter::FrameRateCounter(bool hasImplThread)
+ : m_hasImplThread(hasImplThread)
+ , m_currentFrameNumber(1)
, m_droppedFrameCount(0)
{
m_timeStampHistory[0] = base::TimeTicks::Now();
@@ -54,7 +55,7 @@ void FrameRateCounter::markBeginningOfFrame(base::TimeTicks timestamp)
m_timeStampHistory[frameIndex(m_currentFrameNumber)] = timestamp;
base::TimeDelta frameIntervalSeconds = frameInterval(m_currentFrameNumber);
- if (Proxy::hasImplThread() && m_currentFrameNumber > 0) {
+ if (m_hasImplThread && m_currentFrameNumber > 0) {
HISTOGRAM_CUSTOM_COUNTS("Renderer4.CompositorThreadImplDrawDelay", frameIntervalSeconds.InMilliseconds(), 1, 120, 60);
}
@@ -70,7 +71,7 @@ void FrameRateCounter::markEndOfFrame()
bool FrameRateCounter::isBadFrameInterval(base::TimeDelta intervalBetweenConsecutiveFrames) const
{
- bool schedulerAllowsDoubleFrames = !Proxy::hasImplThread();
+ bool schedulerAllowsDoubleFrames = m_hasImplThread;
bool intervalTooFast = schedulerAllowsDoubleFrames && intervalBetweenConsecutiveFrames.InSecondsF() < kFrameTooFast;
bool intervalTooSlow = intervalBetweenConsecutiveFrames.InSecondsF() > kFrameTooSlow;
return intervalTooFast || intervalTooSlow;
@@ -132,4 +133,3 @@ base::TimeTicks FrameRateCounter::timeStampOfRecentFrame(int n)
}
} // namespace cc
-
« no previous file with comments | « cc/frame_rate_counter.h ('k') | cc/gl_renderer.h » ('j') | cc/gl_renderer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698