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

Unified Diff: cc/frame_rate_controller.cc

Issue 11747002: cc: Set the max frames pending from the thread proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DCHECK_GE Created 7 years, 11 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_controller.h ('k') | cc/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/frame_rate_controller.cc
diff --git a/cc/frame_rate_controller.cc b/cc/frame_rate_controller.cc
index 436e80dd52bb346006eb9609848079b5411e92e4..60fbde788f2f668111e154874c6a54a671e94134 100644
--- a/cc/frame_rate_controller.cc
+++ b/cc/frame_rate_controller.cc
@@ -10,14 +10,6 @@
#include "cc/time_source.h"
#include "cc/thread.h"
-namespace {
-
-// This will be the maximum number of pending frames unless
-// FrameRateController::setMaxFramesPending is called.
-const int defaultMaxFramesPending = 2;
-
-} // namespace
-
namespace cc {
class FrameRateControllerTimeSourceAdapter : public TimeSourceClient {
@@ -41,7 +33,7 @@ private:
FrameRateController::FrameRateController(scoped_refptr<TimeSource> timer)
: m_client(0)
, m_numFramesPending(0)
- , m_maxFramesPending(defaultMaxFramesPending)
+ , m_maxFramesPending(0)
, m_timeSource(timer)
, m_active(false)
, m_swapBuffersCompleteSupported(true)
@@ -56,7 +48,7 @@ FrameRateController::FrameRateController(scoped_refptr<TimeSource> timer)
FrameRateController::FrameRateController(Thread* thread)
: m_client(0)
, m_numFramesPending(0)
- , m_maxFramesPending(defaultMaxFramesPending)
+ , m_maxFramesPending(0)
, m_active(false)
, m_swapBuffersCompleteSupported(true)
, m_isTimeSourceThrottling(false)
@@ -90,7 +82,7 @@ void FrameRateController::setActive(bool active)
void FrameRateController::setMaxFramesPending(int maxFramesPending)
{
- DCHECK(maxFramesPending > 0);
+ DCHECK_GE(maxFramesPending, 0);
m_maxFramesPending = maxFramesPending;
}
@@ -110,13 +102,13 @@ void FrameRateController::onTimerTick()
DCHECK(m_active);
// Check if we have too many frames in flight.
- bool throttled = m_numFramesPending >= m_maxFramesPending;
+ bool throttled = m_maxFramesPending && m_numFramesPending >= m_maxFramesPending;
TRACE_COUNTER_ID1("cc", "ThrottledVSyncInterval", m_thread, throttled);
if (m_client)
m_client->vsyncTick(throttled);
- if (m_swapBuffersCompleteSupported && !m_isTimeSourceThrottling && m_numFramesPending < m_maxFramesPending)
+ if (m_swapBuffersCompleteSupported && !m_isTimeSourceThrottling && !throttled)
postManualTick();
}
« no previous file with comments | « cc/frame_rate_controller.h ('k') | cc/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698