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

Side by Side Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 1416493010: Clean up Mac swap acknowledgement code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update latency info Created 5 years, 1 month 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
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.h ('k') | ui/views/widget/native_widget_mac_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ui/views/cocoa/bridged_native_widget.h" 5 #import "ui/views/cocoa/bridged_native_widget.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #import "base/mac/foundation_util.h" 10 #import "base/mac/foundation_util.h"
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 return base::Closure(); 881 return base::Closure();
882 } 882 }
883 883
884 //////////////////////////////////////////////////////////////////////////////// 884 ////////////////////////////////////////////////////////////////////////////////
885 // BridgedNativeWidget, AcceleratedWidgetMac: 885 // BridgedNativeWidget, AcceleratedWidgetMac:
886 886
887 NSView* BridgedNativeWidget::AcceleratedWidgetGetNSView() const { 887 NSView* BridgedNativeWidget::AcceleratedWidgetGetNSView() const {
888 return compositor_superview_; 888 return compositor_superview_;
889 } 889 }
890 890
891 bool BridgedNativeWidget::AcceleratedWidgetShouldIgnoreBackpressure() const {
892 return true;
893 }
894
895 void BridgedNativeWidget::AcceleratedWidgetGetVSyncParameters( 891 void BridgedNativeWidget::AcceleratedWidgetGetVSyncParameters(
896 base::TimeTicks* timebase, base::TimeDelta* interval) const { 892 base::TimeTicks* timebase, base::TimeDelta* interval) const {
897 // TODO(tapted): Add vsync support. 893 // TODO(tapted): Add vsync support.
898 *timebase = base::TimeTicks(); 894 *timebase = base::TimeTicks();
899 *interval = base::TimeDelta(); 895 *interval = base::TimeDelta();
900 } 896 }
901 897
902 void BridgedNativeWidget::AcceleratedWidgetSwapCompleted( 898 void BridgedNativeWidget::AcceleratedWidgetSwapCompleted() {
903 const std::vector<ui::LatencyInfo>& latency_info) {
904 // Ignore frames arriving "late" for an old size. A frame at the new size 899 // Ignore frames arriving "late" for an old size. A frame at the new size
905 // should arrive soon. 900 // should arrive soon.
906 if (!compositor_widget_->HasFrameOfSize(GetClientAreaSize())) 901 if (!compositor_widget_->HasFrameOfSize(GetClientAreaSize()))
907 return; 902 return;
908 903
909 if (invalidate_shadow_on_frame_swap_) { 904 if (invalidate_shadow_on_frame_swap_) {
910 invalidate_shadow_on_frame_swap_ = false; 905 invalidate_shadow_on_frame_swap_ = false;
911 [window_ invalidateShadow]; 906 [window_ invalidateShadow];
912 } 907 }
913 } 908 }
914 909
915 void BridgedNativeWidget::AcceleratedWidgetHitError() {
916 compositor_->ScheduleFullRedraw();
917 }
918
919 //////////////////////////////////////////////////////////////////////////////// 910 ////////////////////////////////////////////////////////////////////////////////
920 // BridgedNativeWidget, BridgedNativeWidgetOwner: 911 // BridgedNativeWidget, BridgedNativeWidgetOwner:
921 912
922 NSWindow* BridgedNativeWidget::GetNSWindow() { 913 NSWindow* BridgedNativeWidget::GetNSWindow() {
923 return window_; 914 return window_;
924 } 915 }
925 916
926 gfx::Vector2d BridgedNativeWidget::GetChildWindowOffset() const { 917 gfx::Vector2d BridgedNativeWidget::GetChildWindowOffset() const {
927 return gfx::ScreenRectFromNSRect([window_ frame]).OffsetFromOrigin(); 918 return gfx::ScreenRectFromNSRect([window_ frame]).OffsetFromOrigin();
928 } 919 }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 [bridged_view_ setMouseDownCanMoveWindow:draggable]; 1170 [bridged_view_ setMouseDownCanMoveWindow:draggable];
1180 // AppKit will not update its cache of mouseDownCanMoveWindow unless something 1171 // AppKit will not update its cache of mouseDownCanMoveWindow unless something
1181 // changes. Previously we tried adding an NSView and removing it, but for some 1172 // changes. Previously we tried adding an NSView and removing it, but for some
1182 // reason it required reposting the mouse-down event, and didn't always work. 1173 // reason it required reposting the mouse-down event, and didn't always work.
1183 // Calling the below seems to be an effective solution. 1174 // Calling the below seems to be an effective solution.
1184 [window_ setMovableByWindowBackground:NO]; 1175 [window_ setMovableByWindowBackground:NO];
1185 [window_ setMovableByWindowBackground:YES]; 1176 [window_ setMovableByWindowBackground:YES];
1186 } 1177 }
1187 1178
1188 } // namespace views 1179 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.h ('k') | ui/views/widget/native_widget_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698