From 6ef984af4b0c63c1c33127a12dcfc8e6359f0c9e Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Mon, 10 Nov 2014 17:34:54 -0800 Subject: Down-integrate from internal code base. --- src/google/protobuf/extension_set.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/google/protobuf/extension_set.h') diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h index d6fc45df..6d6702b3 100644 --- a/src/google/protobuf/extension_set.h +++ b/src/google/protobuf/extension_set.h @@ -51,6 +51,7 @@ namespace google { namespace protobuf { + class Arena; class Descriptor; // descriptor.h class FieldDescriptor; // descriptor.h class DescriptorPool; // descriptor.h @@ -157,6 +158,7 @@ class MessageSetFieldSkipper; class LIBPROTOBUF_EXPORT ExtensionSet { public: ExtensionSet(); + explicit ExtensionSet(::google::protobuf::Arena* arena); ~ExtensionSet(); // These are called at startup by protocol-compiler-generated code to @@ -261,9 +263,13 @@ class LIBPROTOBUF_EXPORT ExtensionSet { const FieldDescriptor* descriptor, MessageLite* message); MessageLite* ReleaseMessage(int number, const MessageLite& prototype); + MessageLite* UnsafeArenaReleaseMessage( + int number, const MessageLite& prototype); + MessageLite* ReleaseMessage(const FieldDescriptor* descriptor, MessageFactory* factory); #undef desc + ::google::protobuf::Arena* GetArenaNoVirtual() const { return arena_; } // repeated fields ------------------------------------------------- @@ -421,12 +427,14 @@ class LIBPROTOBUF_EXPORT ExtensionSet { LazyMessageExtension() {} virtual ~LazyMessageExtension() {} - virtual LazyMessageExtension* New() const = 0; + virtual LazyMessageExtension* New(::google::protobuf::Arena* arena) const = 0; virtual const MessageLite& GetMessage( const MessageLite& prototype) const = 0; virtual MessageLite* MutableMessage(const MessageLite& prototype) = 0; virtual void SetAllocatedMessage(MessageLite *message) = 0; virtual MessageLite* ReleaseMessage(const MessageLite& prototype) = 0; + virtual MessageLite* UnsafeArenaReleaseMessage( + const MessageLite& prototype) = 0; virtual bool IsInitialized() const = 0; virtual int ByteSize() const = 0; @@ -524,6 +532,9 @@ class LIBPROTOBUF_EXPORT ExtensionSet { }; + // Merges existing Extension from other_extension + void InternalExtensionMergeFrom(int number, const Extension& other_extension); + // Returns true and fills field_number and extension if extension is found. // Note to support packed repeated field compatibility, it also fills whether // the tag on wire is packed, which can be different from @@ -569,7 +580,6 @@ class LIBPROTOBUF_EXPORT ExtensionSet { ExtensionFinder* extension_finder, MessageSetFieldSkipper* field_skipper); - // Hack: RepeatedPtrFieldBase declares ExtensionSet as a friend. This // friendship should automatically extend to ExtensionSet::Extension, but // unfortunately some older compilers (e.g. GCC 3.4.4) do not implement this @@ -587,7 +597,7 @@ class LIBPROTOBUF_EXPORT ExtensionSet { // for 100 elements or more. Also, we want AppendToList() to order fields // by field number. std::map extensions_; - + ::google::protobuf::Arena* arena_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionSet); }; -- cgit v1.2.3