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/time/time.h" | 8 #include "base/time/time.h" |
9 #include "base/values.h" | |
9 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
10 | 11 |
11 namespace cc { | 12 namespace cc { |
12 | 13 |
13 struct CC_EXPORT BeginFrameArgs { | 14 struct CC_EXPORT BeginFrameArgs { |
14 // Creates an invalid set of values. | 15 // Creates an invalid set of values. |
15 BeginFrameArgs(); | 16 BeginFrameArgs(); |
16 | 17 |
17 // You should be able to find all instances where a BeginFrame has been | 18 // You should be able to find all instances where a BeginFrame has been |
18 // created by searching for "BeginFrameArgs::Create". | 19 // created by searching for "BeginFrameArgs::Create". |
(...skipping 13 matching lines...) Expand all Loading... | |
32 static base::TimeDelta DefaultInterval(); | 33 static base::TimeDelta DefaultInterval(); |
33 | 34 |
34 // This is the default amount of time after the frame_time to retroactively | 35 // This is the default amount of time after the frame_time to retroactively |
35 // send a BeginFrame that had been skipped. This only has an effect if the | 36 // send a BeginFrame that had been skipped. This only has an effect if the |
36 // deadline has passed, since the deadline is also used to trigger BeginFrame | 37 // deadline has passed, since the deadline is also used to trigger BeginFrame |
37 // retroactively. | 38 // retroactively. |
38 static base::TimeDelta DefaultRetroactiveBeginFramePeriod(); | 39 static base::TimeDelta DefaultRetroactiveBeginFramePeriod(); |
39 | 40 |
40 bool IsValid() const { return interval >= base::TimeDelta(); } | 41 bool IsValid() const { return interval >= base::TimeDelta(); } |
41 | 42 |
43 scoped_ptr<base::Value> AsValue() const { | |
44 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue); | |
45 state->SetString("type", "BeginFrameArgs"); | |
brianderson
2014/05/07 17:20:16
I don't think we use this "type" pattern anywhere
mithro-old
2014/05/07 22:02:32
I'd really like to have a type field because then
brianderson
2014/05/08 00:55:58
Please split it out to a separate patch, yes. If y
mithro-old
2014/05/09 02:45:58
Done.
| |
46 state->SetInteger("frame_time_us", frame_time.ToInternalValue()); | |
47 state->SetInteger("deadline_us", deadline.ToInternalValue()); | |
48 state->SetInteger("interval_us", interval.InMicroseconds()); | |
49 return state.PassAs<base::Value>(); | |
50 } | |
51 | |
42 base::TimeTicks frame_time; | 52 base::TimeTicks frame_time; |
43 base::TimeTicks deadline; | 53 base::TimeTicks deadline; |
44 base::TimeDelta interval; | 54 base::TimeDelta interval; |
45 | 55 |
46 private: | 56 private: |
47 BeginFrameArgs(base::TimeTicks frame_time, | 57 BeginFrameArgs(base::TimeTicks frame_time, |
48 base::TimeTicks deadline, | 58 base::TimeTicks deadline, |
49 base::TimeDelta interval); | 59 base::TimeDelta interval); |
50 }; | 60 }; |
51 | 61 |
52 } // namespace cc | 62 } // namespace cc |
53 | 63 |
54 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 64 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
OLD | NEW |