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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 * macro to prevent the data even getting referenced. | 31 * macro to prevent the data even getting referenced. |
32 */ | 32 */ |
33 #ifdef NDEBUG | 33 #ifdef NDEBUG |
34 #define BEGINFRAME_FROM_HERE nullptr | 34 #define BEGINFRAME_FROM_HERE nullptr |
35 #else | 35 #else |
36 #define BEGINFRAME_FROM_HERE FROM_HERE | 36 #define BEGINFRAME_FROM_HERE FROM_HERE |
37 #endif | 37 #endif |
38 | 38 |
39 namespace cc { | 39 namespace cc { |
40 | 40 |
41 namespace proto { | |
42 class BeginFrameArgs; | |
43 } | |
44 | |
45 struct CC_EXPORT BeginFrameArgs { | 41 struct CC_EXPORT BeginFrameArgs { |
46 enum BeginFrameArgsType { | 42 enum BeginFrameArgsType { |
47 INVALID, | 43 INVALID, |
48 NORMAL, | 44 NORMAL, |
49 MISSED, | 45 MISSED, |
50 // Not a real type, but used by the IPC system. Should always remain the | 46 // Not a real type, but used by the IPC system. Should always remain the |
51 // *last* value in this enum. | 47 // *last* value in this enum. |
52 BEGIN_FRAME_ARGS_TYPE_MAX, | 48 BEGIN_FRAME_ARGS_TYPE_MAX, |
53 }; | 49 }; |
54 static const char* TypeToString(BeginFrameArgsType type); | 50 static const char* TypeToString(BeginFrameArgsType type); |
55 void BeginFrameArgsTypeToProtobuf(proto::BeginFrameArgs* proto) const; | |
56 void BeginFrameArgsTypeFromProtobuf(const proto::BeginFrameArgs& proto); | |
57 | 51 |
58 // Creates an invalid set of values. | 52 // Creates an invalid set of values. |
59 BeginFrameArgs(); | 53 BeginFrameArgs(); |
60 | 54 |
61 #ifdef NDEBUG | 55 #ifdef NDEBUG |
62 typedef const void* CreationLocation; | 56 typedef const void* CreationLocation; |
63 #else | 57 #else |
64 typedef const tracked_objects::Location& CreationLocation; | 58 typedef const tracked_objects::Location& CreationLocation; |
65 tracked_objects::Location created_from; | 59 tracked_objects::Location created_from; |
66 #endif | 60 #endif |
(...skipping 13 matching lines...) Expand all Loading... |
80 | 74 |
81 // This is the default interval to use to avoid sprinkling the code with | 75 // This is the default interval to use to avoid sprinkling the code with |
82 // magic numbers. | 76 // magic numbers. |
83 static base::TimeDelta DefaultInterval(); | 77 static base::TimeDelta DefaultInterval(); |
84 | 78 |
85 bool IsValid() const { return interval >= base::TimeDelta(); } | 79 bool IsValid() const { return interval >= base::TimeDelta(); } |
86 | 80 |
87 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 81 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
88 void AsValueInto(base::trace_event::TracedValue* dict) const; | 82 void AsValueInto(base::trace_event::TracedValue* dict) const; |
89 | 83 |
90 void ToProtobuf(proto::BeginFrameArgs* proto) const; | |
91 void FromProtobuf(const proto::BeginFrameArgs& proto); | |
92 | |
93 base::TimeTicks frame_time; | 84 base::TimeTicks frame_time; |
94 base::TimeTicks deadline; | 85 base::TimeTicks deadline; |
95 base::TimeDelta interval; | 86 base::TimeDelta interval; |
96 BeginFrameArgsType type; | 87 BeginFrameArgsType type; |
97 bool on_critical_path; | 88 bool on_critical_path; |
98 | 89 |
99 private: | 90 private: |
100 BeginFrameArgs(base::TimeTicks frame_time, | 91 BeginFrameArgs(base::TimeTicks frame_time, |
101 base::TimeTicks deadline, | 92 base::TimeTicks deadline, |
102 base::TimeDelta interval, | 93 base::TimeDelta interval, |
103 BeginFrameArgsType type); | 94 BeginFrameArgsType type); |
104 }; | 95 }; |
105 | 96 |
106 } // namespace cc | 97 } // namespace cc |
107 | 98 |
108 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 99 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
OLD | NEW |