diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2014-11-10 17:34:54 -0800 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2014-11-10 17:34:54 -0800 |
commit | 6ef984af4b0c63c1c33127a12dcfc8e6359f0c9e (patch) | |
tree | d17c61ff9f3ae28224fbddac6d26bfc59e2cf755 /src/google/protobuf/extension_set.h | |
parent | baca1a8a1aa180c42de6278d3b8286c4496c6a10 (diff) | |
download | protobuf-6ef984af4b0c63c1c33127a12dcfc8e6359f0c9e.tar.gz protobuf-6ef984af4b0c63c1c33127a12dcfc8e6359f0c9e.tar.bz2 protobuf-6ef984af4b0c63c1c33127a12dcfc8e6359f0c9e.zip |
Down-integrate from internal code base.
Diffstat (limited to 'src/google/protobuf/extension_set.h')
-rw-r--r-- | src/google/protobuf/extension_set.h | 16 |
1 files changed, 13 insertions, 3 deletions
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<int, Extension> extensions_; - + ::google::protobuf::Arena* arena_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionSet); }; |