FirefoxOS/Device Storage/Worker Design: Difference between revisions

add notes about file watcher notifications
(fix title, re: volume manager vs service)
(add notes about file watcher notifications)
Line 43: Line 43:


Ideally the concept of overrideRootDir would be abstracted if possible so that nsDOMDeviceStorage can ignore it.
Ideally the concept of overrideRootDir would be abstracted if possible so that nsDOMDeviceStorage can ignore it.
=== Type checker (DeviceStorageTypeChecker) ===
The string bundle service can only be accessed on the main thread and should be initialized as part of the preferences.


== Consolidate and cache use of permissions ==
== Consolidate and cache use of permissions ==
Line 85: Line 89:


Rather than accept nsDOMDeviceStorage objects directly, it should define an interface which it implements so that other objects (i.e. DeviceStorageAreaListener) may reuse the same module to receive volume state change notifications.
Rather than accept nsDOMDeviceStorage objects directly, it should define an interface which it implements so that other objects (i.e. DeviceStorageAreaListener) may reuse the same module to receive volume state change notifications.
== Type checker (DeviceStorageTypeChecker) ==
The string bundle service can only be accessed on the main thread. This module will need to be initialized / destroyed by nsLayoutStatics::Initialize / ClearOnShutdown. It is otherwise thread safe already.


== Used space cache (DeviceStorageUsedSpaceCache) ==
== Used space cache (DeviceStorageUsedSpaceCache) ==
Line 129: Line 129:


If it is possible (unconfirmed) to have an IPC object for each worker thread, then the thread context switch could be avoided.
If it is possible (unconfirmed) to have an IPC object for each worker thread, then the thread context switch could be avoided.
== Move file watcher notifications off main thread ==
The file-watcher-notify and file-watcher-update events use the observer service and thus must be sent and received on the main thread. We should investigate moving away from this to allow using other threads and avoiding the context switches. This is primarily between MTP and device storage although there may be other users of these events.


== Code reorganization ==
== Code reorganization ==


* Remove nsIDOMDeviceStorageXXX.idl files, these are not used in gecko nor gaia.
* Modules which have an inherent main thread dependency (i.e. observers, preferences) should be moved outside nsDeviceStorage.cpp to a dedicated file.
* Modules which have an inherent main thread dependency (i.e. observers, preferences) should be moved outside nsDeviceStorage.cpp to a dedicated file.
* There is code duplication between nsDOMDeviceStorage and DeviceStorageParent; this should be consolidated into a dedicated module/file that both depend. This equally applies to a potential switch to the POSIX IPC APIs.
* There is code duplication between nsDOMDeviceStorage and DeviceStorageParent; this should be consolidated into a dedicated module/file that both depend. This equally applies to a potential switch to the POSIX IPC APIs.
24

edits