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

Unified Diff: components/tracing/core/proto_zero_message.cc

Issue 2158323005: tracing v2: Introduce handles for safe usage of ProtoZeroMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final nits 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
« no previous file with comments | « components/tracing/core/proto_zero_message.h ('k') | components/tracing/core/proto_zero_message_handle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/tracing/core/proto_zero_message.cc
diff --git a/components/tracing/core/proto_zero_message.cc b/components/tracing/core/proto_zero_message.cc
index b7152304204742f0a71e43e38b0c3c051a81c75a..f4e63df5102a3d47f80925b7a66619f6e256d637 100644
--- a/components/tracing/core/proto_zero_message.cc
+++ b/components/tracing/core/proto_zero_message.cc
@@ -7,6 +7,7 @@
#include <string.h>
#include "components/tracing/core/proto_utils.h"
+#include "components/tracing/core/proto_zero_message_handle.h"
#if !defined(ARCH_CPU_LITTLE_ENDIAN)
// The memcpy() for float and double below needs to be adjusted if we want to
@@ -44,6 +45,7 @@ void ProtoZeroMessage::Reset(ScatteredStreamWriter* stream_writer) {
nesting_depth_ = 0;
#if DCHECK_IS_ON()
sealed_ = false;
+ handle_ = nullptr;
#endif
}
@@ -128,6 +130,8 @@ size_t ProtoZeroMessage::Finalize() {
#if DCHECK_IS_ON()
sealed_ = true;
+ if (handle_)
+ handle_->reset_message();
#endif
return size_;
« no previous file with comments | « components/tracing/core/proto_zero_message.h ('k') | components/tracing/core/proto_zero_message_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698