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

Side by Side Diff: remoting/host/video_frame_capturer_mac.mm

Issue 11273027: Merge 163588 - [Chromoting] Fix crash on initial connection (Mac). (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1271/src/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/video_frame_capturer.h" 5 #include "remoting/host/video_frame_capturer.h"
6 6
7 #include <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 #include <Cocoa/Cocoa.h> 8 #include <Cocoa/Cocoa.h>
9 #include <dlfcn.h> 9 #include <dlfcn.h>
10 #include <IOKit/pwr_mgt/IOPMLib.h> 10 #include <IOKit/pwr_mgt/IOPMLib.h>
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 (*cgl_set_full_screen_)(cgl_context_); 740 (*cgl_set_full_screen_)(cgl_context_);
741 CGLSetCurrentContext(cgl_context_); 741 CGLSetCurrentContext(cgl_context_);
742 742
743 size_t buffer_size = desktop_bounds_.width() * desktop_bounds_.height() * 743 size_t buffer_size = desktop_bounds_.width() * desktop_bounds_.height() *
744 sizeof(uint32_t); 744 sizeof(uint32_t);
745 pixel_buffer_object_.Init(cgl_context_, buffer_size); 745 pixel_buffer_object_.Init(cgl_context_, buffer_size);
746 } 746 }
747 747
748 void VideoFrameCapturerMac::ScreenRefresh(CGRectCount count, 748 void VideoFrameCapturerMac::ScreenRefresh(CGRectCount count,
749 const CGRect* rect_array) { 749 const CGRect* rect_array) {
750 DCHECK(!desktop_bounds_.isEmpty());
750 SkIRect skirect_array[count]; 751 SkIRect skirect_array[count];
751 for (CGRectCount i = 0; i < count; ++i) { 752 for (CGRectCount i = 0; i < count; ++i) {
752 skirect_array[i] = CGRectToSkIRect(rect_array[i]); 753 skirect_array[i] = CGRectToSkIRect(rect_array[i]);
753 skirect_array[i].offset(-desktop_bounds_.left(), -desktop_bounds_.top()); 754 skirect_array[i].offset(-desktop_bounds_.left(), -desktop_bounds_.top());
754 } 755 }
755 SkRegion region; 756 SkRegion region;
756 region.setRects(skirect_array, count); 757 region.setRects(skirect_array, count);
757 InvalidateRegion(region); 758 InvalidateRegion(region);
758 } 759 }
759 760
(...skipping 29 matching lines...) Expand all
789 display_configuration_capture_event_.Signal(); 790 display_configuration_capture_event_.Signal();
790 } 791 }
791 } 792 }
792 } 793 }
793 794
794 void VideoFrameCapturerMac::ScreenRefreshCallback(CGRectCount count, 795 void VideoFrameCapturerMac::ScreenRefreshCallback(CGRectCount count,
795 const CGRect* rect_array, 796 const CGRect* rect_array,
796 void* user_parameter) { 797 void* user_parameter) {
797 VideoFrameCapturerMac* capturer = reinterpret_cast<VideoFrameCapturerMac*>( 798 VideoFrameCapturerMac* capturer = reinterpret_cast<VideoFrameCapturerMac*>(
798 user_parameter); 799 user_parameter);
800 if (capturer->desktop_bounds_.isEmpty()) {
801 capturer->ScreenConfigurationChanged();
802 }
799 capturer->ScreenRefresh(count, rect_array); 803 capturer->ScreenRefresh(count, rect_array);
800 } 804 }
801 805
802 void VideoFrameCapturerMac::ScreenUpdateMoveCallback( 806 void VideoFrameCapturerMac::ScreenUpdateMoveCallback(
803 CGScreenUpdateMoveDelta delta, 807 CGScreenUpdateMoveDelta delta,
804 size_t count, 808 size_t count,
805 const CGRect* rect_array, 809 const CGRect* rect_array,
806 void* user_parameter) { 810 void* user_parameter) {
807 VideoFrameCapturerMac* capturer = reinterpret_cast<VideoFrameCapturerMac*>( 811 VideoFrameCapturerMac* capturer = reinterpret_cast<VideoFrameCapturerMac*>(
808 user_parameter); 812 user_parameter);
(...skipping 15 matching lines...) Expand all
824 VideoFrameCapturer* VideoFrameCapturer::Create() { 828 VideoFrameCapturer* VideoFrameCapturer::Create() {
825 VideoFrameCapturerMac* capturer = new VideoFrameCapturerMac(); 829 VideoFrameCapturerMac* capturer = new VideoFrameCapturerMac();
826 if (!capturer->Init()) { 830 if (!capturer->Init()) {
827 delete capturer; 831 delete capturer;
828 capturer = NULL; 832 capturer = NULL;
829 } 833 }
830 return capturer; 834 return capturer;
831 } 835 }
832 836
833 } // namespace remoting 837 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698