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

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

Issue 2005013002: mac: ensure ui::Compositor exists for visible RWHVs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ensure in ctor and always in show Created 4 years, 6 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_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 (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 #include <stdint.h> 10 #include <stdint.h>
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 render_widget_host_->SetView(this); 590 render_widget_host_->SetView(this);
591 591
592 // Let the page-level input event router know about our surface ID 592 // Let the page-level input event router know about our surface ID
593 // namespace for surface-based hit testing. 593 // namespace for surface-based hit testing.
594 if (render_widget_host_->delegate() && 594 if (render_widget_host_->delegate() &&
595 render_widget_host_->delegate()->GetInputEventRouter()) { 595 render_widget_host_->delegate()->GetInputEventRouter()) {
596 render_widget_host_->delegate() 596 render_widget_host_->delegate()
597 ->GetInputEventRouter() 597 ->GetInputEventRouter()
598 ->AddSurfaceIdNamespaceOwner(GetSurfaceIdNamespace(), this); 598 ->AddSurfaceIdNamespaceOwner(GetSurfaceIdNamespace(), this);
599 } 599 }
600
601 if (!render_widget_host_->is_hidden())
602 EnsureBrowserCompositorView();
600 } 603 }
601 604
602 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() { 605 RenderWidgetHostViewMac::~RenderWidgetHostViewMac() {
603 display::Screen::GetScreen()->RemoveObserver(this); 606 display::Screen::GetScreen()->RemoveObserver(this);
604 607
605 // This is being called from |cocoa_view_|'s destructor, so invalidate the 608 // This is being called from |cocoa_view_|'s destructor, so invalidate the
606 // pointer. 609 // pointer.
607 cocoa_view_ = nil; 610 cocoa_view_ = nil;
608 611
609 UnlockMouse(); 612 UnlockMouse();
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 render_widget_host_->NotifyScreenInfoChanged(); 883 render_widget_host_->NotifyScreenInfoChanged();
881 } 884 }
882 885
883 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const { 886 RenderWidgetHost* RenderWidgetHostViewMac::GetRenderWidgetHost() const {
884 return render_widget_host_; 887 return render_widget_host_;
885 } 888 }
886 889
887 void RenderWidgetHostViewMac::Show() { 890 void RenderWidgetHostViewMac::Show() {
888 ScopedCAActionDisabler disabler; 891 ScopedCAActionDisabler disabler;
889 [cocoa_view_ setHidden:NO]; 892 [cocoa_view_ setHidden:NO];
890 if (!render_widget_host_->is_hidden())
891 return;
892 893
893 // Re-create the browser compositor. If the DelegatedFrameHost has a cached 894 // Re-create the browser compositor. If the DelegatedFrameHost has a cached
894 // frame from the last time it was visible, then it will immediately be 895 // frame from the last time it was visible, then it will immediately be
895 // drawn. If not, then the compositor will remain locked until a new delegated 896 // drawn. If not, then the compositor will remain locked until a new delegated
896 // frame is swapped. 897 // frame is swapped.
897 EnsureBrowserCompositorView(); 898 EnsureBrowserCompositorView();
898 899
900 if (!render_widget_host_->is_hidden())
901 return;
902
899 WasUnOccluded(); 903 WasUnOccluded();
900 904
901 // If there is not a frame being currently drawn, kick one, so that the below 905 // If there is not a frame being currently drawn, kick one, so that the below
902 // pause will have a frame to wait on. 906 // pause will have a frame to wait on.
903 render_widget_host_->ScheduleComposite(); 907 render_widget_host_->ScheduleComposite();
904 PauseForPendingResizeOrRepaintsAndDraw(); 908 PauseForPendingResizeOrRepaintsAndDraw();
905 } 909 }
906 910
907 void RenderWidgetHostViewMac::Hide() { 911 void RenderWidgetHostViewMac::Hide() {
908 ScopedCAActionDisabler disabler; 912 ScopedCAActionDisabler disabler;
(...skipping 2533 matching lines...) Expand 10 before | Expand all | Expand 10 after
3442 3446
3443 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3447 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3444 // regions that are not draggable. (See ControlRegionView in 3448 // regions that are not draggable. (See ControlRegionView in
3445 // native_app_window_cocoa.mm). This requires the render host view to be 3449 // native_app_window_cocoa.mm). This requires the render host view to be
3446 // draggable by default. 3450 // draggable by default.
3447 - (BOOL)mouseDownCanMoveWindow { 3451 - (BOOL)mouseDownCanMoveWindow {
3448 return YES; 3452 return YES;
3449 } 3453 }
3450 3454
3451 @end 3455 @end
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698