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 /python/google/protobuf/pyext/extension_dict.h | |
parent | baca1a8a1aa180c42de6278d3b8286c4496c6a10 (diff) | |
download | protobuf-javalite-6ef984af4b0c63c1c33127a12dcfc8e6359f0c9e.tar.gz |
Down-integrate from internal code base.
Diffstat (limited to 'python/google/protobuf/pyext/extension_dict.h')
-rw-r--r-- | python/google/protobuf/pyext/extension_dict.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/python/google/protobuf/pyext/extension_dict.h b/python/google/protobuf/pyext/extension_dict.h index 13c874a4..47625e23 100644 --- a/python/google/protobuf/pyext/extension_dict.h +++ b/python/google/protobuf/pyext/extension_dict.h @@ -53,13 +53,26 @@ using internal::shared_ptr; namespace python { struct CMessage; -struct CFieldDescriptor; typedef struct ExtensionDict { PyObject_HEAD; + + // This is the top-level C++ Message object that owns the whole + // proto tree. Every Python container class holds a + // reference to it in order to keep it alive as long as there's a + // Python object that references any part of the tree. shared_ptr<Message> owner; + + // Weak reference to parent message. Used to make sure + // the parent is writable when an extension field is modified. CMessage* parent; + + // Pointer to the C++ Message that this ExtensionDict extends. + // Not owned by us. Message* message; + + // A dict of child messages, indexed by Extension descriptors. + // Similar to CMessage::composite_fields. PyObject* values; } ExtensionDict; @@ -67,11 +80,8 @@ extern PyTypeObject ExtensionDict_Type; namespace extension_dict { -// Gets the _cdescriptor reference to a CFieldDescriptor object given a -// python descriptor object. -// -// Returns a new reference. -CFieldDescriptor* InternalGetCDescriptorFromExtension(PyObject* extension); +// Builds an Extensions dict for a specific message. +ExtensionDict* NewExtensionDict(CMessage *parent); // Gets the number of extension values in this ExtensionDict as a python object. // |