Bug 1098192 - Remove unused mutex for ifc_* function calls. r=vchang
authorHenry Chang <hchang@mozilla.com>
Fri, 21 Nov 2014 15:46:04 +0800
changeset 217719 8ad15ef85676af2ad034932a90c1ad0800795737
parent 217718 84573000fec136140af086ab10c6d058836cc1a4
child 217720 9155e0c352338e772a0fa230c690213fd0328cab
push id27888
push userryanvm@gmail.com
push dateThu, 27 Nov 2014 02:38:47 +0000
treeherdermozilla-central@cef590a6f946 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvchang
bugs1098192
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1098192 - Remove unused mutex for ifc_* function calls. r=vchang
dom/network/NetUtils.cpp
dom/network/NetUtils.h
--- a/dom/network/NetUtils.cpp
+++ b/dom/network/NetUtils.cpp
@@ -23,18 +23,16 @@ InitNetUtilsLib()
 
 static void*
 GetNetUtilsLibHandle()
 {
   PR_CallOnce(&sInitNetUtilsLib, InitNetUtilsLib);
   return sNetUtilsLib;
 }
 
-mozilla::Mutex NetUtils::sIfcMutex("NetUtils::sIfcMutex");
-
 // static
 void*
 NetUtils::GetSharedLibrary()
 {
   void* netLib = GetNetUtilsLibHandle();
   if (!netLib) {
     NS_WARNING("No /system/lib/libnetutils.so");
   }
@@ -65,87 +63,78 @@ DEFINE_DLFUNC(dhcp_stop, int32_t, const 
 
 NetUtils::NetUtils()
 {
 }
 
 int32_t NetUtils::do_ifc_enable(const char *ifname)
 {
   USE_DLFUNC(ifc_enable)
-  mozilla::MutexAutoLock lock(sIfcMutex);
   return ifc_enable(ifname);
 }
 
 int32_t NetUtils::do_ifc_disable(const char *ifname)
 {
   USE_DLFUNC(ifc_disable)
-  mozilla::MutexAutoLock lock(sIfcMutex);
   return ifc_disable(ifname);
 }
 
 int32_t NetUtils::do_ifc_configure(const char *ifname,
                                        in_addr_t address,
                                        uint32_t prefixLength,
                                        in_addr_t gateway,
                                        in_addr_t dns1,
                                        in_addr_t dns2)
 {
   USE_DLFUNC(ifc_configure)
-  mozilla::MutexAutoLock lock(sIfcMutex);
   int32_t ret = ifc_configure(ifname, address, prefixLength, gateway, dns1, dns2);
   return ret;
 }
 
 int32_t NetUtils::do_ifc_reset_connections(const char *ifname,
                                                const int32_t resetMask)
 {
   USE_DLFUNC(ifc_reset_connections)
-  mozilla::MutexAutoLock lock(sIfcMutex);
   return ifc_reset_connections(ifname, resetMask);
 }
 
 int32_t NetUtils::do_ifc_set_default_route(const char *ifname,
                                            in_addr_t gateway)
 {
   USE_DLFUNC(ifc_set_default_route)
-  mozilla::MutexAutoLock lock(sIfcMutex);
   return ifc_set_default_route(ifname, gateway);
 }
 
 int32_t NetUtils::do_ifc_add_route(const char *ifname,
                                    const char *dst,
                                    uint32_t prefixLength,
                                    const char *gateway)
 {
   USE_DLFUNC(ifc_add_route)
-  mozilla::MutexAutoLock lock(sIfcMutex);
   return ifc_add_route(ifname, dst, prefixLength, gateway);
 }
 
 int32_t NetUtils::do_ifc_remove_route(const char *ifname,
                                       const char *dst,
                                       uint32_t prefixLength,
                                       const char *gateway)
 {
   USE_DLFUNC(ifc_remove_route)
-  mozilla::MutexAutoLock lock(sIfcMutex);
   return ifc_remove_route(ifname, dst, prefixLength, gateway);
 }
 
 int32_t NetUtils::do_ifc_remove_host_routes(const char *ifname)
 {
   USE_DLFUNC(ifc_remove_host_routes)
-  mozilla::MutexAutoLock lock(sIfcMutex);
   return ifc_remove_host_routes(ifname);
 }
 
 int32_t NetUtils::do_ifc_remove_default_route(const char *ifname)
 {
   USE_DLFUNC(ifc_remove_default_route)
-  mozilla::MutexAutoLock lock(sIfcMutex);
   return ifc_remove_default_route(ifname);
 }
 
 int32_t NetUtils::do_dhcp_stop(const char *ifname)
 {
   USE_DLFUNC(dhcp_stop)
   return dhcp_stop(ifname);
 }
--- a/dom/network/NetUtils.h
+++ b/dom/network/NetUtils.h
@@ -6,17 +6,16 @@
  * Abstraction on top of the network support from libnetutils that we
  * use to set up network connections.
  */
 
 #ifndef NetUtils_h
 #define NetUtils_h
 
 #include "arpa/inet.h"
-#include "mozilla/Mutex.h"
 
 // Copied from ifc.h
 #define RESET_IPV4_ADDRESSES 0x01
 #define RESET_IPV6_ADDRESSES 0x02
 #define RESET_ALL_ADDRESSES  (RESET_IPV4_ADDRESSES | RESET_IPV6_ADDRESSES)
 
 // Implements netutils functions. No need for an abstract class here since we
 // only have a one sdk specific method (dhcp_do_request)
@@ -54,19 +53,16 @@ public:
                              uint32_t *prefixLength,
                              char *dns1,
                              char *dns2,
                              char *server,
                              uint32_t  *lease,
                              char* vendorinfo);
 
   static int32_t SdkVersion();
-
-private:
-  static mozilla::Mutex sIfcMutex;
 };
 
 // Defines a function type with the right arguments and return type.
 #define DEFINE_DLFUNC(name, ret, args...) typedef ret (*FUNC##name)(args);
 
 // Set up a dlsymed function ready to use.
 #define USE_DLFUNC(name)                                                      \
   FUNC##name name = (FUNC##name) dlsym(GetSharedLibrary(), #name);            \