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 <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 2357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2368 pending_swap_ack_->gpu_host_id, | 2368 pending_swap_ack_->gpu_host_id, |
2369 ack_params); | 2369 ack_params); |
2370 pending_swap_ack_.reset(); | 2370 pending_swap_ack_.reset(); |
2371 TRACE_COUNTER_ID1("browser", "PendingSwapAck", this, 0); | 2371 TRACE_COUNTER_ID1("browser", "PendingSwapAck", this, 0); |
2372 } | 2372 } |
2373 | 2373 |
2374 void RenderWidgetHostViewMac::PauseForPendingResizeOrRepaintsAndDraw() { | 2374 void RenderWidgetHostViewMac::PauseForPendingResizeOrRepaintsAndDraw() { |
2375 if (!render_widget_host_ || render_widget_host_->is_hidden()) | 2375 if (!render_widget_host_ || render_widget_host_->is_hidden()) |
2376 return; | 2376 return; |
2377 | 2377 |
2378 // Pausing for the overlay view prevents the underlay from receiving | 2378 // Pausing for the overlay/underlay view prevents the other one from receiving |
2379 // frames. This may lead to large delays, causing overlaps. If both | 2379 // frames. This may lead to large delays, causing overlaps. |
2380 // overlay and underlay resize at the same time, let them both to have | 2380 // See crbug.com/352020. |
2381 // some time waiting. See crbug.com/352020. | 2381 if (underlay_view_ || overlay_view_) |
2382 if (underlay_view_ && | |
2383 underlay_view_->render_widget_host_ && | |
2384 !underlay_view_->render_widget_host_-> | |
2385 CanPauseForPendingResizeOrRepaints()) | |
2386 return; | 2382 return; |
2387 | 2383 |
2388 // Ensure that all frames are acked before waiting for a frame to come in. | 2384 // Ensure that all frames are acked before waiting for a frame to come in. |
2389 // Note that we will draw a frame at the end of this function, so it is safe | 2385 // Note that we will draw a frame at the end of this function, so it is safe |
2390 // to ack a never-drawn frame here. | 2386 // to ack a never-drawn frame here. |
2391 SendPendingSwapAck(); | 2387 SendPendingSwapAck(); |
2392 | 2388 |
2393 // Wait for a frame of the right size to come in. | 2389 // Wait for a frame of the right size to come in. |
2394 render_widget_host_->PauseForPendingResizeOrRepaints(); | 2390 render_widget_host_->PauseForPendingResizeOrRepaints(); |
2395 | 2391 |
(...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4429 } | 4425 } |
4430 | 4426 |
4431 - (void)disableRendering { | 4427 - (void)disableRendering { |
4432 // Disable the fade-out animation as the layer is removed. | 4428 // Disable the fade-out animation as the layer is removed. |
4433 ScopedCAActionDisabler disabler; | 4429 ScopedCAActionDisabler disabler; |
4434 [self removeFromSuperlayer]; | 4430 [self removeFromSuperlayer]; |
4435 renderWidgetHostView_ = nil; | 4431 renderWidgetHostView_ = nil; |
4436 } | 4432 } |
4437 | 4433 |
4438 @end // implementation SoftwareLayer | 4434 @end // implementation SoftwareLayer |
OLD | NEW |