change MergeFrom_Internal to InternalMergeFrom

pull/7351/head
Jan Tattermusch 5 years ago
parent 3936114642
commit d7e2c8387a
  1. 2
      csharp/src/Google.Protobuf/Collections/MapField.cs
  2. 2
      csharp/src/Google.Protobuf/IBufferMessage.cs
  3. 6
      csharp/src/Google.Protobuf/ParsingPrimitivesMessages.cs

@ -692,7 +692,7 @@ namespace Google.Protobuf.Collections
}
[SecuritySafeCritical]
public void MergeFrom_Internal(ref ParseContext ctx)
public void InternalMergeFrom(ref ParseContext ctx)
{
// TODO(jtattermusch): deduplicate code
uint tag;

@ -43,7 +43,7 @@ namespace Google.Protobuf
/// Internal implementation of merging data from given parse context into this message.
/// Users should never invoke this method directly.
/// </summary>
void MergeFrom_Internal(ref ParseContext ctx);
void InternalMergeFrom(ref ParseContext ctx);
}
#endif
}

@ -168,19 +168,19 @@ namespace Google.Protobuf
{
if (message is IBufferMessage bufferMessage)
{
bufferMessage.MergeFrom_Internal(ref ctx);
bufferMessage.InternalMergeFrom(ref ctx);
}
else
{
// If we reached here, it means we've ran into a nested message with older generated code
// which doesn't provide the MergeFrom_Internal method that takes a ParseContext.
// which doesn't provide the InternalMergeFrom method that takes a ParseContext.
// With a slight performance overhead, we can still parse this message just fine,
// but we need to find the original CodedInputStream instance that initiated this
// parsing process and make sure its internal state is up to date.
// Note that this performance overhead is not very high (basically copying contents of a struct)
// and it will only be incurred in case the application mixes older and newer generated code.
// Regenerating the code from .proto files will remove this overhead because it will
// generate the MergeFrom_Internal method we need.
// generate the InternalMergeFrom method we need.
if (ctx.state.codedInputStream == null)
{

Loading…
Cancel
Save