mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 785124 - Pt 5 - Add extra asserts. r=dougt
This commit is contained in:
parent
3d4c942e73
commit
c73c4fb662
@ -65,6 +65,9 @@ Volume::Volume(const nsCSubstring& aName)
|
|||||||
void
|
void
|
||||||
Volume::SetMediaPresent(bool aMediaPresent)
|
Volume::SetMediaPresent(bool aMediaPresent)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
// mMediaPresent is slightly redunant to the state, however
|
// mMediaPresent is slightly redunant to the state, however
|
||||||
// when media is removed (while Idle), we get the following:
|
// when media is removed (while Idle), we get the following:
|
||||||
// 631 Volume sdcard /mnt/sdcard disk removed (179:0)
|
// 631 Volume sdcard /mnt/sdcard disk removed (179:0)
|
||||||
@ -100,6 +103,9 @@ Volume::SetMediaPresent(bool aMediaPresent)
|
|||||||
void
|
void
|
||||||
Volume::SetState(Volume::STATE aNewState)
|
Volume::SetState(Volume::STATE aNewState)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
if (aNewState == mState) {
|
if (aNewState == mState) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -127,6 +133,9 @@ Volume::SetState(Volume::STATE aNewState)
|
|||||||
void
|
void
|
||||||
Volume::SetMountPoint(const nsCSubstring& aMountPoint)
|
Volume::SetMountPoint(const nsCSubstring& aMountPoint)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
if (mMountPoint.Equals(aMountPoint)) {
|
if (mMountPoint.Equals(aMountPoint)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -137,30 +146,45 @@ Volume::SetMountPoint(const nsCSubstring& aMountPoint)
|
|||||||
void
|
void
|
||||||
Volume::StartMount(VolumeResponseCallback* aCallback)
|
Volume::StartMount(VolumeResponseCallback* aCallback)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
StartCommand(new VolumeActionCommand(this, "mount", "", aCallback));
|
StartCommand(new VolumeActionCommand(this, "mount", "", aCallback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Volume::StartUnmount(VolumeResponseCallback* aCallback)
|
Volume::StartUnmount(VolumeResponseCallback* aCallback)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
StartCommand(new VolumeActionCommand(this, "unmount", "force", aCallback));
|
StartCommand(new VolumeActionCommand(this, "unmount", "force", aCallback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Volume::StartShare(VolumeResponseCallback* aCallback)
|
Volume::StartShare(VolumeResponseCallback* aCallback)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
StartCommand(new VolumeActionCommand(this, "share", "ums", aCallback));
|
StartCommand(new VolumeActionCommand(this, "share", "ums", aCallback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Volume::StartUnshare(VolumeResponseCallback* aCallback)
|
Volume::StartUnshare(VolumeResponseCallback* aCallback)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
StartCommand(new VolumeActionCommand(this, "unshare", "ums", aCallback));
|
StartCommand(new VolumeActionCommand(this, "unshare", "ums", aCallback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Volume::StartCommand(VolumeCommand* aCommand)
|
Volume::StartCommand(VolumeCommand* aCommand)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
VolumeManager::PostCommand(aCommand);
|
VolumeManager::PostCommand(aCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,6 +192,7 @@ Volume::StartCommand(VolumeCommand* aCommand)
|
|||||||
void
|
void
|
||||||
Volume::RegisterObserver(Volume::EventObserver* aObserver)
|
Volume::RegisterObserver(Volume::EventObserver* aObserver)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
mEventObserverList.AddObserver(aObserver);
|
mEventObserverList.AddObserver(aObserver);
|
||||||
@ -183,6 +208,7 @@ Volume::RegisterObserver(Volume::EventObserver* aObserver)
|
|||||||
void
|
void
|
||||||
Volume::UnregisterObserver(Volume::EventObserver* aObserver)
|
Volume::UnregisterObserver(Volume::EventObserver* aObserver)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
mEventObserverList.RemoveObserver(aObserver);
|
mEventObserverList.RemoveObserver(aObserver);
|
||||||
@ -194,6 +220,9 @@ Volume::UpdateMountLock(const nsACString& aVolumeName,
|
|||||||
const int32_t& aMountGeneration,
|
const int32_t& aMountGeneration,
|
||||||
const bool& aMountLocked)
|
const bool& aMountLocked)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
|
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
|
||||||
if (!vol || (vol->mMountGeneration != aMountGeneration)) {
|
if (!vol || (vol->mMountGeneration != aMountGeneration)) {
|
||||||
return;
|
return;
|
||||||
@ -208,6 +237,9 @@ Volume::UpdateMountLock(const nsACString& aVolumeName,
|
|||||||
void
|
void
|
||||||
Volume::HandleVoldResponse(int aResponseCode, nsCWhitespaceTokenizer& aTokenizer)
|
Volume::HandleVoldResponse(int aResponseCode, nsCWhitespaceTokenizer& aTokenizer)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||||
|
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
|
||||||
|
|
||||||
// The volume name will have already been parsed, and the tokenizer will point
|
// The volume name will have already been parsed, and the tokenizer will point
|
||||||
// to the token after the volume name
|
// to the token after the volume name
|
||||||
switch (aResponseCode) {
|
switch (aResponseCode) {
|
||||||
|
@ -38,6 +38,11 @@ NS_VolumeStateStr(int32_t aState)
|
|||||||
return "???";
|
return "???";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// While nsVolumes can only be used on the main thread, in the
|
||||||
|
// UpdateVolumeRunnable constructor (which is called from IOThread) we
|
||||||
|
// allocate an nsVolume which is then passed to MainThread. Since we
|
||||||
|
// have a situation where we allocate on one thread and free on another
|
||||||
|
// we use a thread safe AddRef implementation.
|
||||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsVolume, nsIVolume)
|
NS_IMPL_THREADSAFE_ISUPPORTS1(nsVolume, nsIVolume)
|
||||||
|
|
||||||
nsVolume::nsVolume(const Volume* aVolume)
|
nsVolume::nsVolume(const Volume* aVolume)
|
||||||
@ -106,6 +111,8 @@ nsVolume::LogState() const
|
|||||||
|
|
||||||
void nsVolume::Set(const nsVolume* aVolume)
|
void nsVolume::Set(const nsVolume* aVolume)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
mName = aVolume->mName;
|
mName = aVolume->mName;
|
||||||
mMountPoint = aVolume->mMountPoint;
|
mMountPoint = aVolume->mMountPoint;
|
||||||
mState = aVolume->mState;
|
mState = aVolume->mState;
|
||||||
@ -139,6 +146,8 @@ void nsVolume::Set(const nsVolume* aVolume)
|
|||||||
void
|
void
|
||||||
nsVolume::UpdateMountLock(const nsAString& aMountLockState)
|
nsVolume::UpdateMountLock(const nsAString& aMountLockState)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
// There are 3 states, unlocked, locked-background, and locked-foreground
|
// There are 3 states, unlocked, locked-background, and locked-foreground
|
||||||
// I figured it was easier to use negtive logic and compare for unlocked.
|
// I figured it was easier to use negtive logic and compare for unlocked.
|
||||||
UpdateMountLock(!aMountLockState.EqualsLiteral("unlocked"));
|
UpdateMountLock(!aMountLockState.EqualsLiteral("unlocked"));
|
||||||
@ -147,6 +156,8 @@ nsVolume::UpdateMountLock(const nsAString& aMountLockState)
|
|||||||
void
|
void
|
||||||
nsVolume::UpdateMountLock(bool aMountLocked)
|
nsVolume::UpdateMountLock(bool aMountLocked)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
if (aMountLocked == mMountLocked) {
|
if (aMountLocked == mMountLocked) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2088,8 +2088,7 @@ ReadMARChannelIDs(const NS_tchar *path, MARChannelStringTable *results)
|
|||||||
static int
|
static int
|
||||||
GetUpdateFileName(NS_tchar *fileName, int maxChars)
|
GetUpdateFileName(NS_tchar *fileName, int maxChars)
|
||||||
{
|
{
|
||||||
#if defined(MOZ_WIDGET_GONK)
|
#if defined(MOZ_WIDGET_GONK) // If an update.link file exists, then it will contain the name
|
||||||
// If an update.link file exists, then it will contain the name
|
|
||||||
// of the update file (terminated by a newline).
|
// of the update file (terminated by a newline).
|
||||||
|
|
||||||
NS_tchar linkFileName[MAXPATHLEN];
|
NS_tchar linkFileName[MAXPATHLEN];
|
||||||
|
Loading…
Reference in New Issue
Block a user