Bug 884239 - Remove the wrapper function of timer_create if ANDROID_VERSION is greater than JB MR1. r=mwu
authorShawn Huang <shuang@mozilla.com>
Fri, 19 Jul 2013 10:10:00 -0400
changeset 139228 50c15e19fb09b544393ce487dde9ae4da35fcf52
parent 139133 7b2c82ae98dbd9dcefbfa593be7fa7ae7ef8cbe9
child 139229 e7938a3a8acca76fd32eb7a2da28efa7ccfa849b
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersmwu
bugs884239
milestone25.0a1
Bug 884239 - Remove the wrapper function of timer_create if ANDROID_VERSION is greater than JB MR1. r=mwu
mozglue/build/BionicGlue.cpp
--- a/mozglue/build/BionicGlue.cpp
+++ b/mozglue/build/BionicGlue.cpp
@@ -10,16 +10,17 @@
 #include <unistd.h>
 #include <android/log.h>
 #include <mozilla/Util.h>
 
 #include <vector>
 
 #define NS_EXPORT __attribute__ ((visibility("default")))
 
+#if ANDROID_VERSION < 17 || defined(MOZ_WIDGET_ANDROID)
 /* Android doesn't have pthread_atfork(), so we need to use our own. */
 struct AtForkFuncs {
   void (*prepare)(void);
   void (*parent)(void);
   void (*child)(void);
 };
 
 /* jemalloc's initialization calls pthread_atfork. When pthread_atfork (see
@@ -54,34 +55,38 @@ struct SpecialAllocator: public std::all
   };
 
 private:
   mozilla::AlignedStorage2<T> buf;
   bool bufUsed;
 };
 
 static std::vector<AtForkFuncs, SpecialAllocator<AtForkFuncs> > atfork;
+#endif
 
 #ifdef MOZ_WIDGET_GONK
 #include "cpuacct.h"
 #define WRAP(x) x
 
+#if ANDROID_VERSION < 17 || defined(MOZ_WIDGET_ANDROID)
 extern "C" NS_EXPORT int
 timer_create(clockid_t, struct sigevent*, timer_t*)
 {
   __android_log_print(ANDROID_LOG_ERROR, "BionicGlue", "timer_create not supported!");
   abort();
   return -1;
 }
+#endif
 
 #else
 #define cpuacct_add(x)
 #define WRAP(x) __wrap_##x
 #endif
 
+#if ANDROID_VERSION < 17 || defined(MOZ_WIDGET_ANDROID)
 extern "C" NS_EXPORT int
 WRAP(pthread_atfork)(void (*prepare)(void), void (*parent)(void), void (*child)(void))
 {
   AtForkFuncs funcs;
   funcs.prepare = prepare;
   funcs.parent = parent;
   funcs.child = child;
   if (!atfork.capacity())
@@ -112,16 +117,17 @@ WRAP(fork)(void)
   default:
     for (std::vector<AtForkFuncs>::iterator it = atfork.begin();
          it < atfork.end(); ++it)
       if (it->parent)
         it->parent();
   }
   return pid;
 }
+#endif
 
 extern "C" NS_EXPORT int
 WRAP(raise)(int sig)
 {
   return pthread_kill(pthread_self(), sig);
 }
 
 /*