| Index: net/traffic_annotation/network_traffic_annotation.h
|
| diff --git a/net/traffic_annotation/network_traffic_annotation.h b/net/traffic_annotation/network_traffic_annotation.h
|
| index 989f4f348300272732063cee88ea1da2ed9c8b6f..1b074e94b85774208fbd26f8faa10f3e3c103b5f 100644
|
| --- a/net/traffic_annotation/network_traffic_annotation.h
|
| +++ b/net/traffic_annotation/network_traffic_annotation.h
|
| @@ -8,7 +8,14 @@
|
| namespace net {
|
|
|
| // Defined type for network traffic annotation tags.
|
| +#if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON)
|
| +struct NetworkTrafficAnnotationTag {
|
| + const char* const unique_id;
|
| + const char* const proto;
|
| +};
|
| +#else
|
| using NetworkTrafficAnnotationTag = const char* const;
|
| +#endif
|
|
|
| // Function to convert a network traffic annotation's unique id and protobuf
|
| // text into a NetworkTrafficAnnotationTag.
|
| @@ -26,11 +33,15 @@ using NetworkTrafficAnnotationTag = const char* const;
|
| // //tools/traffic_annotation/sample_traffic_annotation.cc.
|
| // TODO(crbug.com/690323): Add tools to check annotation text's format during
|
| // presubmit checks.
|
| -template <size_t N1, size_t N2>
|
| +template <unsigned N1, unsigned N2>
|
| constexpr NetworkTrafficAnnotationTag DefineNetworkTrafficAnnotation(
|
| const char (&unique_id)[N1],
|
| const char (&proto)[N2]) {
|
| +#if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON)
|
| + return NetworkTrafficAnnotationTag({unique_id, proto});
|
| +#else
|
| return unique_id;
|
| +#endif
|
| }
|
|
|
| } // namespace net
|
| @@ -39,4 +50,7 @@ constexpr NetworkTrafficAnnotationTag DefineNetworkTrafficAnnotation(
|
| #define NO_TRAFFIC_ANNOTATION_YET \
|
| net::DefineNetworkTrafficAnnotation("Undefined", "Nothing here yet.")
|
|
|
| +#define MISSING_TRAFFIC_ANNOTATION \
|
| + net::DefineNetworkTrafficAnnotation( \
|
| + "Missing", "Function called without traffic annotation.")
|
| #endif // NET_TRAFFIC_ANNOTATION_NETWORK_TRAFFIC_ANNOTATION_H_
|
|
|