Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: ui/latency/mojo/latency_info_struct_traits.h

Issue 2856623002: Adding static asserts to LatencyInfo struct traits. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 UI_LATENCY_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_ 5 #ifndef UI_LATENCY_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_
6 #define UI_LATENCY_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_ 6 #define UI_LATENCY_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_
7 7
8 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" 8 #include "ui/gfx/geometry/mojo/geometry_struct_traits.h"
9 #include "ui/latency/latency_info.h" 9 #include "ui/latency/latency_info.h"
10 #include "ui/latency/mojo/latency_info.mojom-shared.h" 10 #include "ui/latency/mojo/latency_info.mojom-shared.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 13
14 static_assert(
15 static_cast<int>(
16 ui::mojom::LatencyComponentType::LATENCY_COMPONENT_TYPE_LAST) ==
17 static_cast<int>(ui::LATENCY_COMPONENT_TYPE_LAST),
18 "Enum size mismatch");
19
20 static_assert(
21 static_cast<int>(ui::mojom::SourceEventType::SOURCE_EVENT_TYPE_LAST) ==
22 static_cast<int>(ui::SOURCE_EVENT_TYPE_LAST),
23 "Enum size mismatch");
24
14 template <> 25 template <>
15 struct ArrayTraits<ui::LatencyInfo::LatencyMap> { 26 struct ArrayTraits<ui::LatencyInfo::LatencyMap> {
16 using Element = ui::LatencyInfo::LatencyMap::value_type; 27 using Element = ui::LatencyInfo::LatencyMap::value_type;
17 using Iterator = ui::LatencyInfo::LatencyMap::iterator; 28 using Iterator = ui::LatencyInfo::LatencyMap::iterator;
18 using ConstIterator = ui::LatencyInfo::LatencyMap::const_iterator; 29 using ConstIterator = ui::LatencyInfo::LatencyMap::const_iterator;
19 30
20 static ConstIterator GetBegin(const ui::LatencyInfo::LatencyMap& input) { 31 static ConstIterator GetBegin(const ui::LatencyInfo::LatencyMap& input) {
21 return input.begin(); 32 return input.begin();
22 } 33 }
23 static Iterator GetBegin(ui::LatencyInfo::LatencyMap& input) { 34 static Iterator GetBegin(ui::LatencyInfo::LatencyMap& input) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 static bool coalesced(const ui::LatencyInfo& info); 98 static bool coalesced(const ui::LatencyInfo& info);
88 static bool terminated(const ui::LatencyInfo& info); 99 static bool terminated(const ui::LatencyInfo& info);
89 static ui::mojom::SourceEventType source_event_type( 100 static ui::mojom::SourceEventType source_event_type(
90 const ui::LatencyInfo& info); 101 const ui::LatencyInfo& info);
91 static bool Read(ui::mojom::LatencyInfoDataView data, ui::LatencyInfo* out); 102 static bool Read(ui::mojom::LatencyInfoDataView data, ui::LatencyInfo* out);
92 }; 103 };
93 104
94 } // namespace mojo 105 } // namespace mojo
95 106
96 #endif // UI_LATENCY_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_ 107 #endif // UI_LATENCY_MOJO_LATENCY_INFO_STRUCT_TRAITS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698