OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DEBUG_FRAME_TIMING_TRACKER_H_ | 5 #ifndef CC_DEBUG_FRAME_TIMING_TRACKER_H_ |
6 #define CC_DEBUG_FRAME_TIMING_TRACKER_H_ | 6 #define CC_DEBUG_FRAME_TIMING_TRACKER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <unordered_map> |
10 #include <utility> | 11 #include <utility> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/containers/hash_tables.h" | |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "cc/base/cc_export.h" | 17 #include "cc/base/cc_export.h" |
18 #include "cc/base/delayed_unique_notifier.h" | 18 #include "cc/base/delayed_unique_notifier.h" |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 | 21 |
22 class LayerTreeHostImpl; | 22 class LayerTreeHostImpl; |
23 | 23 |
24 // This class maintains a history of timestamps and rect IDs to communicate | 24 // This class maintains a history of timestamps and rect IDs to communicate |
25 // frame events back to Blink | 25 // frame events back to Blink |
26 // TODO(mpb): Start using this. crbug.com/442554 | 26 // TODO(mpb): Start using this. crbug.com/442554 |
27 class CC_EXPORT FrameTimingTracker { | 27 class CC_EXPORT FrameTimingTracker { |
28 public: | 28 public: |
29 struct CC_EXPORT CompositeTimingEvent { | 29 struct CC_EXPORT CompositeTimingEvent { |
30 CompositeTimingEvent(int, base::TimeTicks); | 30 CompositeTimingEvent(int, base::TimeTicks); |
31 ~CompositeTimingEvent(); | 31 ~CompositeTimingEvent(); |
32 | 32 |
33 int frame_id; | 33 int frame_id; |
34 base::TimeTicks timestamp; | 34 base::TimeTicks timestamp; |
35 }; | 35 }; |
36 | 36 |
37 using CompositeTimingSet = | 37 using CompositeTimingSet = |
38 base::hash_map<int64_t, std::vector<CompositeTimingEvent>>; | 38 std::unordered_map<int64_t, std::vector<CompositeTimingEvent>>; |
39 | 39 |
40 struct CC_EXPORT MainFrameTimingEvent { | 40 struct CC_EXPORT MainFrameTimingEvent { |
41 MainFrameTimingEvent(int frame_id, | 41 MainFrameTimingEvent(int frame_id, |
42 base::TimeTicks timestamp, | 42 base::TimeTicks timestamp, |
43 base::TimeTicks end_time); | 43 base::TimeTicks end_time); |
44 ~MainFrameTimingEvent(); | 44 ~MainFrameTimingEvent(); |
45 | 45 |
46 int frame_id; | 46 int frame_id; |
47 base::TimeTicks timestamp; | 47 base::TimeTicks timestamp; |
48 base::TimeTicks end_time; | 48 base::TimeTicks end_time; |
49 }; | 49 }; |
50 | 50 |
51 using MainFrameTimingSet = | 51 using MainFrameTimingSet = |
52 base::hash_map<int64_t, std::vector<MainFrameTimingEvent>>; | 52 std::unordered_map<int64_t, std::vector<MainFrameTimingEvent>>; |
53 | 53 |
54 static scoped_ptr<FrameTimingTracker> Create( | 54 static scoped_ptr<FrameTimingTracker> Create( |
55 LayerTreeHostImpl* layer_tree_host_impl); | 55 LayerTreeHostImpl* layer_tree_host_impl); |
56 | 56 |
57 ~FrameTimingTracker(); | 57 ~FrameTimingTracker(); |
58 | 58 |
59 // This routine takes all of the individual CompositeEvents stored in the | 59 // This routine takes all of the individual CompositeEvents stored in the |
60 // tracker and collects them by "rect_id", as in the example below. | 60 // tracker and collects them by "rect_id", as in the example below. |
61 // [ {f_id1,r_id1,t1}, {f_id2,r_id1,t2}, {f_id3,r_id2,t3} ] | 61 // [ {f_id1,r_id1,t1}, {f_id2,r_id1,t2}, {f_id3,r_id2,t3} ] |
62 // ====> | 62 // ====> |
(...skipping 26 matching lines...) Expand all Loading... |
89 | 89 |
90 LayerTreeHostImpl* layer_tree_host_impl_; | 90 LayerTreeHostImpl* layer_tree_host_impl_; |
91 DelayedUniqueNotifier post_events_notifier_; | 91 DelayedUniqueNotifier post_events_notifier_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(FrameTimingTracker); | 93 DISALLOW_COPY_AND_ASSIGN(FrameTimingTracker); |
94 }; | 94 }; |
95 | 95 |
96 } // namespace cc | 96 } // namespace cc |
97 | 97 |
98 #endif // CC_DEBUG_FRAME_TIMING_TRACKER_H_ | 98 #endif // CC_DEBUG_FRAME_TIMING_TRACKER_H_ |
OLD | NEW |