diff options
author | sheu@chromium.org <sheu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-11 00:35:28 +0000 |
---|---|---|
committer | sheu@chromium.org <sheu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-11 00:35:28 +0000 |
commit | 065f99f47b7ea639bd313a96db8f34dc1de9c58e (patch) | |
tree | b110216e4e53abcc2969181c8a4552a4818f5e60 /cc | |
parent | 13669105e9d85af58d1798abe40dc1b199a239c7 (diff) | |
download | chromium_src-065f99f47b7ea639bd313a96db8f34dc1de9c58e.zip chromium_src-065f99f47b7ea639bd313a96db8f34dc1de9c58e.tar.gz chromium_src-065f99f47b7ea639bd313a96db8f34dc1de9c58e.tar.bz2 |
Read compositor VSync information from platform, when possible
The current query of VSync information through the GL context can be unreliable
on platforms that can dynamically disable vblanks, or multi-monitor setups.
Preferentially query the VSync information through the platform windowing
system (presently: XRandR on CrOS) when possible.
BUG=328953
TEST=local build, run on CrOS snow
Review URL: https://codereview.chromium.org/138903025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250250 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/output/output_surface.cc | 13 | ||||
-rw-r--r-- | cc/output/output_surface.h | 4 | ||||
-rw-r--r-- | cc/output/output_surface_unittest.cc | 8 |
3 files changed, 14 insertions, 11 deletions
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index 9ba6dbb..87d6e84 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc @@ -117,11 +117,14 @@ void OutputSurface::SetMaxFramesPending(int max_frames_pending) { max_frames_pending_ = max_frames_pending; } -void OutputSurface::OnVSyncParametersChanged(base::TimeTicks timebase, - base::TimeDelta interval) { - TRACE_EVENT2("cc", "OutputSurface::OnVSyncParametersChanged", - "timebase", (timebase - base::TimeTicks()).InSecondsF(), - "interval", interval.InSecondsF()); +void OutputSurface::CommitVSyncParameters(base::TimeTicks timebase, + base::TimeDelta interval) { + TRACE_EVENT2("cc", + "OutputSurface::CommitVSyncParameters", + "timebase", + (timebase - base::TimeTicks()).InSecondsF(), + "interval", + interval.InSecondsF()); if (frame_rate_controller_) frame_rate_controller_->SetTimebaseAndInterval(timebase, interval); } diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index 4478754..b751f06 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h @@ -159,8 +159,8 @@ class CC_EXPORT OutputSurface : public FrameRateControllerClient { // The FrameRateController is deprecated. // Platforms should move to native BeginImplFrames instead. - void OnVSyncParametersChanged(base::TimeTicks timebase, - base::TimeDelta interval); + void CommitVSyncParameters(base::TimeTicks timebase, + base::TimeDelta interval); virtual void FrameRateControllerTick(bool throttled, const BeginFrameArgs& args) OVERRIDE; scoped_ptr<FrameRateController> frame_rate_controller_; diff --git a/cc/output/output_surface_unittest.cc b/cc/output/output_surface_unittest.cc index 73a76a3..b0220fb 100644 --- a/cc/output/output_surface_unittest.cc +++ b/cc/output/output_surface_unittest.cc @@ -46,9 +46,9 @@ class TestOutputSurface : public OutputSurface { using OutputSurface::ReleaseGL; - void OnVSyncParametersChangedForTesting(base::TimeTicks timebase, - base::TimeDelta interval) { - OnVSyncParametersChanged(timebase, interval); + void CommitVSyncParametersForTesting(base::TimeTicks timebase, + base::TimeDelta interval) { + CommitVSyncParameters(timebase, interval); } void BeginImplFrameForTesting() { @@ -387,7 +387,7 @@ TEST(OutputSurfaceTest, // We need to subtract an epsilon from Now() because some platforms have // a slow clock. - output_surface.OnVSyncParametersChangedForTesting( + output_surface.CommitVSyncParametersForTesting( gfx::FrameTime::Now() - base::TimeDelta::FromSeconds(1), big_interval); output_surface.SetMaxFramesPending(2); |