summaryrefslogtreecommitdiffstats
path: root/include/gui/Sensor.h
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-08-12 19:37:16 -0700
committerMathias Agopian <mathias@google.com>2012-08-13 02:46:05 -0700
commit8683fca395d01734ec7946e9f0595ec5d7b754c6 (patch)
treefe3f6b92245be46902760c129e395c94589b9895 /include/gui/Sensor.h
parente57f292595bec48f65c8088b00ff6beea01217e9 (diff)
downloadframeworks_native-8683fca395d01734ec7946e9f0595ec5d7b754c6.zip
frameworks_native-8683fca395d01734ec7946e9f0595ec5d7b754c6.tar.gz
frameworks_native-8683fca395d01734ec7946e9f0595ec5d7b754c6.tar.bz2
improve [un]marshalling of non-binder objects
this change introduces a new class LightFlattenable<> which is a protocol to flatten simple objects that don't require binders or file descriptors; the benefit of this protocol is that it doesn't require the objects to have a virtual table and give us a consitant way of doing this. we also introduce an implementation of this protocol for POD structures, LightFlattenablePod<>. Parcel has been update to handle this protocol automatically. Sensor, Rect, Point and Region now use this new protocol. Change-Id: Icb3ce7fa1d785249eb666f39c2129f2fc143ea4a
Diffstat (limited to 'include/gui/Sensor.h')
-rw-r--r--include/gui/Sensor.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/include/gui/Sensor.h b/include/gui/Sensor.h
index e59757a..2af2307 100644
--- a/include/gui/Sensor.h
+++ b/include/gui/Sensor.h
@@ -41,7 +41,7 @@ class Parcel;
// ----------------------------------------------------------------------------
-class Sensor : public ASensor, public Flattenable
+class Sensor : public ASensor, public LightFlattenable<Sensor>
{
public:
enum {
@@ -54,7 +54,7 @@ public:
Sensor();
Sensor(struct sensor_t const* hwSensor);
- virtual ~Sensor();
+ ~Sensor();
const String8& getName() const;
const String8& getVendor() const;
@@ -68,13 +68,11 @@ public:
nsecs_t getMinDelayNs() const;
int32_t getVersion() const;
- // 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);
+ // LightFlattenable protocol
+ inline bool isFixedSize() const { return false; }
+ size_t getSize() const;
+ status_t flatten(void* buffer) const;
+ status_t unflatten(void const* buffer, size_t size);
private:
String8 mName;