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/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "cc/base/cc_export.h" | |
13 | 12 |
14 namespace base { | 13 namespace base { |
15 namespace trace_event { | 14 namespace trace_event { |
16 class ConvertableToTraceFormat; | 15 class ConvertableToTraceFormat; |
17 class TracedValue; | 16 class TracedValue; |
18 } | 17 } |
19 } | 18 } |
20 | 19 |
21 /** | 20 /** |
22 * In debug builds we trace the creation origin of BeginFrameArgs objects. We | 21 * In debug builds we trace the creation origin of BeginFrameArgs objects. We |
23 * reuse the tracked_objects::Location system to do that. | 22 * reuse the tracked_objects::Location system to do that. |
24 * | 23 * |
25 * However, in release builds we don't want this as it doubles the size of the | 24 * However, in release builds we don't want this as it doubles the size of the |
26 * BeginFrameArgs object. As well it adds a number of largish strings to the | 25 * BeginFrameArgs object. As well it adds a number of largish strings to the |
27 * binary. Despite the argument being unused, most compilers are unable to | 26 * binary. Despite the argument being unused, most compilers are unable to |
28 * optimise it away even when unused. Instead we use the BEGINFRAME_FROM_HERE | 27 * optimise it away even when unused. Instead we use the BEGINFRAME_FROM_HERE |
29 * macro to prevent the data even getting referenced. | 28 * macro to prevent the data even getting referenced. |
30 */ | 29 */ |
31 #ifdef NDEBUG | 30 #ifdef NDEBUG |
32 #define BEGINFRAME_FROM_HERE nullptr | 31 #define BEGINFRAME_FROM_HERE nullptr |
33 #else | 32 #else |
34 #define BEGINFRAME_FROM_HERE FROM_HERE | 33 #define BEGINFRAME_FROM_HERE FROM_HERE |
35 #endif | 34 #endif |
36 | 35 |
37 namespace cc { | 36 namespace cc { |
38 | 37 |
39 struct CC_EXPORT BeginFrameArgs { | 38 struct BeginFrameArgs { |
40 enum BeginFrameArgsType { | 39 enum BeginFrameArgsType { |
41 INVALID, | 40 INVALID, |
42 NORMAL, | 41 NORMAL, |
43 SYNCHRONOUS, | 42 SYNCHRONOUS, |
44 MISSED, | 43 MISSED, |
45 // Not a real type, but used by the IPC system. Should always remain the | 44 // Not a real type, but used by the IPC system. Should always remain the |
46 // *last* value in this enum. | 45 // *last* value in this enum. |
47 BEGIN_FRAME_ARGS_TYPE_MAX, | 46 BEGIN_FRAME_ARGS_TYPE_MAX, |
48 }; | 47 }; |
49 static const char* TypeToString(BeginFrameArgsType type); | 48 static const char* TypeToString(BeginFrameArgsType type); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 private: | 87 private: |
89 BeginFrameArgs(base::TimeTicks frame_time, | 88 BeginFrameArgs(base::TimeTicks frame_time, |
90 base::TimeTicks deadline, | 89 base::TimeTicks deadline, |
91 base::TimeDelta interval, | 90 base::TimeDelta interval, |
92 BeginFrameArgsType type); | 91 BeginFrameArgsType type); |
93 }; | 92 }; |
94 | 93 |
95 } // namespace cc | 94 } // namespace cc |
96 | 95 |
97 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 96 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
OLD | NEW |