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

Side by Side Diff: cc/output/begin_frame_args.cc

Issue 16863005: cc: Add BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc12
Patch Set: Rebase Created 7 years, 6 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 unified diff | Download patch
« no previous file with comments | « cc/output/begin_frame_args.h ('k') | cc/output/output_surface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/output/begin_frame_args.h"
6
7 namespace cc {
8
9 BeginFrameArgs::BeginFrameArgs()
10 : frame_time(base::TimeTicks()),
11 deadline(base::TimeTicks()),
12 interval(base::TimeDelta::FromMicroseconds(-1))
13 {
14 }
15
16 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time,
17 base::TimeTicks deadline,
18 base::TimeDelta interval)
19 : frame_time(frame_time),
20 deadline(deadline),
21 interval(interval)
22 {}
23
24 BeginFrameArgs BeginFrameArgs::Create(base::TimeTicks frame_time,
25 base::TimeTicks deadline,
26 base::TimeDelta interval) {
27 return BeginFrameArgs(frame_time, deadline, interval);
28 }
29
30 BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor() {
31 // For WebView/SynchronousCompositor, we always want to draw immediately,
32 // so we set the deadline to 0 and guess that the interval is 16 milliseconds.
33 return BeginFrameArgs(base::TimeTicks::Now(),
34 base::TimeTicks(),
35 DefaultInterval());
36 }
37
38 BeginFrameArgs BeginFrameArgs::CreateForTesting() {
39 base::TimeTicks now = base::TimeTicks::Now();
40 return BeginFrameArgs(now,
41 now + (DefaultInterval() / 2),
42 DefaultInterval());
43 }
44
45 base::TimeDelta BeginFrameArgs::DefaultDeadlineAdjustment() {
46 // Using a large deadline adjustment will effectively revert BeginFrame
47 // scheduling to the hard vsync scheduling we used to have.
48 return base::TimeDelta::FromSeconds(-1);
49 }
50
51 base::TimeDelta BeginFrameArgs::DefaultInterval() {
52 return base::TimeDelta::FromMicroseconds(16666);
53 }
54
55 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/begin_frame_args.h ('k') | cc/output/output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698