Add ScopedAllowBaseSyncPrimitives for DesktopConfigurationMonitor.

This is a temporary measure until the synchronization method
used in the class, gets fixed.

Bug: chromium:796889, chromium:795340
Change-Id: Ie3d394ae42f005e8e0f353d04ea9c1d053ea9fd2
Reviewed-on: https://webrtc-review.googlesource.com/40460
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21812}
This commit is contained in:
Tommi 2018-01-17 23:30:51 +01:00 committed by Commit Bot
parent 001546da95
commit 0a3593c25d

View File

@ -11,6 +11,7 @@
#include "modules/desktop_capture/mac/desktop_configuration_monitor.h"
#include "modules/desktop_capture/mac/desktop_configuration.h"
#include "rtc_base/event.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/event_wrapper.h"
@ -41,6 +42,9 @@ DesktopConfigurationMonitor::~DesktopConfigurationMonitor() {
}
void DesktopConfigurationMonitor::Lock() {
// TODO(crbug.com/796889, crbug.com/795340): Fix how synchronization is being
// done and avoid blocking waits.
rtc::ScopedAllowBaseSyncPrimitives allow_event_wait;
if (!display_configuration_capture_event_->Wait(
kDisplayConfigurationEventTimeoutMs)) {
RTC_LOG_F(LS_ERROR) << "Event wait timed out.";
@ -70,6 +74,10 @@ void DesktopConfigurationMonitor::DisplaysReconfigured(
// If this is the first display to start reconfiguring then wait on
// |display_configuration_capture_event_| to block the capture thread
// from accessing display memory until the reconfiguration completes.
// TODO(crbug.com/796889, crbug.com/795340): Fix how synchronization is
// being done and avoid blocking waits.
rtc::ScopedAllowBaseSyncPrimitives allow_event_wait;
if (!display_configuration_capture_event_->Wait(
kDisplayConfigurationEventTimeoutMs)) {
RTC_LOG_F(LS_ERROR) << "Event wait timed out.";