aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/message_lite.h
diff options
context:
space:
mode:
authorGravatar Feng Xiao <xfxyjwf@gmail.com>2014-11-10 17:34:54 -0800
committerGravatar Feng Xiao <xfxyjwf@gmail.com>2014-11-10 17:34:54 -0800
commit6ef984af4b0c63c1c33127a12dcfc8e6359f0c9e (patch)
treed17c61ff9f3ae28224fbddac6d26bfc59e2cf755 /src/google/protobuf/message_lite.h
parentbaca1a8a1aa180c42de6278d3b8286c4496c6a10 (diff)
Down-integrate from internal code base.
Diffstat (limited to 'src/google/protobuf/message_lite.h')
-rw-r--r--src/google/protobuf/message_lite.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h
index 027cabf9..106982cc 100644
--- a/src/google/protobuf/message_lite.h
+++ b/src/google/protobuf/message_lite.h
@@ -43,7 +43,7 @@
namespace google {
namespace protobuf {
-
+ class Arena;
namespace io {
class CodedInputStream;
class CodedOutputStream;
@@ -88,6 +88,27 @@ class LIBPROTOBUF_EXPORT MessageLite {
// caller.
virtual MessageLite* New() const = 0;
+ // Construct a new instance on the arena. Ownership is passed to the caller
+ // if arena is a NULL. Default implementation for backwards compatibility.
+ virtual MessageLite* New(::google::protobuf::Arena* arena) const;
+
+ // Get the arena, if any, associated with this message. Virtual method
+ // required for generic operations but most arena-related operations should
+ // use the GetArenaNoVirtual() generated-code method. Default implementation
+ // to reduce code size by avoiding the need for per-type implementations when
+ // types do not implement arena support.
+ virtual ::google::protobuf::Arena* GetArena() const { return NULL; }
+
+ // Get a pointer that may be equal to this message's arena, or may not be. If
+ // the value returned by this method is equal to some arena pointer, then this
+ // message is on that arena; however, if this message is on some arena, this
+ // method may or may not return that arena's pointer. As a tradeoff, this
+ // method may be more efficient than GetArena(). The intent is to allow
+ // underlying representations that use e.g. tagged pointers to sometimes store
+ // the arena pointer directly, and sometimes in a more indirect way, and allow
+ // a fastpath comparison against the arena pointer when it's easy to obtain.
+ virtual void* GetMaybeArenaPointer() const { return GetArena(); }
+
// Clear all fields of the message and set them to their default values.
// Clear() avoids freeing memory, assuming that any memory allocated
// to hold parts of the message will be needed again to hold the next