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

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

Issue 2271653004: Reland of tracing v2: Introduce TraceBufferWriter (https://codereview.chromium.org/2196663002) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix undefined behavior of move ctor that caused revert on Win Created 4 years, 4 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.cc ('k') | components/tracing/core/scattered_stream_writer.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_handle.cc
diff --git a/components/tracing/core/proto_zero_message_handle.cc b/components/tracing/core/proto_zero_message_handle.cc
index 1906cf24721cb00d4b291963c8c3f5f3f2d3992d..b40f135fe3241fc90ad7e1e6c5f5d855bd864a70 100644
--- a/components/tracing/core/proto_zero_message_handle.cc
+++ b/components/tracing/core/proto_zero_message_handle.cc
@@ -42,15 +42,15 @@ ProtoZeroMessageHandleBase::ProtoZeroMessageHandleBase(
ProtoZeroMessageHandleBase& ProtoZeroMessageHandleBase::operator=(
ProtoZeroMessageHandleBase&& other) {
+ // If the current handle was pointing to a message and is being reset to a new
+ // one, finalize the old message.
+ FinalizeMessageIfSet(message_);
+
Move(&other);
return *this;
}
void ProtoZeroMessageHandleBase::Move(ProtoZeroMessageHandleBase* other) {
- // If the current handle was pointing to a message and is being reset to a new
- // one, finalize the old message.
- FinalizeMessageIfSet(message_);
-
// In theory other->message_ could be nullptr, if |other| is a handle that has
// been std::move-d (and hence empty). There isn't a legitimate use case for
// doing so, though. Therefore this case is deliberately ignored (if hit, it
« no previous file with comments | « components/tracing/core/proto_zero_message.cc ('k') | components/tracing/core/scattered_stream_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698