Skip to content

Commit

Permalink
Merge pull request #4 from MozCloudStorage/cloud
Browse files Browse the repository at this point in the history
CloudStorageManager and VolumeManager integration.
  • Loading branch information
edenchuang committed May 13, 2015
2 parents 1fbc5f1 + 36cc737 commit 6411dda
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
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

0 comments on commit 6411dda

Please sign in to comment.