Reads a value from the input stream and stores it. Always inlining gave a ~50% speedup on microbenchmarks at one point. TODO(nix): try removing it to see if that still holds. TODO(jsimsa): ABSL_ATTRIBUTE_ALWAYS_INLINE
| 488 | // TODO(nix): try removing it to see if that still holds. |
| 489 | // TODO(jsimsa): ABSL_ATTRIBUTE_ALWAYS_INLINE |
| 490 | Status ReadValue(CodedInputStream* input, const FieldInfo& field) { |
| 491 | // For required and optional fields, we overwrite values[0] with |
| 492 | // the latest one in the wire stream. |
| 493 | // See https://developers.google.com/protocol-buffers/docs/encoding#optional |
| 494 | // Only for repeated fields do we advance the next_repeat_index_ past 1. |
| 495 | // TODO(nix): to handle oneof we must also zero out any previous values |
| 496 | // seen on the wire. |
| 497 | int32 index = 0; |
| 498 | if (field.is_repeated) { |
| 499 | index = next_repeat_index_; |
| 500 | } |
| 501 | next_repeat_index_ = index + 1; |
| 502 | |
| 503 | return internal::ReadValue(input, field.type, field.number, |
| 504 | default_value_.dtype, index, datap_); |
| 505 | } |
| 506 | |
| 507 | // Reads and stores a length-delimited list of values. |
| 508 | Status ReadPackedValues(CodedInputStream* input, const FieldInfo& field, |
nothing calls this directly
no test coverage detected