diff options
author | Juan Silveira <jjso@google.com> | 2014-06-17 15:01:22 +0100 |
---|---|---|
committer | Juan Silveira <jjso@google.com> | 2014-07-14 16:54:28 +0100 |
commit | cf1b416ae1327a26dd53a691fc1b3e30eec8e6a6 (patch) | |
tree | ccea2bfb1ab3fbb41e34fb907af20e7544f21c0c /m4/ltoptions.m4 | |
parent | 94f522f907e3f34f70d9e7816b947e62fddbb267 (diff) | |
download | external_protobuf-cf1b416ae1327a26dd53a691fc1b3e30eec8e6a6.zip external_protobuf-cf1b416ae1327a26dd53a691fc1b3e30eec8e6a6.tar.gz external_protobuf-cf1b416ae1327a26dd53a691fc1b3e30eec8e6a6.tar.bz2 |
Keep pointers to extension values.
The current implementation of getExtension deserialises the field from bytes
and returns a new object every time. This means that changes to those objects
are reflected when the messages is serialised unless setExtension is called. It
also means that every call to getExtension and setExtension is expensive.
This change introduces a FieldData class that contains everything that's known
about the field at the time. This can be all the tag/byte[] pairs associated
with a given field or an Extension and a value object. This is so that two
messages with a repeated extension can be compared even if the extension
has been deserialised in one of them but not the other.
This change also adds FieldArray class based on SparseArray from the Android
compatibility library. This is used in ExtendableMessageNano to make lookup
of FieldDatas by their field number faster.
Implications:
* calling getExtension multiple times deserialises the field only once and
returns the same object.
* calling setExtension doesn't cause the object to be serialised immediately,
that only happens when the container message is serialised.
* getExtension is no longer a read-only thread-safe operation. README.txt has
been updated to relfect that.
* comparison using equals and hashCode continues to work.
Bug: 10863158
Change-Id: I81c7cb0c73cc0611a1f7c1eabf5eed259738e8bc
Diffstat (limited to 'm4/ltoptions.m4')
0 files changed, 0 insertions, 0 deletions