OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 5 #ifndef CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
6 #define CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 6 #define CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 namespace debug { | 14 namespace debug { |
15 class ConvertableToTraceFormat; | 15 class ConvertableToTraceFormat; |
16 class TracedValue; | 16 class TracedValue; |
17 } | 17 } |
18 } | 18 } |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 | 21 |
22 struct CC_EXPORT BeginFrameArgs { | 22 struct CC_EXPORT BeginFrameArgs { |
23 enum BeginFrameArgsType { | |
24 INVALID, | |
25 NORMAL, | |
26 SYNCHRONOUS, | |
27 MISSED, | |
28 }; | |
29 | |
23 // Creates an invalid set of values. | 30 // Creates an invalid set of values. |
24 BeginFrameArgs(); | 31 BeginFrameArgs(); |
25 | 32 |
26 // You should be able to find all instances where a BeginFrame has been | 33 // You should be able to find all instances where a BeginFrame has been |
27 // created by searching for "BeginFrameArgs::Create". | 34 // created by searching for "BeginFrameArgs::Create". |
28 static BeginFrameArgs Create(base::TimeTicks frame_time, | 35 static BeginFrameArgs Create(base::TimeTicks frame_time, |
29 base::TimeTicks deadline, | 36 base::TimeTicks deadline, |
30 base::TimeDelta interval); | 37 base::TimeDelta interval, |
38 BeginFrameArgsType type = NORMAL); | |
brianderson
2014/09/27 00:41:40
Default values aren't allowed, but overloading is.
danakj
2014/09/27 01:09:44
http://google-styleguide.googlecode.com/svn/trunk/
mithro-old
2014/09/30 08:30:01
Someone should fix CreateForSynchronousCompositor
mithro-old
2014/09/30 08:30:01
Done.
| |
31 static BeginFrameArgs CreateForSynchronousCompositor( | 39 static BeginFrameArgs CreateForSynchronousCompositor( |
32 base::TimeTicks now = base::TimeTicks()); | 40 base::TimeTicks now = base::TimeTicks()); |
33 | 41 |
34 // This is the default delta that will be used to adjust the deadline when | 42 // This is the default delta that will be used to adjust the deadline when |
35 // proper draw-time estimations are not yet available. | 43 // proper draw-time estimations are not yet available. |
36 static base::TimeDelta DefaultEstimatedParentDrawTime(); | 44 static base::TimeDelta DefaultEstimatedParentDrawTime(); |
37 | 45 |
38 // This is the default interval to use to avoid sprinkling the code with | 46 // This is the default interval to use to avoid sprinkling the code with |
39 // magic numbers. | 47 // magic numbers. |
40 static base::TimeDelta DefaultInterval(); | 48 static base::TimeDelta DefaultInterval(); |
41 | 49 |
42 // This is the default amount of time after the frame_time to retroactively | 50 // 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 | 51 // 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 | 52 // deadline has passed, since the deadline is also used to trigger BeginFrame |
45 // retroactively. | 53 // retroactively. |
46 static base::TimeDelta DefaultRetroactiveBeginFramePeriod(); | 54 static base::TimeDelta DefaultRetroactiveBeginFramePeriod(); |
47 | 55 |
48 bool IsValid() const { return interval >= base::TimeDelta(); } | 56 bool IsValid() const { return interval >= base::TimeDelta(); } |
49 | 57 |
50 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; | 58 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; |
51 void AsValueInto(base::debug::TracedValue* dict) const; | 59 void AsValueInto(base::debug::TracedValue* dict) const; |
52 | 60 |
53 base::TimeTicks frame_time; | 61 base::TimeTicks frame_time; |
54 base::TimeTicks deadline; | 62 base::TimeTicks deadline; |
55 base::TimeDelta interval; | 63 base::TimeDelta interval; |
64 BeginFrameArgsType type; | |
56 | 65 |
57 private: | 66 private: |
58 BeginFrameArgs(base::TimeTicks frame_time, | 67 BeginFrameArgs(base::TimeTicks frame_time, |
59 base::TimeTicks deadline, | 68 base::TimeTicks deadline, |
60 base::TimeDelta interval); | 69 base::TimeDelta interval, |
70 BeginFrameArgsType type); | |
61 }; | 71 }; |
62 | 72 |
63 } // namespace cc | 73 } // namespace cc |
64 | 74 |
65 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 75 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
OLD | NEW |