Chromium Code Reviews| 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 69c620655806300d8974997acace2b0578d64630..84f05b9283429da3a8b9887b32ddc1f7e4fb54cc 100644 |
| --- a/net/traffic_annotation/network_traffic_annotation.h |
| +++ b/net/traffic_annotation/network_traffic_annotation.h |
| @@ -194,6 +194,58 @@ NetworkTrafficAnnotationTag BranchedCompleteNetworkTrafficAnnotation( |
| // } |
| // } |
| +#define TRAFFIC_ANNOTATION_UNINITIALIZED -1 |
| + |
| +// Do not use this unless net-serialization is required. |
| +// TODO(crbug.com/690323): Add tools to check constructor of this structure is |
| +// used only in .mojom.cc files. |
| +struct MutableNetworkTrafficAnnotationTag { |
| + MutableNetworkTrafficAnnotationTag() |
| + : unique_id_hash_code(TRAFFIC_ANNOTATION_UNINITIALIZED) {} |
| + explicit MutableNetworkTrafficAnnotationTag( |
| + const NetworkTrafficAnnotationTag& traffic_annotation) |
| + : unique_id_hash_code(traffic_annotation.unique_id_hash_code) {} |
| + |
| + int32_t unique_id_hash_code; |
| + |
| + explicit operator NetworkTrafficAnnotationTag() const { |
| + return NetworkTrafficAnnotationTag({unique_id_hash_code}); |
| + } |
| +}; |
| + |
| +struct MutablePartialNetworkTrafficAnnotationTag { |
| +#if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) |
|
jochen (gone - plz use gerrit)
2017/06/08 17:00:58
why _DEBUG?
Ramin Halavati
2017/06/09 07:08:53
Replaced it with '#ifndef NDEBUG' for all cases.
|
| + MutablePartialNetworkTrafficAnnotationTag() |
| + : unique_id_hash_code(TRAFFIC_ANNOTATION_UNINITIALIZED), |
| + completing_id_hash_code(TRAFFIC_ANNOTATION_UNINITIALIZED) {} |
| + explicit MutablePartialNetworkTrafficAnnotationTag( |
| + const PartialNetworkTrafficAnnotationTag& partial_traffic_annotation) |
| + : unique_id_hash_code(partial_traffic_annotation.unique_id_hash_code), |
| + completing_id_hash_code( |
| + partial_traffic_annotation.completing_id_hash_code) {} |
| + |
| + int32_t unique_id_hash_code; |
| + int32_t completing_id_hash_code; |
| + |
| + explicit operator PartialNetworkTrafficAnnotationTag() const { |
| + return PartialNetworkTrafficAnnotationTag( |
| + {unique_id_hash_code, completing_id_hash_code}); |
| + } |
| +#else |
| + MutablePartialNetworkTrafficAnnotationTag() |
| + : unique_id_hash_code(TRAFFIC_ANNOTATION_UNINITIALIZED) {} |
| + explicit MutablePartialNetworkTrafficAnnotationTag( |
| + const PartialNetworkTrafficAnnotationTag& partial_traffic_annotation) |
| + : unique_id_hash_code(partial_traffic_annotation.unique_id_hash_code) {} |
| + |
| + int32_t unique_id_hash_code; |
| + |
| + explicit operator PartialNetworkTrafficAnnotationTag() const { |
| + return PartialNetworkTrafficAnnotationTag({unique_id_hash_code}); |
| + } |
| +#endif // defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) |
| +}; |
| + |
| } // namespace net |
| // Placeholder for unannotated usages. |