diff options
Diffstat (limited to 'include/ui/android_native_buffer.h')
| -rw-r--r-- | include/ui/android_native_buffer.h | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/include/ui/android_native_buffer.h b/include/ui/android_native_buffer.h index 9c92af8845f8..402843e20565 100644 --- a/include/ui/android_native_buffer.h +++ b/include/ui/android_native_buffer.h @@ -33,6 +33,15 @@ typedef struct android_native_buffer_t          common.version = sizeof(android_native_buffer_t);          memset(common.reserved, 0, sizeof(common.reserved));      } + +    // Implement the methods that sp<android_native_buffer_t> expects so that it +    // can be used to automatically refcount android_native_buffer_t's. +    void incStrong(const void* id) const { +        common.incRef(const_cast<android_native_base_t*>(&common)); +    } +    void decStrong(const void* id) const { +        common.decRef(const_cast<android_native_base_t*>(&common)); +    }  #endif      struct android_native_base_t common; | 
