Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudStorageManager and VolumeManager integration. #4

Merged
merged 1 commit into from
May 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions dom/system/gonk/VolumeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@ VolumeManager::FindAddVolumeByName(const nsCSubstring& aName)
return vol;
}

//static
void
VolumeManager::RemoveVolumeByName(const nsCSubstring& aName)
{
VolumeArray::size_type numVolumes = NumVolumes();
VolumeArray::index_type volIndex;
for (volIndex = 0; volIndex < numVolumes; volIndex++) {
RefPtr<Volume> vol = GetVolume(volIndex);
if (vol->Name().Equals(aName)) {
break;
}
}
sVolumeManager->mVolumeArray.RemoveElementAt(volIndex);
}

//static
void VolumeManager::InitConfig()
{
Expand Down
1 change: 1 addition & 0 deletions dom/system/gonk/VolumeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class VolumeManager final : public MessageLoopForIO::LineWatcher
static TemporaryRef<Volume> GetVolume(VolumeArray::index_type aIndex);
static TemporaryRef<Volume> FindVolumeByName(const nsCSubstring& aName);
static TemporaryRef<Volume> FindAddVolumeByName(const nsCSubstring& aName);
static void RemoveVolumeByName(const nsCSubstring& aName);
static void InitConfig();

static void PostCommand(VolumeCommand* aCommand);
Expand Down
7 changes: 4 additions & 3 deletions dom/system/gonk/cloudstorage/CloudStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,19 @@ class CloudStorageRunnable : public nsRunnable
{
CloudStorageRequestHandler* handler = new CloudStorageRequestHandler(mCloudStorage->MountPoint());
if (handler) {
/*
RefPtr<Volume> vol = VolumeManager::FindAddVolumeByName(mCloudStorage->Name());
vol->SetCloudVolume(mCloudStorage->MountPoint());
*/
vol->SetFakeVolume(mCloudStorage->MountPoint());
VolumeManager::Dump("CloudStorage");
while (mCloudStorage->State() == CloudStorage::STATE_RUNNING) {
//handler->HandleOneRequest();
sleep(1);
}
} else {
LOG("Construct cloud storage handler fail");
}
VolumeManager::RemoveVolumeByName(mCloudStorage->Name());
delete handler;
VolumeManager::Dump("CloudStorage");
LOG("going to finish RequestHandler.");
return NS_OK;
}
Expand Down