Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: webrtc/modules/desktop_capture/screen_capturer_mac.mm

Issue 1743203002: Replace scoped_ptr with unique_ptr in webrtc/modules/desktop_capture/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: More Windows reverts Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/modules/desktop_capture/screen_capturer.h" 11 #include "webrtc/modules/desktop_capture/screen_capturer.h"
12 12
13 #include <stddef.h> 13 #include <stddef.h>
14
15 #include <memory>
14 #include <set> 16 #include <set>
15 17
16 #include <ApplicationServices/ApplicationServices.h> 18 #include <ApplicationServices/ApplicationServices.h>
17 #include <Cocoa/Cocoa.h> 19 #include <Cocoa/Cocoa.h>
18 #include <dlfcn.h> 20 #include <dlfcn.h>
19 #include <IOKit/pwr_mgt/IOPMLib.h> 21 #include <IOKit/pwr_mgt/IOPMLib.h>
20 #include <OpenGL/CGLMacro.h> 22 #include <OpenGL/CGLMacro.h>
21 #include <OpenGL/OpenGL.h> 23 #include <OpenGL/OpenGL.h>
22 24
23 #include "webrtc/base/macutils.h" 25 #include "webrtc/base/macutils.h"
24 #include "webrtc/base/scoped_ptr.h"
25 #include "webrtc/modules/desktop_capture/desktop_capture_options.h" 26 #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
26 #include "webrtc/modules/desktop_capture/desktop_frame.h" 27 #include "webrtc/modules/desktop_capture/desktop_frame.h"
27 #include "webrtc/modules/desktop_capture/desktop_geometry.h" 28 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
28 #include "webrtc/modules/desktop_capture/desktop_region.h" 29 #include "webrtc/modules/desktop_capture/desktop_region.h"
29 #include "webrtc/modules/desktop_capture/mac/desktop_configuration.h" 30 #include "webrtc/modules/desktop_capture/mac/desktop_configuration.h"
30 #include "webrtc/modules/desktop_capture/mac/desktop_configuration_monitor.h" 31 #include "webrtc/modules/desktop_capture/mac/desktop_configuration_monitor.h"
31 #include "webrtc/modules/desktop_capture/mac/scoped_pixel_buffer_object.h" 32 #include "webrtc/modules/desktop_capture/mac/scoped_pixel_buffer_object.h"
32 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h" 33 #include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h"
33 #include "webrtc/modules/desktop_capture/screen_capturer_helper.h" 34 #include "webrtc/modules/desktop_capture/screen_capturer_helper.h"
34 #include "webrtc/system_wrappers/include/logging.h" 35 #include "webrtc/system_wrappers/include/logging.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 frame->data() + (frame->size().height() - 1) * frame->stride(), 295 frame->data() + (frame->size().height() - 1) * frame->stride(),
295 frame->shared_memory()), 296 frame->shared_memory()),
296 original_frame_(frame) { 297 original_frame_(frame) {
297 set_dpi(frame->dpi()); 298 set_dpi(frame->dpi());
298 set_capture_time_ms(frame->capture_time_ms()); 299 set_capture_time_ms(frame->capture_time_ms());
299 mutable_updated_region()->Swap(frame->mutable_updated_region()); 300 mutable_updated_region()->Swap(frame->mutable_updated_region());
300 } 301 }
301 virtual ~InvertedDesktopFrame() {} 302 virtual ~InvertedDesktopFrame() {}
302 303
303 private: 304 private:
304 rtc::scoped_ptr<DesktopFrame> original_frame_; 305 std::unique_ptr<DesktopFrame> original_frame_;
305 306
306 RTC_DISALLOW_COPY_AND_ASSIGN(InvertedDesktopFrame); 307 RTC_DISALLOW_COPY_AND_ASSIGN(InvertedDesktopFrame);
307 }; 308 };
308 309
309 ScreenCapturerMac::ScreenCapturerMac( 310 ScreenCapturerMac::ScreenCapturerMac(
310 rtc::scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor) 311 rtc::scoped_refptr<DesktopConfigurationMonitor> desktop_config_monitor)
311 : callback_(NULL), 312 : callback_(NULL),
312 cgl_context_(NULL), 313 cgl_context_(NULL),
313 current_display_(0), 314 current_display_(0),
314 dip_to_pixel_scale_(1.0f), 315 dip_to_pixel_scale_(1.0f),
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 CGScreenUpdateMoveDelta delta, 951 CGScreenUpdateMoveDelta delta,
951 size_t count, 952 size_t count,
952 const CGRect* rect_array, 953 const CGRect* rect_array,
953 void* user_parameter) { 954 void* user_parameter) {
954 ScreenCapturerMac* capturer = 955 ScreenCapturerMac* capturer =
955 reinterpret_cast<ScreenCapturerMac*>(user_parameter); 956 reinterpret_cast<ScreenCapturerMac*>(user_parameter);
956 capturer->ScreenUpdateMove(delta, count, rect_array); 957 capturer->ScreenUpdateMove(delta, count, rect_array);
957 } 958 }
958 959
959 DesktopFrame* ScreenCapturerMac::CreateFrame() { 960 DesktopFrame* ScreenCapturerMac::CreateFrame() {
960 rtc::scoped_ptr<DesktopFrame> frame( 961 std::unique_ptr<DesktopFrame> frame(
961 new BasicDesktopFrame(screen_pixel_bounds_.size())); 962 new BasicDesktopFrame(screen_pixel_bounds_.size()));
962 963
963 frame->set_dpi(DesktopVector(kStandardDPI * dip_to_pixel_scale_, 964 frame->set_dpi(DesktopVector(kStandardDPI * dip_to_pixel_scale_,
964 kStandardDPI * dip_to_pixel_scale_)); 965 kStandardDPI * dip_to_pixel_scale_));
965 return frame.release(); 966 return frame.release();
966 } 967 }
967 968
968 } // namespace 969 } // namespace
969 970
970 // static 971 // static
971 ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) { 972 ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) {
972 if (!options.configuration_monitor()) 973 if (!options.configuration_monitor())
973 return NULL; 974 return NULL;
974 975
975 rtc::scoped_ptr<ScreenCapturerMac> capturer( 976 std::unique_ptr<ScreenCapturerMac> capturer(
976 new ScreenCapturerMac(options.configuration_monitor())); 977 new ScreenCapturerMac(options.configuration_monitor()));
977 if (!capturer->Init()) 978 if (!capturer->Init())
978 capturer.reset(); 979 capturer.reset();
979 return capturer.release(); 980 return capturer.release();
980 } 981 }
981 982
982 } // namespace webrtc 983 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698