tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

desktop_configuration_monitor.h (2038B)


      1 /*
      2 *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #ifndef MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_MONITOR_H_
     12 #define MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_MONITOR_H_
     13 
     14 #include <ApplicationServices/ApplicationServices.h>
     15 
     16 #include <memory>
     17 #include <set>
     18 
     19 #include "api/ref_counted_base.h"
     20 #include "modules/desktop_capture/mac/desktop_configuration.h"
     21 #include "rtc_base/synchronization/mutex.h"
     22 
     23 namespace webrtc {
     24 
     25 // The class provides functions to synchronize capturing and display
     26 // reconfiguring across threads, and the up-to-date MacDesktopConfiguration.
     27 class DesktopConfigurationMonitor final
     28    : public RefCountedNonVirtual<DesktopConfigurationMonitor> {
     29 public:
     30  DesktopConfigurationMonitor();
     31  ~DesktopConfigurationMonitor();
     32 
     33  DesktopConfigurationMonitor(const DesktopConfigurationMonitor&) = delete;
     34  DesktopConfigurationMonitor& operator=(const DesktopConfigurationMonitor&) =
     35      delete;
     36 
     37  // Returns the current desktop configuration.
     38  MacDesktopConfiguration desktop_configuration();
     39 
     40 private:
     41  static void DisplaysReconfiguredCallback(CGDirectDisplayID display,
     42                                           CGDisplayChangeSummaryFlags flags,
     43                                           void* user_parameter);
     44  void DisplaysReconfigured(CGDirectDisplayID display,
     45                            CGDisplayChangeSummaryFlags flags);
     46 
     47  Mutex desktop_configuration_lock_;
     48  MacDesktopConfiguration desktop_configuration_
     49      RTC_GUARDED_BY(&desktop_configuration_lock_);
     50  std::set<CGDirectDisplayID> reconfiguring_displays_;
     51 };
     52 
     53 }  // namespace webrtc
     54 
     55 #endif  // MODULES_DESKTOP_CAPTURE_MAC_DESKTOP_CONFIGURATION_MONITOR_H_