| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/tracing/core/proto_zero_message.h" | 5 #include "components/tracing/core/proto_zero_message.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "components/tracing/core/proto_zero_message_handle.h" | 9 #include "components/tracing/core/proto_zero_message_handle.h" |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 EndNestedMessage(); | 75 EndNestedMessage(); |
| 76 | 76 |
| 77 if (size_field_.is_valid()) { | 77 if (size_field_.is_valid()) { |
| 78 // Write the length of the nested message a posteriori, using a leading-zero | 78 // Write the length of the nested message a posteriori, using a leading-zero |
| 79 // redundant varint encoding. | 79 // redundant varint encoding. |
| 80 #if DCHECK_IS_ON() | 80 #if DCHECK_IS_ON() |
| 81 DCHECK(!sealed_); | 81 DCHECK(!sealed_); |
| 82 #endif | 82 #endif |
| 83 DCHECK_LT(size_, proto::kMaxMessageLength); | 83 DCHECK_LT(size_, proto::kMaxMessageLength); |
| 84 DCHECK_EQ(proto::kMessageLengthFieldSize, size_field_.size()); | 84 DCHECK_EQ(proto::kMessageLengthFieldSize, size_field_.size()); |
| 85 proto::WriteRedundantLength( | 85 proto::WriteRedundantVarInt( |
| 86 static_cast<uint32_t>(size_ - size_already_written_), | 86 static_cast<uint32_t>(size_ - size_already_written_), |
| 87 size_field_.begin); | 87 size_field_.begin); |
| 88 size_field_.reset(); | 88 size_field_.reset(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 #if DCHECK_IS_ON() | 91 #if DCHECK_IS_ON() |
| 92 sealed_ = true; | 92 sealed_ = true; |
| 93 if (handle_) | 93 if (handle_) |
| 94 handle_->reset_message(); | 94 handle_->reset_message(); |
| 95 #endif | 95 #endif |
| (...skipping 24 matching lines...) Expand all Loading... |
| 120 nested_message_ = message; | 120 nested_message_ = message; |
| 121 } | 121 } |
| 122 | 122 |
| 123 void ProtoZeroMessage::EndNestedMessage() { | 123 void ProtoZeroMessage::EndNestedMessage() { |
| 124 size_ += nested_message_->Finalize(); | 124 size_ += nested_message_->Finalize(); |
| 125 nested_message_ = nullptr; | 125 nested_message_ = nullptr; |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace v2 | 128 } // namespace v2 |
| 129 } // namespace tracing | 129 } // namespace tracing |
| OLD | NEW |