Closed
Bug 1029403
Opened 11 years ago
Closed 11 years ago
[Device Storage] Trigger a storage-state-change event when there is volume state change
Categories
(Firefox OS Graveyard :: General, defect)
Tracking
(feature-b2g:2.1)
People
(Reporter: alchen, Assigned: alchen)
References
Details
(Keywords: dev-doc-needed, Whiteboard: [p=3])
Attachments
(1 file, 2 obsolete files)
Based on the discussion of bug 943825, we need to trigger a storage-state-change event with actual volume state when there is volume state change. By listening these event changes, GAIA could know a clear timing to do corresponding behavior.
Assignee | ||
Updated•11 years ago
|
Assignee | ||
Comment 1•11 years ago
|
||
Hi Dave,
I don't know if it is a suitable place to accomplish this goal.
please have a look about this patch and give some suggestion about it.
Thanks a lot.
Attachment #8445025 -
Flags: feedback?(dhylands)
Comment 2•11 years ago
|
||
Comment on attachment 8445025 [details] [diff] [review]
Trigger a storage-state-change event when there is volume state change
Review of attachment 8445025 [details] [diff] [review]:
-----------------------------------------------------------------
Hmm. I think we need to do some cleanup here. And we need to move where you're sending things.
DispatchMountChangeEvent is called from here: http://dxr.mozilla.org/mozilla-central/source/dom/devicestorage/nsDeviceStorage.cpp#4261
and the status passed in is determined here:
http://dxr.mozilla.org/mozilla-central/source/dom/devicestorage/nsDeviceStorage.cpp#1541
So the status passed to DispatchMountChangeEvent is one of (available, unavailable, shared).
For consistency, we should call (available, unavailable, shared) a status. We should call the statuses listed here:
http://dxr.mozilla.org/mozilla-central/source/dom/system/gonk/nsIVolume.idl?from=nsIVolume.idl#12 storage statuses (or possible volume statuses). I've been trying to use the word storage for the API facing stuff, and only using volume on the internal side of things.
You'll need to send your storage-status-changed from here:
http://dxr.mozilla.org/mozilla-central/source/dom/devicestorage/nsDeviceStorage.cpp#4257
and call DeviceStorageFile::GetStorageStatus to get the string.
In DispatchMountChangeEvent, please rename aVolumeStatus to be aStatus.
In fact, we should probably rename DispatchMountChangeEvent to be DispatchStatusChangeEvent and create a DispatchStorageStatusChangeEvent function for the storage-status.
::: dom/devicestorage/nsDeviceStorage.cpp
@@ +4193,5 @@
> + mStorageName,
> + aStorageStatus);
> + bool ignore;
> + if (NS_SUCCEEDED(rv))
> + DispatchEvent(ce, &ignore);
nit: Add curly braces, even for single line statements.
Move declaration of ignore inside the curly braces.
Attachment #8445025 -
Flags: feedback?(dhylands)
Updated•11 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Comment 3•11 years ago
|
||
In this patch, I rename DispatchMountChangeEvent to be DispatchStatusChangeEvent and create a DispatchStorageStatusChangeEvent function for the storage-status.
Attachment #8445025 -
Attachment is obsolete: true
Attachment #8448593 -
Flags: review?(dhylands)
Comment 4•11 years ago
|
||
Comment on attachment 8448593 [details] [diff] [review]
(0701) Trigger a storage-state-change event when there is volume state change
Review of attachment 8448593 [details] [diff] [review]:
-----------------------------------------------------------------
Just one nit on one of the variable names. Otherwise this looks good.
Thanks
::: dom/devicestorage/nsDeviceStorage.cpp
@@ +4285,4 @@
> }
>
> DeviceStorageFile dsf(mStorageType, mStorageName);
> + nsString status, volumeStatus;
nit: Let's call this storageStatus instead of volumeStatus
Attachment #8448593 -
Flags: review?(dhylands) → review+
Updated•11 years ago
|
feature-b2g: --- → 2.1
Assignee | ||
Comment 5•11 years ago
|
||
Here is the try server result. It looks fine.
https://tbpl.mozilla.org/?tree=Try&rev=906d34133161
Attachment #8448593 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 6•11 years ago
|
||
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.0 S6 (18july)
You need to log in
before you can comment on or make changes to this bug.
Description
•