DeviceMonitorMac AVFoundation: move mgmt of |suspend_observer_| to a class living in Device Thread.
This CL addresses a potential problem due to a race: |suspend_observer_| [1] could have been deallocated in ~AVFoundationMonitorImpl while still being in use in Device Thread [2]. This race didn't show up in normal circumstances since it needed the Device Thread to be active for a very short time; xians@ stumbled upon it during some unrelated code activities that made a browser_test fail. This CL then cleans up the management of |suspend_observer_| from the AVFoundationMonitorImpl to a new class SuspendObserverDelegate, the former living exclusively in UI thread, the latter in Device Thread. SuspendObserverDelegate gets the Device Thread parts of AVFoundationMonitorImpl. The new class sits between AVFoundationMonitorImpl and the Objective-C++ CrAVFoundationDeviceObserver. [1] https://code.google.com/p/chromium/codesearch#chromium/src/content/browser/device_monitor_mac.mm&sq=package:chromium&type=cs&l=259 [2] https://code.google.com/p/chromium/codesearch#chromium/src/content/browser/device_monitor_mac.mm&sq=package:chromium&type=cs&l=336 BUG=288562, 372418 Review URL: https://codereview.chromium.org/276573009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271438 0039d316-1c4b-4281-b951-d872f2087c98
Showing
Please register or sign in to comment