OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SCHEDULER_COMMIT_EARLYOUT_REASON_H_ | 5 #ifndef CC_SCHEDULER_COMMIT_EARLYOUT_REASON_H_ |
6 #define CC_SCHEDULER_COMMIT_EARLYOUT_REASON_H_ | 6 #define CC_SCHEDULER_COMMIT_EARLYOUT_REASON_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 namespace proto { | 13 namespace proto { |
14 class CommitEarlyOutReason; | 14 class CommitEarlyOutReason; |
15 } | 15 } |
16 | 16 |
17 enum class CommitEarlyOutReason { | 17 enum class CommitEarlyOutReason { |
18 ABORTED_OUTPUT_SURFACE_LOST, | 18 ABORTED_COMPOSITOR_FRAME_SINK_LOST, |
19 ABORTED_NOT_VISIBLE, | 19 ABORTED_NOT_VISIBLE, |
20 ABORTED_DEFERRED_COMMIT, | 20 ABORTED_DEFERRED_COMMIT, |
21 FINISHED_NO_UPDATES, | 21 FINISHED_NO_UPDATES, |
22 }; | 22 }; |
23 | 23 |
24 // Please update the To/From Protobuf methods for any updates made to | 24 // Please update the To/From Protobuf methods for any updates made to |
25 // CommitEarlyOutReason enum. | 25 // CommitEarlyOutReason enum. |
26 CC_EXPORT CommitEarlyOutReason | 26 CC_EXPORT CommitEarlyOutReason |
27 CommitEarlyOutReasonFromProtobuf(const proto::CommitEarlyOutReason& proto); | 27 CommitEarlyOutReasonFromProtobuf(const proto::CommitEarlyOutReason& proto); |
28 CC_EXPORT void CommitEarlyOutReasonToProtobuf( | 28 CC_EXPORT void CommitEarlyOutReasonToProtobuf( |
29 CommitEarlyOutReason reason, | 29 CommitEarlyOutReason reason, |
30 proto::CommitEarlyOutReason* proto); | 30 proto::CommitEarlyOutReason* proto); |
31 | 31 |
32 inline const char* CommitEarlyOutReasonToString(CommitEarlyOutReason reason) { | 32 inline const char* CommitEarlyOutReasonToString(CommitEarlyOutReason reason) { |
33 switch (reason) { | 33 switch (reason) { |
34 case CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST: | 34 case CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST: |
35 return "CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST"; | 35 return "CommitEarlyOutReason::ABORTED_COMPOSITOR_FRAME_SINK_LOST"; |
36 case CommitEarlyOutReason::ABORTED_NOT_VISIBLE: | 36 case CommitEarlyOutReason::ABORTED_NOT_VISIBLE: |
37 return "CommitEarlyOutReason::ABORTED_NOT_VISIBLE"; | 37 return "CommitEarlyOutReason::ABORTED_NOT_VISIBLE"; |
38 case CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT: | 38 case CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT: |
39 return "CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT"; | 39 return "CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT"; |
40 case CommitEarlyOutReason::FINISHED_NO_UPDATES: | 40 case CommitEarlyOutReason::FINISHED_NO_UPDATES: |
41 return "CommitEarlyOutReason::FINISHED_NO_UPDATES"; | 41 return "CommitEarlyOutReason::FINISHED_NO_UPDATES"; |
42 } | 42 } |
43 NOTREACHED(); | 43 NOTREACHED(); |
44 return "???"; | 44 return "???"; |
45 } | 45 } |
46 | 46 |
47 inline bool CommitEarlyOutHandledCommit(CommitEarlyOutReason reason) { | 47 inline bool CommitEarlyOutHandledCommit(CommitEarlyOutReason reason) { |
48 return reason == CommitEarlyOutReason::FINISHED_NO_UPDATES; | 48 return reason == CommitEarlyOutReason::FINISHED_NO_UPDATES; |
49 } | 49 } |
50 | 50 |
51 } // namespace cc | 51 } // namespace cc |
52 | 52 |
53 #endif // CC_SCHEDULER_COMMIT_EARLYOUT_REASON_H_ | 53 #endif // CC_SCHEDULER_COMMIT_EARLYOUT_REASON_H_ |
OLD | NEW |