diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 770b6b347ee..073edf7079f 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -402,14 +402,6 @@ void WebContents::OnCreateWindow(const GURL& target_url, Emit("new-window", target_url, frame_name, disposition); } -void WebContents::RenderViewReady() { - // if (IsOffScreen()) { - // const auto rwhv = web_contents()->GetRenderWidgetHostView(); - // auto osr_rwhv = static_cast(rwhv); - // osr_rwhv->SetPaintCallback(&paint_callback_); - // } -} - content::WebContents* WebContents::OpenURLFromTab( content::WebContents* source, const content::OpenURLParams& params) { @@ -445,12 +437,6 @@ void WebContents::MoveContents(content::WebContents* source, void WebContents::CloseContents(content::WebContents* source) { Emit("close"); - if (IsOffScreen()) { - const auto osr_rwhv = static_cast( - web_contents()->GetRenderWidgetHostView()); - osr_rwhv->SetPainting(false); - } - if ((type_ == BROWSER_WINDOW || type_ == OFF_SCREEN) && owner_window()) owner_window()->CloseContents(source); } diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 5294277d965..1587bec34bd 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -278,7 +278,6 @@ class WebContents : public mate::TrackableObject, void MediaStartedPlaying(const MediaPlayerId& id) override; void MediaStoppedPlaying(const MediaPlayerId& id) override; void DidChangeThemeColor(SkColor theme_color) override; - void RenderViewReady() override; // brightray::InspectableWebContentsDelegate: void DevToolsReloadPage() override; diff --git a/atom/browser/osr_render_widget_host_view.cc b/atom/browser/osr_render_widget_host_view.cc index c73ee8ff4d5..89023d41b3d 100644 --- a/atom/browser/osr_render_widget_host_view.cc +++ b/atom/browser/osr_render_widget_host_view.cc @@ -619,6 +619,7 @@ void OffScreenRenderWidgetHostView::RenderProcessGone(base::TerminationStatus,in } void OffScreenRenderWidgetHostView::Destroy() { + delete this; } void OffScreenRenderWidgetHostView::SetTooltipText(const base::string16 &) { @@ -740,7 +741,7 @@ void OffScreenRenderWidgetHostView::DelegatedFrameHostSendCompositorSwapAck( } void OffScreenRenderWidgetHostView::DelegatedFrameHostSendReclaimCompositorResources( - int output_surface_id, const cc::CompositorFrameAck& ack) { + int output_surface_id, const cc::CompositorFrameAck& ack) { render_widget_host_->Send(new ViewMsg_ReclaimCompositorResources( render_widget_host_->GetRoutingID(), output_surface_id, ack)); diff --git a/atom/browser/osr_render_widget_host_view_mac.mm b/atom/browser/osr_render_widget_host_view_mac.mm index f1463ec1a7c..6dc50d2ff0d 100644 --- a/atom/browser/osr_render_widget_host_view_mac.mm +++ b/atom/browser/osr_render_widget_host_view_mac.mm @@ -1,9 +1,12 @@ +// Copyright (c) 2013 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + #include "atom/browser/osr_render_widget_host_view.h" #include #include #include -#include #import @@ -20,7 +23,8 @@ ui::AcceleratedWidgetMac* atom::OffScreenRenderWidgetHostView::GetAcceleratedWid return nullptr; } -NSView* atom::OffScreenRenderWidgetHostView::AcceleratedWidgetGetNSView() const { +NSView* atom::OffScreenRenderWidgetHostView::AcceleratedWidgetGetNSView() + const { return [window_ contentView]; } @@ -75,13 +79,11 @@ void atom::OffScreenRenderWidgetHostView::SelectionChanged( } void atom::OffScreenRenderWidgetHostView::CreatePlatformWidget() { - // Create a borderless non-visible 1x1 window. window_ = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; - // Create a CALayer which is used by BrowserCompositorViewMac for rendering. background_layer_ = [[[CALayer alloc] init] retain]; [background_layer_ setBackgroundColor:CGColorGetConstantColor(kCGColorClear)]; NSView* content_view = [window_ contentView]; @@ -95,9 +97,6 @@ void atom::OffScreenRenderWidgetHostView::CreatePlatformWidget() { browser_compositor_->accelerated_widget_mac()->SetNSView(this); browser_compositor_->compositor()->SetVisible(true); - // CEF needs the browser compositor to remain responsive whereas normal - // rendering on OS X does not. This effectively reverts the changes from - // https://crbug.com/463988#c6 compositor_->SetLocksWillTimeOut(true); browser_compositor_->Unsuspend(); }