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

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

Issue 2003243002: Mac fullscreen low power: Ignore WasOccluded by low power window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fullscreen_sort_of
Patch Set: fix reversed conditional Created 4 years, 7 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 | ui/accelerated_widget_mac/accelerated_widget_mac.h » ('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 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 902
903 // If there is not a frame being currently drawn, kick one, so that the below 903 // If there is not a frame being currently drawn, kick one, so that the below
904 // pause will have a frame to wait on. 904 // pause will have a frame to wait on.
905 render_widget_host_->ScheduleComposite(); 905 render_widget_host_->ScheduleComposite();
906 PauseForPendingResizeOrRepaintsAndDraw(); 906 PauseForPendingResizeOrRepaintsAndDraw();
907 } 907 }
908 908
909 void RenderWidgetHostViewMac::Hide() { 909 void RenderWidgetHostViewMac::Hide() {
910 ScopedCAActionDisabler disabler; 910 ScopedCAActionDisabler disabler;
911 [cocoa_view_ setHidden:YES]; 911 [cocoa_view_ setHidden:YES];
912 WasOccluded(); 912 if (!render_widget_host_->is_hidden()) {
913 // Note that the following call to WasHidden() can trigger thumbnail
914 // generation on behalf of the NTP, and that cannot succeed if the browser
915 // compositor view has been suspended. Therefore these two statements must
916 // occur in this specific order. However, because thumbnail generation is
917 // asychronous, that operation won't run before
918 // SuspendBrowserCompositorView()
919 // completes. As a result you won't get a thumbnail for the page unless you
920 // execute these two statements in this specific order.
921 render_widget_host_->WasHidden();
922 SuspendBrowserCompositorView();
923 }
913 DestroySuspendedBrowserCompositorViewIfNeeded(); 924 DestroySuspendedBrowserCompositorViewIfNeeded();
914 } 925 }
915 926
916 void RenderWidgetHostViewMac::WasUnOccluded() { 927 void RenderWidgetHostViewMac::WasUnOccluded() {
917 if (!render_widget_host_->is_hidden()) 928 if (!render_widget_host_->is_hidden())
918 return; 929 return;
919 930
920 ui::LatencyInfo renderer_latency_info; 931 ui::LatencyInfo renderer_latency_info;
921 renderer_latency_info.AddLatencyNumber( 932 renderer_latency_info.AddLatencyNumber(
922 ui::TAB_SHOW_COMPONENT, 933 ui::TAB_SHOW_COMPONENT,
923 render_widget_host_->GetLatencyComponentId(), 934 render_widget_host_->GetLatencyComponentId(),
924 0); 935 0);
925 render_widget_host_->WasShown(renderer_latency_info); 936 render_widget_host_->WasShown(renderer_latency_info);
926 } 937 }
927 938
928 void RenderWidgetHostViewMac::WasOccluded() { 939 void RenderWidgetHostViewMac::WasOccluded() {
929 if (render_widget_host_->is_hidden()) 940 if (render_widget_host_->is_hidden())
930 return; 941 return;
931 942
932 // Note that the following call to WasHidden() can trigger thumbnail 943 // Ignore occlusion when in fullscreen low power mode, because the occlusion
933 // generation on behalf of the NTP, and that cannot succeed if the browser 944 // is likely coming from the fullscreen low power window.
934 // compositor view has been suspended. Therefore these two statements must 945 if (browser_compositor_) {
935 // occur in this specific order. However, because thumbnail generation is 946 if (browser_compositor_->accelerated_widget_mac()
936 // asychronous, that operation won't run before SuspendBrowserCompositorView() 947 ->MightBeInFullscreenLowPowerMode())
937 // completes. As a result you won't get a thumbnail for the page unless you 948 return;
938 // execute these two statements in this specific order. 949 }
950
951 // Note the importance of ordering of these calls is the same in the Hide
952 // function.
939 render_widget_host_->WasHidden(); 953 render_widget_host_->WasHidden();
940 SuspendBrowserCompositorView(); 954 SuspendBrowserCompositorView();
941 } 955 }
942 956
943 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) { 957 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) {
944 gfx::Rect rect = GetViewBounds(); 958 gfx::Rect rect = GetViewBounds();
945 rect.set_size(size); 959 rect.set_size(size);
946 SetBounds(rect); 960 SetBounds(rect);
947 } 961 }
948 962
(...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after
3436 3450
3437 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3451 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3438 // regions that are not draggable. (See ControlRegionView in 3452 // regions that are not draggable. (See ControlRegionView in
3439 // native_app_window_cocoa.mm). This requires the render host view to be 3453 // native_app_window_cocoa.mm). This requires the render host view to be
3440 // draggable by default. 3454 // draggable by default.
3441 - (BOOL)mouseDownCanMoveWindow { 3455 - (BOOL)mouseDownCanMoveWindow {
3442 return YES; 3456 return YES;
3443 } 3457 }
3444 3458
3445 @end 3459 @end
OLDNEW
« no previous file with comments | « no previous file | ui/accelerated_widget_mac/accelerated_widget_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698