Making panels stacking order aware of launcher alignment
[chromium-blink-merge.git] / cc / output / begin_frame_args.cc
blobcefb22bdc1382aa20f6217a5f077fad39d5daa98
1 // Copyright 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.
5 #include "cc/output/begin_frame_args.h"
7 namespace cc {
9 BeginFrameArgs::BeginFrameArgs()
10 : frame_time(base::TimeTicks()),
11 deadline(base::TimeTicks()),
12 interval(base::TimeDelta::FromMicroseconds(-1)) {
15 BeginFrameArgs::BeginFrameArgs(base::TimeTicks frame_time,
16 base::TimeTicks deadline,
17 base::TimeDelta interval)
18 : frame_time(frame_time),
19 deadline(deadline),
20 interval(interval)
23 BeginFrameArgs BeginFrameArgs::Create(base::TimeTicks frame_time,
24 base::TimeTicks deadline,
25 base::TimeDelta interval) {
26 return BeginFrameArgs(frame_time, deadline, interval);
29 BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor() {
30 // For WebView/SynchronousCompositor, we always want to draw immediately,
31 // so we set the deadline to 0 and guess that the interval is 16 milliseconds.
32 return BeginFrameArgs(base::TimeTicks::Now(),
33 base::TimeTicks(),
34 DefaultInterval());
37 BeginFrameArgs BeginFrameArgs::CreateForTesting() {
38 base::TimeTicks now = base::TimeTicks::Now();
39 return BeginFrameArgs(now,
40 now + (DefaultInterval() / 2),
41 DefaultInterval());
44 BeginFrameArgs BeginFrameArgs::CreateExpiredForTesting() {
45 base::TimeTicks now = base::TimeTicks::Now();
46 return BeginFrameArgs(now,
47 now - DefaultInterval(),
48 DefaultInterval());
51 base::TimeDelta BeginFrameArgs::DefaultDeadlineAdjustment() {
52 // Using a large deadline adjustment will effectively revert BeginFrame
53 // scheduling to the hard vsync scheduling we used to have.
54 return base::TimeDelta::FromSeconds(-1);
57 base::TimeDelta BeginFrameArgs::DefaultInterval() {
58 return base::TimeDelta::FromMicroseconds(16666);
61 base::TimeDelta BeginFrameArgs::DefaultRetroactiveBeginFramePeriod() {
62 return base::TimeDelta::FromMicroseconds(4444);
66 } // namespace cc