| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_SCHEDULER_BASE_LONG_TASK_TRACKER_H_ | 5 #ifndef THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_LONG_TASK_TRACKER_H_ |
| 6 #define COMPONENTS_SCHEDULER_BASE_LONG_TASK_TRACKER_H_ | 6 #define THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_LONG_TASK_TRACKER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "components/scheduler/scheduler_export.h" | 12 #include "public/platform/WebCommon.h" |
| 13 | 13 |
| 14 namespace blink { |
| 14 namespace scheduler { | 15 namespace scheduler { |
| 15 | 16 |
| 16 // Records and reports long task times, above the threshold. | 17 // Records and reports long task times, above the threshold. |
| 17 // The threshold is set to 50ms in the implementation. | 18 // The threshold is set to 50ms in the implementation. |
| 18 class SCHEDULER_EXPORT LongTaskTracker { | 19 class BLINK_PLATFORM_EXPORT LongTaskTracker { |
| 19 public: | 20 public: |
| 20 using LongTaskTiming = | 21 using LongTaskTiming = |
| 21 std::vector<std::pair<base::TimeTicks, base::TimeDelta>>; | 22 std::vector<std::pair<base::TimeTicks, base::TimeDelta>>; |
| 22 | 23 |
| 23 LongTaskTracker(); | 24 LongTaskTracker(); |
| 24 ~LongTaskTracker(); | 25 ~LongTaskTracker(); |
| 25 | 26 |
| 26 LongTaskTiming GetLongTaskTiming(); | 27 LongTaskTiming GetLongTaskTiming(); |
| 27 void RecordLongTask(base::TimeTicks startTime, | 28 void RecordLongTask(base::TimeTicks startTime, base::TimeDelta duration); |
| 28 base::TimeDelta duration); | |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 friend class LongTaskTrackerTest; | 31 friend class LongTaskTrackerTest; |
| 32 | 32 |
| 33 LongTaskTiming long_task_times_; | 33 LongTaskTiming long_task_times_; |
| 34 | 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(LongTaskTracker); | 35 DISALLOW_COPY_AND_ASSIGN(LongTaskTracker); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 } // namespace scheduler | 38 } // namespace scheduler |
| 39 } // namespace blink |
| 39 | 40 |
| 40 #endif // COMPONENTS_SCHEDULER_BASE_LONG_TASK_TRACKER_H_ | 41 #endif // THIRD_PARTY_WEBKIT_SOURCE_PLATFORM_SCHEDULER_BASE_LONG_TASK_TRACKER_H
_ |
| OLD | NEW |