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

Unified Diff: components/tracing/core/proto_utils.h

Issue 2134683002: tracing v2: Add base class for zero-copy protobuf (ProtoZero) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@proto_utils
Patch Set: add comments Created 4 years, 5 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: components/tracing/core/proto_utils.h
diff --git a/components/tracing/core/proto_utils.h b/components/tracing/core/proto_utils.h
index 59b147db42faa88bc6acb71f57acd1b98cfce676..cd8d6e82342d1a0251775287f4acaa9797e77120 100644
--- a/components/tracing/core/proto_utils.h
+++ b/components/tracing/core/proto_utils.h
@@ -26,6 +26,10 @@ enum : uint32_t {
kFieldTypeFixed32 = 5,
};
+// Maximum message size supported: 256 MiB (4 x 7-bit due to varint encoding).
+constexpr size_t kMessageLengthFieldSize = 4;
+constexpr size_t kMaxMessageLength = 1u << (kMessageLengthFieldSize * 7);
alph 2016/07/12 00:20:42 -1 to be precise.
Primiano Tucci (use gerrit) 2016/07/12 10:15:32 oh good catch. Done.
+
// Returns the number of bytes sufficient to encode the largest
// |int_size_in_bits|-bits integer using a non-redundant varint encoding.
template <typename T>

Powered by Google App Engine
This is Rietveld 408576698