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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 408153002: Mac: Fix janky YouTube animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 // 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 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 AddPendingSwapAck(params.route_id, 1771 AddPendingSwapAck(params.route_id,
1772 gpu_host_id, 1772 gpu_host_id,
1773 compositing_iosurface_ ? 1773 compositing_iosurface_ ?
1774 compositing_iosurface_->GetRendererID() : 0); 1774 compositing_iosurface_->GetRendererID() : 0);
1775 CompositorSwapBuffers(IOSurfaceIDFromSurfaceHandle(params.surface_handle), 1775 CompositorSwapBuffers(IOSurfaceIDFromSurfaceHandle(params.surface_handle),
1776 params.surface_size, 1776 params.surface_size,
1777 params.surface_scale_factor, 1777 params.surface_scale_factor,
1778 params.latency_info); 1778 params.latency_info);
1779 } 1779 }
1780 1780
1781 void RenderWidgetHostViewMac::AcceleratedSurfaceSuspend() { 1781 void RenderWidgetHostViewMac::AcceleratedSurfaceSuspend() {
ccameron 2014/07/22 06:40:42 I grabbed this while in the neighborhood. It made
1782 if (compositing_iosurface_) 1782 if (render_widget_host_->is_hidden())
1783 compositing_iosurface_->UnrefIOSurface(); 1783 DestroyCompositedIOSurfaceAndLayer();
1784 } 1784 }
1785 1785
1786 void RenderWidgetHostViewMac::AcceleratedSurfaceRelease() { 1786 void RenderWidgetHostViewMac::AcceleratedSurfaceRelease() {
1787 DestroyCompositedIOSurfaceAndLayer(); 1787 DestroyCompositedIOSurfaceAndLayer();
1788 } 1788 }
1789 1789
1790 bool RenderWidgetHostViewMac::HasAcceleratedSurface( 1790 bool RenderWidgetHostViewMac::HasAcceleratedSurface(
1791 const gfx::Size& desired_size) { 1791 const gfx::Size& desired_size) {
1792 if (compositing_iosurface_) { 1792 if (compositing_iosurface_) {
1793 return compositing_iosurface_->HasIOSurface() && 1793 return compositing_iosurface_->HasIOSurface() &&
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
2172 // to ack a never-drawn frame here. 2172 // to ack a never-drawn frame here.
2173 SendPendingSwapAck(); 2173 SendPendingSwapAck();
2174 2174
2175 // Wait for a frame of the right size to come in. 2175 // Wait for a frame of the right size to come in.
2176 render_widget_host_->PauseForPendingResizeOrRepaints(); 2176 render_widget_host_->PauseForPendingResizeOrRepaints();
2177 2177
2178 // Immediately draw any frames that haven't been drawn yet. This is necessary 2178 // Immediately draw any frames that haven't been drawn yet. This is necessary
2179 // to keep the window and the window's contents in sync. 2179 // to keep the window and the window's contents in sync.
2180 [cocoa_view_ displayIfNeeded]; 2180 [cocoa_view_ displayIfNeeded];
2181 [software_layer_ displayIfNeeded]; 2181 [software_layer_ displayIfNeeded];
2182 [compositing_iosurface_layer_ displayIfNeeded]; 2182 [compositing_iosurface_layer_ displayIfNeededAndAck];
2183 } 2183 }
2184 2184
2185 void RenderWidgetHostViewMac::LayoutLayers() { 2185 void RenderWidgetHostViewMac::LayoutLayers() {
2186 if (delegated_frame_host_) { 2186 if (delegated_frame_host_) {
2187 return; 2187 return;
2188 } 2188 }
2189 2189
2190 // Disable animation of the layer's resizing or change in contents scale. 2190 // Disable animation of the layer's resizing or change in contents scale.
2191 ScopedCAActionDisabler disabler; 2191 ScopedCAActionDisabler disabler;
2192 2192
(...skipping 23 matching lines...) Expand all
2216 [compositing_iosurface_layer_ setBounds:layer_bounds]; 2216 [compositing_iosurface_layer_ setBounds:layer_bounds];
2217 2217
2218 // If the bounds changed, then draw the frame immediately, to ensure that 2218 // If the bounds changed, then draw the frame immediately, to ensure that
2219 // content displayed is in sync with the window size. 2219 // content displayed is in sync with the window size.
2220 if (bounds_changed) { 2220 if (bounds_changed) {
2221 // Also, sometimes, especially when infobars are being removed, the 2221 // Also, sometimes, especially when infobars are being removed, the
2222 // setNeedsDisplay calls are dropped on the floor, and stale content is 2222 // setNeedsDisplay calls are dropped on the floor, and stale content is
2223 // displayed. Calling displayIfNeeded will ensure that the right size 2223 // displayed. Calling displayIfNeeded will ensure that the right size
2224 // frame is drawn to the screen. 2224 // frame is drawn to the screen.
2225 // http://crbug.com/350817 2225 // http://crbug.com/350817
2226 [compositing_iosurface_layer_ setNeedsDisplay]; 2226 [compositing_iosurface_layer_ setNeedsDisplayAndDisplayAndAck];
2227 [compositing_iosurface_layer_ displayIfNeeded];
2228 } 2227 }
2229 } 2228 }
2230 } 2229 }
2231 2230
2232 SkColorType RenderWidgetHostViewMac::PreferredReadbackFormat() { 2231 SkColorType RenderWidgetHostViewMac::PreferredReadbackFormat() {
2233 return kN32_SkColorType; 2232 return kN32_SkColorType;
2234 } 2233 }
2235 2234
2236 //////////////////////////////////////////////////////////////////////////////// 2235 ////////////////////////////////////////////////////////////////////////////////
2237 // CompositingIOSurfaceLayerClient, public: 2236 // CompositingIOSurfaceLayerClient, public:
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
3987 3986
3988 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3987 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3989 // regions that are not draggable. (See ControlRegionView in 3988 // regions that are not draggable. (See ControlRegionView in
3990 // native_app_window_cocoa.mm). This requires the render host view to be 3989 // native_app_window_cocoa.mm). This requires the render host view to be
3991 // draggable by default. 3990 // draggable by default.
3992 - (BOOL)mouseDownCanMoveWindow { 3991 - (BOOL)mouseDownCanMoveWindow {
3993 return YES; 3992 return YES;
3994 } 3993 }
3995 3994
3996 @end 3995 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698