summaryrefslogtreecommitdiffstats
path: root/cc/frame_rate_counter.cc
diff options
context:
space:
mode:
authoraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-04 03:25:55 +0000
committeraelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-04 03:25:55 +0000
commitdb79992121c7627abc0855e655d91470ee3ac3ac (patch)
treec9e8cc8541c775dbe600fb299b56fb37b9e05227 /cc/frame_rate_counter.cc
parent8311a2b8ceea50b6bcd923cd709949cc082b865d (diff)
downloadchromium_src-db79992121c7627abc0855e655d91470ee3ac3ac.zip
chromium_src-db79992121c7627abc0855e655d91470ee3ac3ac.tar.gz
chromium_src-db79992121c7627abc0855e655d91470ee3ac3ac.tar.bz2
Remove static thread pointers from CC, attempt 2
BUG=152904 Review URL: https://chromiumcodereview.appspot.com/11232051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/frame_rate_counter.cc')
-rw-r--r--cc/frame_rate_counter.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/cc/frame_rate_counter.cc b/cc/frame_rate_counter.cc
index 46b51f4..4121fc0 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
-