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 #ifndef CC_OUTPUT_BEGIN_FRAME_ARGS_H_
6 #define CC_OUTPUT_BEGIN_FRAME_ARGS_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/time/time.h"
10 #include "base/values.h"
11 #include "cc/base/cc_export.h"
15 class ConvertableToTraceFormat
;
22 struct CC_EXPORT BeginFrameArgs
{
23 // Creates an invalid set of values.
26 // You should be able to find all instances where a BeginFrame has been
27 // created by searching for "BeginFrameArgs::Create".
28 static BeginFrameArgs
Create(base::TimeTicks frame_time
,
29 base::TimeTicks deadline
,
30 base::TimeDelta interval
);
31 static BeginFrameArgs
CreateForSynchronousCompositor(
32 base::TimeTicks now
= base::TimeTicks());
34 // This is the default delta that will be used to adjust the deadline when
35 // proper draw-time estimations are not yet available.
36 static base::TimeDelta
DefaultEstimatedParentDrawTime();
38 // This is the default interval to use to avoid sprinkling the code with
40 static base::TimeDelta
DefaultInterval();
42 // This is the default amount of time after the frame_time to retroactively
43 // send a BeginFrame that had been skipped. This only has an effect if the
44 // deadline has passed, since the deadline is also used to trigger BeginFrame
46 static base::TimeDelta
DefaultRetroactiveBeginFramePeriod();
48 bool IsValid() const { return interval
>= base::TimeDelta(); }
50 scoped_refptr
<base::debug::ConvertableToTraceFormat
> AsValue() const;
51 void AsValueInto(base::debug::TracedValue
* dict
) const;
53 base::TimeTicks frame_time
;
54 base::TimeTicks deadline
;
55 base::TimeDelta interval
;
58 BeginFrameArgs(base::TimeTicks frame_time
,
59 base::TimeTicks deadline
,
60 base::TimeDelta interval
);
65 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_