From 343000e7d30edea62f26cd3b263dbc5ea4599c50 Mon Sep 17 00:00:00 2001 From: Gian-Carlo Pascutto Date: Tue, 16 Apr 2013 15:47:41 +0200 Subject: [PATCH] Bug 861146 - Provide pthread_rwlock replacement for Android 2.2. r=jesup --- .../webrtc/trunk/webrtc/system_wrappers/source/rw_lock.cc | 7 ++++++- .../webrtc/system_wrappers/source/system_wrappers.gyp | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/rw_lock.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/rw_lock.cc index 8b76eb86147..d409e747659 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/rw_lock.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/rw_lock.cc @@ -15,6 +15,8 @@ #if defined(_WIN32) #include "webrtc/system_wrappers/source/rw_lock_generic.h" #include "webrtc/system_wrappers/source/rw_lock_win.h" +#elif defined(ANDROID) +#include "webrtc/system_wrappers/source/rw_lock_generic.h" #else #include "webrtc/system_wrappers/source/rw_lock_posix.h" #endif @@ -22,13 +24,16 @@ namespace webrtc { RWLockWrapper* RWLockWrapper::CreateRWLock() { -#ifdef _WIN32 +#if defined(_WIN32) // Native implementation is faster, so use that if available. RWLockWrapper* lock = RWLockWin::Create(); if (lock) { return lock; } return new RWLockGeneric(); +#elif defined(ANDROID) + // Android 2.2 and before do not have POSIX pthread rwlocks. + return new RWLockGeneric(); #else return RWLockPosix::Create(); #endif diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/system_wrappers.gyp b/media/webrtc/trunk/webrtc/system_wrappers/source/system_wrappers.gyp index 0aff7dfb336..23664d4f024 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/system_wrappers.gyp +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/system_wrappers.gyp @@ -138,6 +138,11 @@ }], ['OS=="android" or moz_widget_toolkit_gonk==1', { 'dependencies': [ 'cpu_features_android', ], + 'sources!': [ + # Android doesn't have these in <=2.2 + 'rw_lock_posix.cc', + 'rw_lock_posix.h', + ], }], ['OS=="linux"', { 'link_settings': {