diff options
author | Mathias Agopian <mathias@google.com> | 2013-07-29 21:24:40 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2013-07-30 21:19:13 -0700 |
commit | e142428a9c8b9d2380032cd4d7b55ee440fe8770 (patch) | |
tree | 7c55a190ef023bc7aba348d040211901448c13d3 /include/gui | |
parent | 1d76781b7aa19611c4045fdf6b848af6c6094e0b (diff) | |
download | frameworks_native-e142428a9c8b9d2380032cd4d7b55ee440fe8770.zip frameworks_native-e142428a9c8b9d2380032cd4d7b55ee440fe8770.tar.gz frameworks_native-e142428a9c8b9d2380032cd4d7b55ee440fe8770.tar.bz2 |
Make Flattenable not virtual
Fallout from the Flattenable change, update all its uses.
Additionnaly, fix/tighten size checks when (un)flatten()ing
things.
Removed the assumption by some flattenables (e.g.: Fence)
that the size passed to them would be exact (it can
and will be larger in some cases)
The code in Parcel is a bit complicated so that we don't
have to expose the full implementation (and also to
keep the code smallish).
Change-Id: I0bf1c8aca2a3128491b4f45510bc46667e566dde
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/IGraphicBufferProducer.h | 15 | ||||
-rw-r--r-- | include/gui/Sensor.h | 4 |
2 files changed, 9 insertions, 10 deletions
diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h index 9677962..033c727 100644 --- a/include/gui/IGraphicBufferProducer.h +++ b/include/gui/IGraphicBufferProducer.h @@ -105,7 +105,8 @@ public: // and height of the window and current transform applied to buffers, // respectively. - struct QueueBufferInput : public Flattenable { + struct QueueBufferInput : public Flattenable<QueueBufferInput> { + friend class Flattenable<QueueBufferInput>; inline QueueBufferInput(const Parcel& parcel); inline QueueBufferInput(int64_t timestamp, const Rect& crop, int scalingMode, uint32_t transform, bool async, @@ -123,13 +124,11 @@ public: *outFence = fence; } - // Flattenable interface - virtual size_t getFlattenedSize() const; - virtual size_t getFdCount() const; - virtual status_t flatten(void* buffer, size_t size, - int fds[], size_t count) const; - virtual status_t unflatten(void const* buffer, size_t size, - int fds[], size_t count); + // Flattenable protocol + size_t getFlattenedSize() const; + size_t getFdCount() const; + status_t flatten(void*& buffer, size_t& size, int*& fds, size_t& count) const; + status_t unflatten(void const*& buffer, size_t& size, int const*& fds, size_t& count); private: int64_t timestamp; diff --git a/include/gui/Sensor.h b/include/gui/Sensor.h index 2af2307..9197372 100644 --- a/include/gui/Sensor.h +++ b/include/gui/Sensor.h @@ -70,8 +70,8 @@ public: // LightFlattenable protocol inline bool isFixedSize() const { return false; } - size_t getSize() const; - status_t flatten(void* buffer) const; + size_t getFlattenedSize() const; + status_t flatten(void* buffer, size_t size) const; status_t unflatten(void const* buffer, size_t size); private: |