| 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_BEGIN_FRAME_TRACKER_H_ | 5 #ifndef CC_SCHEDULER_BEGIN_FRAME_TRACKER_H_ |
| 6 #define CC_SCHEDULER_BEGIN_FRAME_TRACKER_H_ | 6 #define CC_SCHEDULER_BEGIN_FRAME_TRACKER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // Get the last used BFA. | 60 // Get the last used BFA. |
| 61 // **Must** only be called when **not** between the start and finish method | 61 // **Must** only be called when **not** between the start and finish method |
| 62 // calls. | 62 // calls. |
| 63 const BeginFrameArgs& Last() const; | 63 const BeginFrameArgs& Last() const; |
| 64 | 64 |
| 65 // Helper method to try and return a valid interval property. Defaults to | 65 // Helper method to try and return a valid interval property. Defaults to |
| 66 // BFA::DefaultInterval() is no other interval can be found. Can be called at | 66 // BFA::DefaultInterval() is no other interval can be found. Can be called at |
| 67 // any time. | 67 // any time. |
| 68 base::TimeDelta Interval() const; | 68 base::TimeDelta Interval() const; |
| 69 | 69 |
| 70 void AsValueInto(base::trace_event::TracedValue* dict) const; | 70 void AsValueInto(base::TimeTicks now, |
| 71 base::trace_event::TracedValue* dict) const; |
| 71 | 72 |
| 72 // The following methods violate principles of how BeginFrameArgs should be | 73 // The following methods violate principles of how BeginFrameArgs should be |
| 73 // used. These methods should only be used when there is no other choice. | 74 // used. These methods should only be used when there is no other choice. |
| 74 bool DangerousMethodHasStarted() const { | 75 bool DangerousMethodHasStarted() const { |
| 75 return !current_updated_at_.is_null(); | 76 return !current_updated_at_.is_null(); |
| 76 } | 77 } |
| 77 bool DangerousMethodHasFinished() const { return HasFinished(); } | 78 bool DangerousMethodHasFinished() const { return HasFinished(); } |
| 78 const BeginFrameArgs& DangerousMethodCurrentOrLast() const; | 79 const BeginFrameArgs& DangerousMethodCurrentOrLast() const; |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 // Return if currently not between the start/end period. This method should | 82 // Return if currently not between the start/end period. This method should |
| 82 // be used extremely sparingly and normal indicates incorrect management of | 83 // be used extremely sparingly and normal indicates incorrect management of |
| 83 // the BFA object. Can be called at any time. | 84 // the BFA object. Can be called at any time. |
| 84 bool HasFinished() const { return !current_finished_at_.is_null(); } | 85 bool HasFinished() const { return !current_finished_at_.is_null(); } |
| 85 | 86 |
| 86 const tracked_objects::Location location_; | 87 const tracked_objects::Location location_; |
| 87 const std::string location_string_; | 88 const std::string location_string_; |
| 88 | 89 |
| 89 base::TimeTicks current_updated_at_; | 90 base::TimeTicks current_updated_at_; |
| 90 BeginFrameArgs current_args_; | 91 BeginFrameArgs current_args_; |
| 91 base::TimeTicks current_finished_at_; | 92 base::TimeTicks current_finished_at_; |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 } // namespace cc | 95 } // namespace cc |
| 95 | 96 |
| 96 #endif // CC_SCHEDULER_BEGIN_FRAME_TRACKER_H_ | 97 #endif // CC_SCHEDULER_BEGIN_FRAME_TRACKER_H_ |
| OLD | NEW |