| 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 UI_EVENTS_LATENCY_INFO_H_ | 5 #ifndef UI_EVENTS_LATENCY_INFO_H_ |
| 6 #define UI_EVENTS_LATENCY_INFO_H_ | 6 #define UI_EVENTS_LATENCY_INFO_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 // Map a Latency Component (with a component-specific int64 id) to a | 118 // Map a Latency Component (with a component-specific int64 id) to a |
| 119 // component info. | 119 // component info. |
| 120 typedef base::SmallMap< | 120 typedef base::SmallMap< |
| 121 std::map<std::pair<LatencyComponentType, int64>, LatencyComponent>, | 121 std::map<std::pair<LatencyComponentType, int64>, LatencyComponent>, |
| 122 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; | 122 kTypicalMaxComponentsPerLatencyInfo> LatencyMap; |
| 123 | 123 |
| 124 LatencyInfo(); | 124 LatencyInfo(); |
| 125 ~LatencyInfo(); | 125 ~LatencyInfo(); |
| 126 | 126 |
| 127 // For test only. |
| 128 LatencyInfo(int64 trace_id, bool terminated); |
| 129 |
| 127 // Returns true if the vector |latency_info| is valid. Returns false | 130 // Returns true if the vector |latency_info| is valid. Returns false |
| 128 // if it is not valid and log the |referring_msg|. | 131 // if it is not valid and log the |referring_msg|. |
| 129 // This function is mainly used to check the latency_info vector that | 132 // This function is mainly used to check the latency_info vector that |
| 130 // is passed between processes using IPC message has reasonable size | 133 // is passed between processes using IPC message has reasonable size |
| 131 // so that we are confident the IPC message is not corrupted/compromised. | 134 // so that we are confident the IPC message is not corrupted/compromised. |
| 132 // This check will go away once the IPC system has better built-in scheme | 135 // This check will go away once the IPC system has better built-in scheme |
| 133 // for corruption/compromise detection. | 136 // for corruption/compromise detection. |
| 134 static bool Verify(const std::vector<LatencyInfo>& latency_info, | 137 static bool Verify(const std::vector<LatencyInfo>& latency_info, |
| 135 const char* referring_msg); | 138 const char* referring_msg); |
| 136 | 139 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // Whether a terminal component has been added. | 213 // Whether a terminal component has been added. |
| 211 bool terminated_; | 214 bool terminated_; |
| 212 | 215 |
| 213 FRIEND_TEST_ALL_PREFIXES(LatencyInfoParamTraitsTest, Basic); | 216 FRIEND_TEST_ALL_PREFIXES(LatencyInfoParamTraitsTest, Basic); |
| 214 friend struct IPC::ParamTraits<ui::LatencyInfo>; | 217 friend struct IPC::ParamTraits<ui::LatencyInfo>; |
| 215 }; | 218 }; |
| 216 | 219 |
| 217 } // namespace ui | 220 } // namespace ui |
| 218 | 221 |
| 219 #endif // UI_EVENTS_LATENCY_INFO_H_ | 222 #endif // UI_EVENTS_LATENCY_INFO_H_ |
| OLD | NEW |