Merge mozilla-central to autoland

This commit is contained in:
Carsten "Tomcat" Book 2017-07-25 17:46:57 +02:00
commit 34dc6e1a1d
2 changed files with 13 additions and 46 deletions

View File

@ -29,7 +29,6 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/macutils.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/timeutils.h"
#include "webrtc/modules/desktop_capture/desktop_capturer.h"
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
@ -332,14 +331,6 @@ class ScreenCapturerMac : public DesktopCapturer {
size_t count,
const CGRect *rect_array,
void *user_parameter);
struct ScreenCallbackData {
explicit ScreenCallbackData(ScreenCapturerMac* capturer)
: capturer(capturer) {}
rtc::CriticalSection crit_sect_;
ScreenCapturerMac* GUARDED_BY(crit_sect_) capturer;
};
ScreenCallbackData* screen_callback_data_;
#endif
std::unique_ptr<DesktopFrame> CreateFrame();
@ -426,8 +417,7 @@ class InvertedDesktopFrame : public DesktopFrame {
ScreenCapturerMac::ScreenCapturerMac(
rtc::scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor)
: screen_callback_data_(new ScreenCallbackData(this))
, desktop_config_monitor_(desktop_config_monitor) {
: desktop_config_monitor_(desktop_config_monitor) {
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
display_stream_manager_ = new DisplayStreamManager;
@ -436,8 +426,7 @@ ScreenCapturerMac::ScreenCapturerMac(
ScreenCapturerMac::~ScreenCapturerMac() {
ReleaseBuffers();
rtc::CritScope lock(&screen_callback_data_->crit_sect_);
screen_callback_data_->capturer = nullptr;
UnregisterRefreshAndMoveHandlers();
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
display_stream_manager_->PrepareForSelfDestruction();
@ -1045,14 +1034,14 @@ bool ScreenCapturerMac::RegisterRefreshAndMoveHandlers() {
}
#else
CGError err = CGRegisterScreenRefreshCallback(
ScreenCapturerMac::ScreenRefreshCallback, screen_callback_data_);
ScreenCapturerMac::ScreenRefreshCallback, this);
if (err != kCGErrorSuccess) {
LOG(LS_ERROR) << "CGRegisterScreenRefreshCallback " << err;
return false;
}
err = CGScreenRegisterMoveCallback(
ScreenCapturerMac::ScreenUpdateMoveCallback, screen_callback_data_);
ScreenCapturerMac::ScreenUpdateMoveCallback, this);
if (err != kCGErrorSuccess) {
LOG(LS_ERROR) << "CGScreenRegisterMoveCallback " << err;
return false;
@ -1109,22 +1098,11 @@ void ScreenCapturerMac::ScreenUpdateMove(CGScreenUpdateMoveDelta delta,
void ScreenCapturerMac::ScreenRefreshCallback(CGRectCount count,
const CGRect* rect_array,
void* user_parameter) {
ScreenCallbackData* screen_callback_data =
reinterpret_cast<ScreenCallbackData*>(user_parameter);
rtc::CritScope lock(&screen_callback_data->crit_sect_);
if (!screen_callback_data->capturer) {
CGUnregisterScreenRefreshCallback(
ScreenCapturerMac::ScreenRefreshCallback, screen_callback_data);
CGScreenUnregisterMoveCallback(
ScreenCapturerMac::ScreenUpdateMoveCallback, screen_callback_data);
delete screen_callback_data;
return;
}
if (screen_callback_data->capturer->screen_pixel_bounds_.is_empty())
screen_callback_data->capturer->ScreenConfigurationChanged();
screen_callback_data->capturer->ScreenRefresh(count, rect_array);
ScreenCapturerMac* capturer =
reinterpret_cast<ScreenCapturerMac*>(user_parameter);
if (capturer->screen_pixel_bounds_.is_empty())
capturer->ScreenConfigurationChanged();
capturer->ScreenRefresh(count, rect_array);
}
void ScreenCapturerMac::ScreenUpdateMoveCallback(
@ -1132,20 +1110,9 @@ void ScreenCapturerMac::ScreenUpdateMoveCallback(
size_t count,
const CGRect* rect_array,
void* user_parameter) {
ScreenCallbackData* screen_callback_data =
reinterpret_cast<ScreenCallbackData*>(user_parameter);
rtc::CritScope lock(&screen_callback_data->crit_sect_);
if (!screen_callback_data->capturer) {
CGUnregisterScreenRefreshCallback(
ScreenCapturerMac::ScreenRefreshCallback, screen_callback_data);
CGScreenUnregisterMoveCallback(
ScreenCapturerMac::ScreenUpdateMoveCallback, screen_callback_data);
delete screen_callback_data;
return;
}
screen_callback_data->capturer->ScreenUpdateMove(delta, count, rect_array);
ScreenCapturerMac* capturer =
reinterpret_cast<ScreenCapturerMac*>(user_parameter);
capturer->ScreenUpdateMove(delta, count, rect_array);
}
#endif

View File

@ -307,7 +307,7 @@ class MachCommands(MachCommandBase):
return actions.trigger_action_callback(
task_group_id=task_group_id,
tsak_id=task_id,
task_id=task_id,
task=task,
input=input,
callback=callback,