DeviceMonitorMac: move CrAVFoundationDeviceObserver and most of...
DeviceMonitorMac: move CrAVFoundationDeviceObserver and most of SuspendObserverDelegate to UI Thread (tl; dr : Move all operations to UI thread except device enumerations.) CrAVFoundationObserver was located in Device Thread based on the assumption that OS KVO callbacks would come on that thread too, but instead they come from UI thread. -observeValueForKeyPath:... is then called in UI thread, and since the rest of the actions of the class are small, this CL moves the whole class to UI thread. Its overlord SuspendObserverDelegate (best not use acronyms for its name :) ), however, lives a mixed life in UI and Device threads. The model is simplified by making it work always in UI thread _except_ for device enumerations (done via [AVCaptureDeviceglue devices]). AVFoundationMonitorImpl will destroy SuspendObserverDelegate in UI thread and that in turn destroys CrAVFoundationObserver in that very thread, thus cleaning up the multi threading and hopefully addressing the bug reports of a small but consistent crash rate (~2 crashes every four canaries or so). UI Thread checks are added everywhere. The code around CrAVFoundationDeviceObserver::dealloc and -stopObserving is refactored in order to avoid a redundant search-for-device in |monitoredDevices_|. BUG=366087 Review URL: https://codereview.chromium.org/368613002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282723 0039d316-1c4b-4281-b951-d872f2087c98
Showing
This diff is collapsed.
Please register or sign in to comment