aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/message.h
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2017-03-29 14:32:48 -0700
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2017-03-29 14:33:05 -0700
commitd36c0c538a545fac5d9db6ba65c525246d4efa95 (patch)
tree3fd29af0f137dfaf5df892723e60600f674392b3 /src/google/protobuf/message.h
parent4a0dd03e52e09332c8fd0f8f26a8e0ae9f911182 (diff)
Down-integrate from google3.
Diffstat (limited to 'src/google/protobuf/message.h')
-rw-r--r--src/google/protobuf/message.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h
index 4d14584d..7d9bb8a9 100644
--- a/src/google/protobuf/message.h
+++ b/src/google/protobuf/message.h
@@ -245,7 +245,9 @@ class LIBPROTOBUF_EXPORT Message : public MessageLite {
// using reflection (rather than the generated code implementation for
// ByteSize()). Like ByteSize(), its CPU time is linear in the number of
// fields defined for the proto.
- virtual int SpaceUsed() const;
+ virtual size_t SpaceUsedLong() const;
+
+ int SpaceUsed() const { return internal::ToIntSize(SpaceUsedLong()); }
// Debugging & Testing----------------------------------------------
@@ -417,7 +419,11 @@ class LIBPROTOBUF_EXPORT Reflection {
virtual UnknownFieldSet* MutableUnknownFields(Message* message) const = 0;
// Estimate the amount of memory used by the message object.
- virtual int SpaceUsed(const Message& message) const = 0;
+ virtual size_t SpaceUsedLong(const Message& message) const = 0;
+
+ int SpaceUsed(const Message& message) const {
+ return internal::ToIntSize(SpaceUsedLong(message));
+ }
// Check if the given non-repeated field is set.
virtual bool HasField(const Message& message,