зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1264287: Convert Wifi to use |UniquePtr|, r=nfroyd
This commit is contained in:
Родитель
4a84eac069
Коммит
a984fed7b8
|
@ -29,7 +29,7 @@ namespace mozilla {
|
|||
static StaticRefPtr<WifiProxyService> gWifiProxyService;
|
||||
|
||||
// The singleton supplicant class, that can be used on any thread.
|
||||
static nsAutoPtr<WpaSupplicant> gWpaSupplicant;
|
||||
static UniquePtr<WpaSupplicant> gWpaSupplicant;
|
||||
|
||||
// Runnable used dispatch the WaitForEvent result on the main thread.
|
||||
class WifiEventDispatcher : public nsRunnable
|
||||
|
@ -160,7 +160,7 @@ WifiProxyService::FactoryCreate()
|
|||
gWifiProxyService = new WifiProxyService();
|
||||
ClearOnShutdown(&gWifiProxyService);
|
||||
|
||||
gWpaSupplicant = new WpaSupplicant();
|
||||
gWpaSupplicant = MakeUnique<WpaSupplicant>();
|
||||
ClearOnShutdown(&gWpaSupplicant);
|
||||
}
|
||||
|
||||
|
|
|
@ -387,13 +387,13 @@ WpaSupplicant::WpaSupplicant()
|
|||
mSdkVersion = strtol(propVersion, nullptr, 10);
|
||||
|
||||
if (mSdkVersion < 16) {
|
||||
mImpl = new ICSWpaSupplicantImpl();
|
||||
mImpl = MakeUnique<ICSWpaSupplicantImpl>();
|
||||
} else if (mSdkVersion < 19) {
|
||||
mImpl = new JBWpaSupplicantImpl();
|
||||
mImpl = MakeUnique<JBWpaSupplicantImpl>();
|
||||
} else {
|
||||
mImpl = new KKWpaSupplicantImpl();
|
||||
mImpl = MakeUnique<KKWpaSupplicantImpl>();
|
||||
}
|
||||
mWifiHotspotUtils = new WifiHotspotUtils();
|
||||
mWifiHotspotUtils = MakeUnique<WifiHotspotUtils>();
|
||||
};
|
||||
|
||||
void WpaSupplicant::WaitForEvent(nsAString& aEvent, const nsCString& aInterface)
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#define WifiUtils_h
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/dom/WifiOptionsBinding.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "WifiHotspotUtils.h"
|
||||
|
||||
// Needed to add a copy constructor to WifiCommandOptions.
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
class WpaSupplicantImpl
|
||||
{
|
||||
public:
|
||||
// Suppress warning from nsAutoPtr
|
||||
// Suppress warning from |UniquePtr|
|
||||
virtual ~WpaSupplicantImpl() {}
|
||||
|
||||
virtual int32_t
|
||||
|
@ -94,8 +94,8 @@ public:
|
|||
const nsCString& aInterface);
|
||||
|
||||
private:
|
||||
nsAutoPtr<WpaSupplicantImpl> mImpl;
|
||||
nsAutoPtr<WifiHotspotUtils> mWifiHotspotUtils;
|
||||
UniquePtr<WpaSupplicantImpl> mImpl;
|
||||
UniquePtr<WifiHotspotUtils> mWifiHotspotUtils;
|
||||
|
||||
uint32_t mSdkVersion;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче