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

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

Issue 996453002: Allow ui::Compositor to disable commits during tab-switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up version Created 5 years, 9 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 browser_compositor_->compositor()->SetHostHasTransparentBackground( 608 browser_compositor_->compositor()->SetHostHasTransparentBackground(
609 !GetBackgroundOpaque()); 609 !GetBackgroundOpaque());
610 browser_compositor_->accelerated_widget_mac()->SetNSView(this); 610 browser_compositor_->accelerated_widget_mac()->SetNSView(this);
611 browser_compositor_state_ = BrowserCompositorSuspended; 611 browser_compositor_state_ = BrowserCompositorSuspended;
612 } 612 }
613 613
614 // Show the DelegatedFrameHost to transition from Suspended -> Active. 614 // Show the DelegatedFrameHost to transition from Suspended -> Active.
615 if (browser_compositor_state_ == BrowserCompositorSuspended) { 615 if (browser_compositor_state_ == BrowserCompositorSuspended) {
616 delegated_frame_host_->SetCompositor(browser_compositor_->compositor()); 616 delegated_frame_host_->SetCompositor(browser_compositor_->compositor());
617 delegated_frame_host_->WasShown(ui::LatencyInfo()); 617 delegated_frame_host_->WasShown(ui::LatencyInfo());
618 // Unsuspend the browser compositor after showing the delegated frame host.
619 // If there is not a saved delegated frame, then the delegated frame host
620 // will keep the compositor locked until a delegated frame is swapped.
621 float scale_factor = ViewScaleFactor();
622 browser_compositor_->compositor()->SetScaleAndSize(
623 scale_factor,
624 gfx::ConvertSizeToPixel(scale_factor, GetViewBounds().size()));
625 browser_compositor_->Unsuspend();
618 browser_compositor_state_ = BrowserCompositorActive; 626 browser_compositor_state_ = BrowserCompositorActive;
619 } 627 }
620 } 628 }
621 629
622 void RenderWidgetHostViewMac::SuspendBrowserCompositorView() { 630 void RenderWidgetHostViewMac::SuspendBrowserCompositorView() {
623 TRACE_EVENT0("browser", 631 TRACE_EVENT0("browser",
624 "RenderWidgetHostViewMac::SuspendBrowserCompositorView"); 632 "RenderWidgetHostViewMac::SuspendBrowserCompositorView");
625 633
626 // Hide the DelegatedFrameHost to transition from Active -> Suspended. 634 // Hide the DelegatedFrameHost to transition from Active -> Suspended.
627 if (browser_compositor_state_ == BrowserCompositorActive) { 635 if (browser_compositor_state_ == BrowserCompositorActive) {
636 // Ensure that any changes made to the ui::Compositor do not result in new
637 // frames being produced.
638 browser_compositor_->Suspend();
628 // Marking the DelegatedFrameHost as removed from the window hierarchy is 639 // Marking the DelegatedFrameHost as removed from the window hierarchy is
629 // necessary to remove all connections to its old ui::Compositor. 640 // necessary to remove all connections to its old ui::Compositor.
630 delegated_frame_host_->WasHidden(); 641 delegated_frame_host_->WasHidden();
631 delegated_frame_host_->ResetCompositor(); 642 delegated_frame_host_->ResetCompositor();
632 browser_compositor_state_ = BrowserCompositorSuspended; 643 browser_compositor_state_ = BrowserCompositorSuspended;
633 } 644 }
634 } 645 }
635 646
636 void RenderWidgetHostViewMac::DestroyBrowserCompositorView() { 647 void RenderWidgetHostViewMac::DestroyBrowserCompositorView() {
637 TRACE_EVENT0("browser", 648 TRACE_EVENT0("browser",
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const { 838 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const {
828 return render_widget_host_; 839 return render_widget_host_;
829 } 840 }
830 841
831 void RenderWidgetHostViewMac::Show() { 842 void RenderWidgetHostViewMac::Show() {
832 ScopedCAActionDisabler disabler; 843 ScopedCAActionDisabler disabler;
833 [cocoa_view_ setHidden:NO]; 844 [cocoa_view_ setHidden:NO];
834 if (!render_widget_host_->is_hidden()) 845 if (!render_widget_host_->is_hidden())
835 return; 846 return;
836 847
848 EnsureBrowserCompositorView();
danakj 2015/03/12 00:07:15 How come this is needed?
ccameron 2015/03/12 01:01:34 Oh -- I added the explanation to the CL descriptio
danakj 2015/03/12 01:08:50 Thanks :)
837 WasUnOccluded(); 849 WasUnOccluded();
838 850
839 // If there is not a frame being currently drawn, kick one, so that the below 851 // If there is not a frame being currently drawn, kick one, so that the below
840 // pause will have a frame to wait on. 852 // pause will have a frame to wait on.
841 render_widget_host_->ScheduleComposite(); 853 render_widget_host_->ScheduleComposite();
842 PauseForPendingResizeOrRepaintsAndDraw(); 854 PauseForPendingResizeOrRepaintsAndDraw();
843 } 855 }
844 856
845 void RenderWidgetHostViewMac::Hide() { 857 void RenderWidgetHostViewMac::Hide() {
846 ScopedCAActionDisabler disabler; 858 ScopedCAActionDisabler disabler;
(...skipping 2586 matching lines...) Expand 10 before | Expand all | Expand 10 after
3433 3445
3434 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3446 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3435 // regions that are not draggable. (See ControlRegionView in 3447 // regions that are not draggable. (See ControlRegionView in
3436 // native_app_window_cocoa.mm). This requires the render host view to be 3448 // native_app_window_cocoa.mm). This requires the render host view to be
3437 // draggable by default. 3449 // draggable by default.
3438 - (BOOL)mouseDownCanMoveWindow { 3450 - (BOOL)mouseDownCanMoveWindow {
3439 return YES; 3451 return YES;
3440 } 3452 }
3441 3453
3442 @end 3454 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698