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

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

Issue 1450083002: Revert "Fix NTP thumbnail generation" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove thumbnailing context unittest. 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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 646
647 void RenderWidgetHostViewMac::DestroyBrowserCompositorView() { 647 void RenderWidgetHostViewMac::DestroyBrowserCompositorView() {
648 TRACE_EVENT0("browser", 648 TRACE_EVENT0("browser",
649 "RenderWidgetHostViewMac::DestroyBrowserCompositorView"); 649 "RenderWidgetHostViewMac::DestroyBrowserCompositorView");
650 650
651 // Transition from Active -> Suspended if need be. 651 // Transition from Active -> Suspended if need be.
652 SuspendBrowserCompositorView(); 652 SuspendBrowserCompositorView();
653 653
654 // Destroy the BrowserCompositorView to transition Suspended -> Destroyed. 654 // Destroy the BrowserCompositorView to transition Suspended -> Destroyed.
655 if (browser_compositor_state_ == BrowserCompositorSuspended) { 655 if (browser_compositor_state_ == BrowserCompositorSuspended) {
656 if (browser_compositor_) { 656 browser_compositor_->accelerated_widget_mac()->ResetNSView();
657 browser_compositor_->accelerated_widget_mac()->ResetNSView(); 657 browser_compositor_->compositor()->SetScaleAndSize(1.0, gfx::Size(0, 0));
658 browser_compositor_->compositor()->SetScaleAndSize(1.0, gfx::Size(0, 0)); 658 browser_compositor_->compositor()->SetRootLayer(nullptr);
659 browser_compositor_->compositor()->SetRootLayer(nullptr); 659 BrowserCompositorMac::Recycle(browser_compositor_.Pass());
660 BrowserCompositorMac::Recycle(browser_compositor_.Pass());
661 }
662 browser_compositor_state_ = BrowserCompositorDestroyed; 660 browser_compositor_state_ = BrowserCompositorDestroyed;
663 } 661 }
664 } 662 }
665 663
666 void RenderWidgetHostViewMac::DestroySuspendedBrowserCompositorViewIfNeeded() { 664 void RenderWidgetHostViewMac::DestroySuspendedBrowserCompositorViewIfNeeded() {
667 if (browser_compositor_state_ != BrowserCompositorSuspended) 665 if (browser_compositor_state_ != BrowserCompositorSuspended)
668 return; 666 return;
669 667
670 // If this view is in a window that is visible, keep around the suspended 668 // If this view is in a window that is visible, keep around the suspended
671 // BrowserCompositorView in case |cocoa_view_| is suddenly revealed (so that 669 // BrowserCompositorView in case |cocoa_view_| is suddenly revealed (so that
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 void RenderWidgetHostViewMac::WasOccluded() { 884 void RenderWidgetHostViewMac::WasOccluded() {
887 if (render_widget_host_->is_hidden()) 885 if (render_widget_host_->is_hidden())
888 return; 886 return;
889 887
890 // Note that the following call to WasHidden() can trigger thumbnail 888 // Note that the following call to WasHidden() can trigger thumbnail
891 // generation on behalf of the NTP, and that cannot succeed if the browser 889 // generation on behalf of the NTP, and that cannot succeed if the browser
892 // compositor view has been suspended. Therefore these two statements must 890 // compositor view has been suspended. Therefore these two statements must
893 // occur in this specific order. However, because thumbnail generation is 891 // occur in this specific order. However, because thumbnail generation is
894 // asychronous, that operation won't run before SuspendBrowserCompositorView() 892 // asychronous, that operation won't run before SuspendBrowserCompositorView()
895 // completes. As a result you won't get a thumbnail for the page unless you 893 // completes. As a result you won't get a thumbnail for the page unless you
896 // execute these two statements in this specific order. 894 // happen to switch back to it. See http://crbug.com/530707 .
897 render_widget_host_->WasHidden(); 895 render_widget_host_->WasHidden();
898 SuspendBrowserCompositorView(); 896 SuspendBrowserCompositorView();
899 } 897 }
900 898
901 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) { 899 void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) {
902 gfx::Rect rect = GetViewBounds(); 900 gfx::Rect rect = GetViewBounds();
903 rect.set_size(size); 901 rect.set_size(size);
904 SetBounds(rect); 902 SetBounds(rect);
905 } 903 }
906 904
(...skipping 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after
3443 3441
3444 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding 3442 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding
3445 // regions that are not draggable. (See ControlRegionView in 3443 // regions that are not draggable. (See ControlRegionView in
3446 // native_app_window_cocoa.mm). This requires the render host view to be 3444 // native_app_window_cocoa.mm). This requires the render host view to be
3447 // draggable by default. 3445 // draggable by default.
3448 - (BOOL)mouseDownCanMoveWindow { 3446 - (BOOL)mouseDownCanMoveWindow {
3449 return YES; 3447 return YES;
3450 } 3448 }
3451 3449
3452 @end 3450 @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