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

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

Issue 1348833003: Fix NTP thumbnail generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nit. Created 5 years, 1 month 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 | « content/browser/compositor/delegated_frame_host.cc ('k') | no next file » | 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 10
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 707
708 void RenderWidgetHostViewMac::DestroyBrowserCompositorView() { 708 void RenderWidgetHostViewMac::DestroyBrowserCompositorView() {
709 TRACE_EVENT0("browser", 709 TRACE_EVENT0("browser",
710 "RenderWidgetHostViewMac::DestroyBrowserCompositorView"); 710 "RenderWidgetHostViewMac::DestroyBrowserCompositorView");
711 711
712 // Transition from Active -> Suspended if need be. 712 // Transition from Active -> Suspended if need be.
713 SuspendBrowserCompositorView(); 713 SuspendBrowserCompositorView();
714 714
715 // Destroy the BrowserCompositorView to transition Suspended -> Destroyed. 715 // Destroy the BrowserCompositorView to transition Suspended -> Destroyed.
716 if (browser_compositor_state_ == BrowserCompositorSuspended) { 716 if (browser_compositor_state_ == BrowserCompositorSuspended) {
717 browser_compositor_->accelerated_widget_mac()->ResetNSView(); 717 if (browser_compositor_) {
718 browser_compositor_->compositor()->SetScaleAndSize(1.0, gfx::Size(0, 0)); 718 browser_compositor_->accelerated_widget_mac()->ResetNSView();
719 browser_compositor_->compositor()->SetRootLayer(nullptr); 719 browser_compositor_->compositor()->SetScaleAndSize(1.0, gfx::Size(0, 0));
720 BrowserCompositorMac::Recycle(browser_compositor_.Pass()); 720 browser_compositor_->compositor()->SetRootLayer(nullptr);
721 BrowserCompositorMac::Recycle(browser_compositor_.Pass());
722 }
721 browser_compositor_state_ = BrowserCompositorDestroyed; 723 browser_compositor_state_ = BrowserCompositorDestroyed;
722 } 724 }
723 } 725 }
724 726
725 void RenderWidgetHostViewMac::DestroySuspendedBrowserCompositorViewIfNeeded() { 727 void RenderWidgetHostViewMac::DestroySuspendedBrowserCompositorViewIfNeeded() {
726 if (browser_compositor_state_ != BrowserCompositorSuspended) 728 if (browser_compositor_state_ != BrowserCompositorSuspended)
727 return; 729 return;
728 730
729 // If this view is in a window that is visible, keep around the suspended 731 // If this view is in a window that is visible, keep around the suspended
730 // BrowserCompositorView in case |cocoa_view_| is suddenly revealed (so that 732 // BrowserCompositorView in case |cocoa_view_| is suddenly revealed (so that
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 void RenderWidgetHostViewMac::WasOccluded() { 947 void RenderWidgetHostViewMac::WasOccluded() {
946 if (render_widget_host_->is_hidden()) 948 if (render_widget_host_->is_hidden())
947 return; 949 return;
948 950
949 // Note that the following call to WasHidden() can trigger thumbnail 951 // Note that the following call to WasHidden() can trigger thumbnail
950 // generation on behalf of the NTP, and that cannot succeed if the browser 952 // generation on behalf of the NTP, and that cannot succeed if the browser
951 // compositor view has been suspended. Therefore these two statements must 953 // compositor view has been suspended. Therefore these two statements must
952 // occur in this specific order. However, because thumbnail generation is 954 // occur in this specific order. However, because thumbnail generation is
953 // asychronous, that operation won't run before SuspendBrowserCompositorView() 955 // asychronous, that operation won't run before SuspendBrowserCompositorView()
954 // completes. As a result you won't get a thumbnail for the page unless you 956 // completes. As a result you won't get a thumbnail for the page unless you
955 // happen to switch back to it. See http://crbug.com/530707 . 957 // execute these two statements in this specific order.
956 render_widget_host_->WasHidden(); 958 render_widget_host_->WasHidden();
957 SuspendBrowserCompositorView(); 959 SuspendBrowserCompositorView();
958 } 960 }
959 961
960 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) { 962 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) {
961 gfx::Rect rect = GetViewBounds(); 963 gfx::Rect rect = GetViewBounds();
962 rect.set_size(size); 964 rect.set_size(size);
963 SetBounds(rect); 965 SetBounds(rect);
964 } 966 }
965 967
(...skipping 2523 matching lines...) Expand 10 before | Expand all | Expand 10 after
3489 3491
3490 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3492 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3491 // regions that are not draggable. (See ControlRegionView in 3493 // regions that are not draggable. (See ControlRegionView in
3492 // native_app_window_cocoa.mm). This requires the render host view to be 3494 // native_app_window_cocoa.mm). This requires the render host view to be
3493 // draggable by default. 3495 // draggable by default.
3494 - (BOOL)mouseDownCanMoveWindow { 3496 - (BOOL)mouseDownCanMoveWindow {
3495 return YES; 3497 return YES;
3496 } 3498 }
3497 3499
3498 @end 3500 @end
OLDNEW
« no previous file with comments | « content/browser/compositor/delegated_frame_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698