Backed out changesets d76274933db8 and dd3cedcdbe2b (bug 865347) to see if it fixes the Marionette timeouts.

This commit is contained in:
Ryan VanderMeulen 2013-07-09 14:21:02 -04:00
parent 3fb73fa40a
commit 8246620655
11 changed files with 8 additions and 171 deletions

View File

@ -2572,37 +2572,5 @@ ContentParent::RecvSystemMessageHandled()
return true;
}
bool
ContentParent::RecvCreateFakeVolume(const nsString& fsName, const nsString& mountPoint)
{
#ifdef MOZ_WIDGET_GONK
nsresult rv;
nsCOMPtr<nsIVolumeService> vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID, &rv);
if (vs) {
vs->CreateFakeVolume(fsName, mountPoint);
}
return true;
#else
NS_WARNING("ContentParent::RecvCreateFakeVolume shouldn't be called when MOZ_WIDGET_GONK is not defined");
return false;
#endif
}
bool
ContentParent::RecvSetFakeVolumeState(const nsString& fsName, const int32_t& fsState)
{
#ifdef MOZ_WIDGET_GONK
nsresult rv;
nsCOMPtr<nsIVolumeService> vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID, &rv);
if (vs) {
vs->SetFakeVolumeState(fsName, fsState);
}
return true;
#else
NS_WARNING("ContentParent::RecvSetFakeVolumeState shouldn't be called when MOZ_WIDGET_GONK is not defined");
return false;
#endif
}
} // namespace dom
} // namespace mozilla

View File

@ -416,10 +416,6 @@ private:
virtual bool RecvSystemMessageHandled() MOZ_OVERRIDE;
virtual bool RecvCreateFakeVolume(const nsString& fsName, const nsString& mountPoint) MOZ_OVERRIDE;
virtual bool RecvSetFakeVolumeState(const nsString& fsName, const int32_t& fsState) MOZ_OVERRIDE;
virtual void ProcessingError(Result what) MOZ_OVERRIDE;
GeckoChildProcessHost* mSubprocess;

View File

@ -515,10 +515,6 @@ parent:
// Notify the parent that the child has finished handling a system message.
async SystemMessageHandled();
// called by the child (test code only) to propagate volume changes to the parent
async CreateFakeVolume(nsString fsName, nsString mountPoint);
async SetFakeVolumeState(nsString fsName, int32_t fsState);
both:
AsyncMessage(nsString aMessage, ClonedMessageData aData);
};

View File

@ -5,7 +5,7 @@
#include "nsISupports.idl"
#include "nsIVolumeStat.idl"
[scriptable, uuid(4b5bd562-bd05-4658-ab0f-f668a9e25fb5)]
[scriptable, uuid(1134f267-7b81-42f2-b64a-6edb91286576)]
interface nsIVolume : nsISupports
{
// These MUST match the states from android's system/vold/Volume.h header
@ -49,9 +49,6 @@ interface nsIVolume : nsISupports
readonly attribute boolean isMountLocked;
nsIVolumeStat getStats();
// Whether this is a fake volume.
readonly attribute boolean isFake;
};
%{C++

View File

@ -12,7 +12,7 @@
%}
[ref] native nsStringTArrayRef(nsTArray<nsString>);
[scriptable, uuid(a3b110cd-74f2-43cb-84c6-2a87713f2774)]
[scriptable, uuid(7c179fb7-67a0-43a3-9337-294e0360b858)]
interface nsIVolumeService : nsISupports
{
nsIVolume getVolumeByName(in DOMString volName);
@ -24,10 +24,6 @@ interface nsIVolumeService : nsISupports
nsIVolumeMountLock createMountLock(in DOMString volName);
[noscript] void getVolumeNames(in nsStringTArrayRef aVolNames);
/* for test case only to simulate sdcard insertion/removal */
void createFakeVolume(in DOMString name, in DOMString path);
void SetFakeVolumeState(in DOMString name, in long state);
};
%{C++

View File

@ -50,8 +50,7 @@ nsVolume::nsVolume(const Volume* aVolume)
mMountPoint(NS_ConvertUTF8toUTF16(aVolume->MountPoint())),
mState(aVolume->State()),
mMountGeneration(aVolume->MountGeneration()),
mMountLocked(aVolume->IsMountLocked()),
mIsFake(false)
mMountLocked(aVolume->IsMountLocked())
{
}
@ -86,13 +85,6 @@ bool nsVolume::Equals(nsIVolume* aVolume)
if (mMountLocked != volIsMountLocked) {
return false;
}
bool isFake;
aVolume->GetIsFake(&isFake);
if (mIsFake != isFake) {
return false;
}
return true;
}
@ -144,12 +136,6 @@ NS_IMETHODIMP nsVolume::GetStats(nsIVolumeStat **aResult)
return NS_OK;
}
NS_IMETHODIMP nsVolume::GetIsFake(bool *aIsFake)
{
*aIsFake = mIsFake;
return NS_OK;
}
void
nsVolume::LogState() const
{
@ -170,7 +156,6 @@ void nsVolume::Set(nsIVolume* aVolume)
aVolume->GetName(mName);
aVolume->GetMountPoint(mMountPoint);
aVolume->GetState(&mState);
aVolume->GetIsFake(&mIsFake);
int32_t volMountGeneration;
aVolume->GetMountGeneration(&volMountGeneration);
@ -237,25 +222,5 @@ nsVolume::UpdateMountLock(bool aMountLocked)
MountGeneration(), aMountLocked));
}
void
nsVolume::SetState(int32_t aState)
{
static int32_t sMountGeneration = 0;
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(IsFake());
if (aState == mState) {
return;
}
if (aState == nsIVolume::STATE_MOUNTED) {
mMountGeneration = ++sMountGeneration;
}
mState = aState;
}
} // system
} // mozilla

View File

@ -32,8 +32,7 @@ public:
mMountPoint(aMountPoint),
mState(aState),
mMountGeneration(aMountGeneration),
mMountLocked(false),
mIsFake(false)
mMountLocked(false)
{
}
@ -43,8 +42,7 @@ public:
: mName(aName),
mState(STATE_INIT),
mMountGeneration(-1),
mMountLocked(true), // Needs to agree with Volume::Volume
mIsFake(false)
mMountLocked(true) // Needs to agree with Volume::Volume
{
}
@ -74,16 +72,11 @@ private:
void UpdateMountLock(const nsAString& aMountLockState);
void UpdateMountLock(bool aMountLocked);
bool IsFake() const { return mIsFake; }
void SetIsFake(bool aIsFake) { mIsFake = aIsFake; }
void SetState(int32_t aState);
nsString mName;
nsString mMountPoint;
int32_t mState;
int32_t mMountGeneration;
bool mMountLocked;
bool mIsFake;
};
} // system

View File

@ -326,7 +326,7 @@ nsVolumeService::FindVolumeByName(const nsAString& aName)
//static
already_AddRefed<nsVolume>
nsVolumeService::CreateOrFindVolumeByName(const nsAString& aName, bool aIsFake /*= false*/)
nsVolumeService::CreateOrFindVolumeByName(const nsAString& aName)
{
MonitorAutoLock autoLock(mArrayMonitor);
@ -337,7 +337,6 @@ nsVolumeService::CreateOrFindVolumeByName(const nsAString& aName, bool aIsFake /
}
// Volume not found - add a new one
vol = new nsVolume(aName);
vol->SetIsFake(aIsFake);
mVolumeArray.AppendElement(vol);
return vol.forget();
}
@ -349,19 +348,11 @@ nsVolumeService::UpdateVolume(nsIVolume* aVolume)
nsString volName;
aVolume->GetName(volName);
bool aIsFake;
aVolume->GetIsFake(&aIsFake);
nsRefPtr<nsVolume> vol = CreateOrFindVolumeByName(volName, aIsFake);
nsRefPtr<nsVolume> vol = CreateOrFindVolumeByName(volName);
if (vol->Equals(aVolume)) {
// Nothing has really changed. Don't bother telling anybody.
return;
}
if (!vol->IsFake() && aIsFake) {
// Prevent an incoming fake volume from overriding an existing real volume.
return;
}
vol->Set(aVolume);
nsCOMPtr<nsIObserverService> obs = GetObserverService();
if (!obs) {
@ -371,41 +362,6 @@ nsVolumeService::UpdateVolume(nsIVolume* aVolume)
obs->NotifyObservers(vol, NS_VOLUME_STATE_CHANGED, stateStr.get());
}
NS_IMETHODIMP
nsVolumeService::CreateFakeVolume(const nsAString& name, const nsAString& path)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
nsRefPtr<nsVolume> vol = new nsVolume(name, path, nsIVolume::STATE_INIT, -1);
vol->SetIsFake(true);
UpdateVolume(vol.get());
return NS_OK;
}
ContentChild::GetSingleton()->SendCreateFakeVolume(nsString(name), nsString(path));
return NS_OK;
}
NS_IMETHODIMP
nsVolumeService::SetFakeVolumeState(const nsAString& name, int32_t state)
{
if (XRE_GetProcessType() == GeckoProcessType_Default) {
nsRefPtr<nsVolume> vol;
{
MonitorAutoLock autoLock(mArrayMonitor);
vol = FindVolumeByName(name);
}
if (!vol || !vol->IsFake()) {
return NS_ERROR_NOT_AVAILABLE;
}
vol->SetState(state);
UpdateVolume(vol.get());
return NS_OK;
}
ContentChild::GetSingleton()->SendSetFakeVolumeState(nsString(name), state);
return NS_OK;
}
/***************************************************************************
* The UpdateVolumeRunnable creates an nsVolume and updates the main thread
* data structure while running on the main thread.

View File

@ -50,7 +50,7 @@ private:
const nsAString& aMountLockState);
already_AddRefed<nsVolume> FindVolumeByMountLockName(const nsAString& aMountLockName);
already_AddRefed<nsVolume> FindVolumeByName(const nsAString& aName);
already_AddRefed<nsVolume> CreateOrFindVolumeByName(const nsAString& aName, bool aIsFake = false);
already_AddRefed<nsVolume> CreateOrFindVolumeByName(const nsAString& aName);
Monitor mArrayMonitor;
nsVolume::Array mVolumeArray;

View File

@ -6,4 +6,3 @@ qemu = true
[test_geolocation.js]
disabled = Bug 808783
[test_get_voicemailInfo.js]
[test_fakevolume.js]

View File

@ -1,29 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 10000;
let Cc = SpecialPowers.Cc;
let Ci = SpecialPowers.Ci;
let volumeService = Cc["@mozilla.org/telephony/volume-service;1"].getService(Ci.nsIVolumeService);
ok(volumeService, "Should have volume service");
let volName = "fake";
let mountPoint = "/data/fake/storage";
volumeService.createFakeVolume(volName, mountPoint);
let vol = volumeService.getVolumeByName(volName);
ok(vol, "volume shouldn't be null");
is(volName, vol.name, "name");
is(mountPoint, vol.mountPoint, "moutnPoint");
is(Ci.nsIVolume.STATE_INIT, vol.state, "state");
let oldMountGen = vol.mountGeneration;
volumeService.SetFakeVolumeState(volName, Ci.nsIVolume.STATE_MOUNTED);
is(Ci.nsIVolume.STATE_MOUNTED, vol.state, "state");
ok(vol.mountGeneration > oldMountGen, "mount generation should be incremented");
finish();