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

Unified Diff: net/traffic_annotation/network_traffic_annotation.h

Issue 2893233002: Network traffic annotation added to URLLoaderImpl. (Closed)
Patch Set: Mutable network traffic annotation added. 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 side-by-side diff with in-line comments
Download patch
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..883ec986bd1390133d70989a17943a4202a541f5 100644
--- a/net/traffic_annotation/network_traffic_annotation.h
+++ b/net/traffic_annotation/network_traffic_annotation.h
@@ -194,6 +194,55 @@ 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) {}
+ MutableNetworkTrafficAnnotationTag(
battre 2017/06/01 12:36:36 explicit MutableNetworkTrafficAnnotationTag same
Ramin Halavati 2017/06/01 13:14:27 Done.
+ const NetworkTrafficAnnotationTag& traffic_annotation)
+ : unique_id_hash_code(traffic_annotation.unique_id_hash_code) {}
+ int32_t unique_id_hash_code = TRAFFIC_ANNOTATION_UNINITIALIZED;
battre 2017/06/01 12:36:36 isn't this default value duplicative given the con
Ramin Halavati 2017/06/01 13:14:27 Done.
+
+ explicit operator NetworkTrafficAnnotationTag() const {
+ return NetworkTrafficAnnotationTag({unique_id_hash_code});
+ }
+};
+
+struct MutablePartialNetworkTrafficAnnotationTag {
+#if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON)
+ MutablePartialNetworkTrafficAnnotationTag()
+ : unique_id_hash_code(TRAFFIC_ANNOTATION_UNINITIALIZED),
+ completing_id_hash_code(TRAFFIC_ANNOTATION_UNINITIALIZED) {}
+ 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 = TRAFFIC_ANNOTATION_UNINITIALIZED;
+ int32_t completing_id_hash_code = TRAFFIC_ANNOTATION_UNINITIALIZED;
+
+ explicit operator PartialNetworkTrafficAnnotationTag() const {
+ return PartialNetworkTrafficAnnotationTag(
+ {unique_id_hash_code, completing_id_hash_code});
+ }
+#else
+ MutablePartialNetworkTrafficAnnotationTag()
+ : unique_id_hash_code(TRAFFIC_ANNOTATION_UNINITIALIZED) {}
+ MutablePartialNetworkTrafficAnnotationTag(
+ const PartialNetworkTrafficAnnotationTag& partial_traffic_annotation)
+ : unique_id_hash_code(partial_traffic_annotation.unique_id_hash_code) {}
+ int32_t unique_id_hash_code = TRAFFIC_ANNOTATION_UNINITIALIZED;
+
+ explicit operator PartialNetworkTrafficAnnotationTag() const {
+ return PartialNetworkTrafficAnnotationTag({unique_id_hash_code});
+ }
+#endif // defined(_DEBUG) || defined(DCHECK_ALWAYS_ON)
+};
+
} // namespace net
// Placeholder for unannotated usages.
« content/common/url_loader_factory.mojom ('K') | « content/network/url_loader_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698