OLD | NEW |
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 "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
10 | 10 |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 switches::kDisableGpuVsync); | 732 switches::kDisableGpuVsync); |
733 if (is_vsync_disabled) | 733 if (is_vsync_disabled) |
734 return; | 734 return; |
735 | 735 |
736 NSScreen* screen = [[cocoa_view_ window] screen]; | 736 NSScreen* screen = [[cocoa_view_ window] screen]; |
737 NSDictionary* screen_description = [screen deviceDescription]; | 737 NSDictionary* screen_description = [screen deviceDescription]; |
738 NSNumber* screen_number = [screen_description objectForKey:@"NSScreenNumber"]; | 738 NSNumber* screen_number = [screen_description objectForKey:@"NSScreenNumber"]; |
739 CGDirectDisplayID display_id = [screen_number unsignedIntValue]; | 739 CGDirectDisplayID display_id = [screen_number unsignedIntValue]; |
740 | 740 |
741 display_link_ = DisplayLinkMac::GetForDisplay(display_id); | 741 display_link_ = DisplayLinkMac::GetForDisplay(display_id); |
742 if (!display_link_) { | 742 if (!display_link_.get()) { |
743 // Note that on some headless systems, the display link will fail to be | 743 // Note that on some headless systems, the display link will fail to be |
744 // created, so this should not be a fatal error. | 744 // created, so this should not be a fatal error. |
745 LOG(ERROR) << "Failed to create display link."; | 745 LOG(ERROR) << "Failed to create display link."; |
746 } | 746 } |
747 } | 747 } |
748 | 748 |
749 void RenderWidgetHostViewMac::SendVSyncParametersToRenderer() { | 749 void RenderWidgetHostViewMac::SendVSyncParametersToRenderer() { |
750 if (!render_widget_host_ || !display_link_) | 750 if (!render_widget_host_ || !display_link_.get()) |
751 return; | 751 return; |
752 | 752 |
753 if (!display_link_->GetVSyncParameters(&vsync_timebase_, &vsync_interval_)) { | 753 if (!display_link_->GetVSyncParameters(&vsync_timebase_, &vsync_interval_)) { |
754 vsync_timebase_ = base::TimeTicks(); | 754 vsync_timebase_ = base::TimeTicks(); |
755 vsync_interval_ = base::TimeDelta(); | 755 vsync_interval_ = base::TimeDelta(); |
756 return; | 756 return; |
757 } | 757 } |
758 | 758 |
759 render_widget_host_->UpdateVSyncParameters(vsync_timebase_, vsync_interval_); | 759 render_widget_host_->UpdateVSyncParameters(vsync_timebase_, vsync_interval_); |
760 } | 760 } |
(...skipping 2583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3344 | 3344 |
3345 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3345 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3346 // regions that are not draggable. (See ControlRegionView in | 3346 // regions that are not draggable. (See ControlRegionView in |
3347 // native_app_window_cocoa.mm). This requires the render host view to be | 3347 // native_app_window_cocoa.mm). This requires the render host view to be |
3348 // draggable by default. | 3348 // draggable by default. |
3349 - (BOOL)mouseDownCanMoveWindow { | 3349 - (BOOL)mouseDownCanMoveWindow { |
3350 return YES; | 3350 return YES; |
3351 } | 3351 } |
3352 | 3352 |
3353 @end | 3353 @end |
OLD | NEW |