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

Side by Side Diff: mojo/public/cpp/bindings/interface_traits.h

Issue 2594203002: [mojo] Expose interface method min_versions (Closed)
Patch Set: Created 4 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_TRAITS_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_TRAITS_H_
7
8 #include <stdint.h>
9
10 #include <string>
11
12 namespace mojo {
13
14 // Metadata information for each method in an interface.
15 struct MethodMetadata {
16 uint32_t min_version;
yzshen1 2016/12/22 18:53:28 At the moment, it seems that min_version is what i
17 uint32_t ordinal;
18 const char* name;
19 };
20
21 // Exposes metadata about a method. MethodIndex should be one of the
22 // kMethodNameMethodIndex constants in Interface::kMethodIndices.
23 template <typename Interface, uint32_t MethodIndex>
24 struct MethodTraits {
25 static uint32_t MinVersion() {
26 return Interface::kMethodMetadata[MethodIndex].min_version;
27 }
28
29 static const char* Name() {
30 return Interface::kMethodMetadata[MethodIndex].name;
31 }
32
33 static uint32_t Ordinal() {
34 return Interface::kMethodMetadata[MethodIndex].ordinal;
35 }
36
37 static_assert(MethodIndex < Interface::kMethodMetadataSize,
38 "Invalid method index");
39 };
40
41 } // namespace mojo
42
43 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698