Always call StorageMonitor::RemoveObserver in ~MediaFileSystemRegistry.
To make ObserverListThreadSafe TaskScheduler-friendly, we plan to
dispatch notifications to observers in separate tasks (previously,
observers registered from the same thread were notified in the
same task). This change causes a use-after-free in
1. StorageMonitor sends a notification to its observers.
2. The notification is dispatched to GalleryWatchManager, which
requests the loop to exit after the current task (ConfirmWatch).
3. StorageMonitor is destroyed.
4. MediaFileSystemRegistry is destroyed. Because StorageMonitor has
already been destroyed, it doesn't call
5. TestBrowserThreadBundle is destroyed. In its destructor, it
dispatches the notification to the deleted MediaFileSystemRegistry,
which causes a use-after-free.
When observers registered from the same thread are notified from
the same task, MediaFileSystemRegistry is notified before the
loop exits (and hence no notification is dispatched to a deleted
MediaFileSystemRegistry in step 5).
This CL moves step 4 before step 3. This allows
MediaFileSystemRegistry to call StorageMonitor::RemoveObserver
from its destructor and prevents it from receiving notifications
after being destroyed.