handles destroyed renderer process

This commit is contained in:
gellert 2016-07-30 21:25:49 +02:00
parent 976277ffbf
commit 916063f370
4 changed files with 8 additions and 23 deletions

View file

@ -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<OffScreenRenderWidgetHostView *>(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<OffScreenRenderWidgetHostView*>(
web_contents()->GetRenderWidgetHostView());
osr_rwhv->SetPainting(false);
}
if ((type_ == BROWSER_WINDOW || type_ == OFF_SCREEN) && owner_window())
owner_window()->CloseContents(source);
}

View file

@ -278,7 +278,6 @@ class WebContents : public mate::TrackableObject<WebContents>,
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;

View file

@ -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));

View file

@ -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 <algorithm>
#include <limits>
#include <utility>
#include <iostream>
#import <Cocoa/Cocoa.h>
@ -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();
}