30 #include <nsAutoLock.h>
31 #include <nsAutoPtr.h>
38 , mContinueAddingDevice(PR_TRUE)
45 nsAutoLock::DestroyLock(
mLock);
52 NS_ENSURE_ARG_POINTER(aDevice);
54 mLock = nsAutoLock::NewLock(
"sbDeviceEventBeforeAddedData::mLock");
55 NS_ENSURE_TRUE(
mLock, NS_ERROR_OUT_OF_MEMORY);
67 NS_ENSURE_ARG_POINTER(aDevice);
68 NS_ENSURE_ARG_POINTER(aBeforeAddedData);
70 nsRefPtr<sbDeviceEventBeforeAddedData> beforeAddedData;
73 nsresult rv = beforeAddedData->Init(aDevice);
74 NS_ENSURE_SUCCESS(rv, rv);
76 nsCOMPtr<sbIDeviceEventBeforeAddedData> retval =
77 do_QueryInterface(beforeAddedData, &rv);
78 NS_ENSURE_SUCCESS(rv, rv);
80 retval.forget(aBeforeAddedData);
86 sbDeviceEventBeforeAddedData::GetContinueAddingDevice(PRBool *aContinueAddingDevice)
88 NS_ENSURE_TRUE(
mLock, NS_ERROR_NOT_INITIALIZED);
89 NS_ENSURE_ARG_POINTER(aContinueAddingDevice);
91 nsAutoLock lock(
mLock);
98 sbDeviceEventBeforeAddedData::SetContinueAddingDevice(PRBool aContinueAddingDevice)
100 NS_ENSURE_TRUE(
mLock, NS_ERROR_NOT_INITIALIZED);
102 nsAutoLock lock(
mLock);
109 sbDeviceEventBeforeAddedData::GetDevice(
sbIDevice **aDevice)
111 NS_ENSURE_TRUE(
mLock, NS_ERROR_NOT_INITIALIZED);
112 NS_ENSURE_ARG_POINTER(aDevice);
114 nsAutoLock lock(
mLock);
116 NS_ENSURE_TRUE(
mDevice, NS_ERROR_UNEXPECTED);
NS_DECL_ISUPPORTS NS_DECL_SBIDEVICEEVENTBEFOREADDEDDATA nsresult Init(sbIDevice *aDevice)
PRPackedBool mContinueAddingDevice
nsCOMPtr< sbIDevice > mDevice
static nsresult CreateEventBeforeAddedData(sbIDevice *aDevice, sbIDeviceEventBeforeAddedData **aBeforeAddedData)
NS_IMPL_THREADSAFE_ISUPPORTS1(sbDeviceEventBeforeAddedData, sbIDeviceEventBeforeAddedData) sbDeviceEventBeforeAddedData
~sbDeviceEventBeforeAddedData()