Configure background throttling on RenderViewCreated callback
This commit is contained in:
parent
219693d91f
commit
41afeb744a
2 changed files with 9 additions and 5 deletions
|
@ -613,6 +613,14 @@ void WebContents::BeforeUnloadFired(const base::TimeTicks& proceed_time) {
|
||||||
// there are two virtual functions named BeforeUnloadFired.
|
// there are two virtual functions named BeforeUnloadFired.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebContents::RenderViewCreated(content::RenderViewHost* render_view_host) {
|
||||||
|
const auto impl = content::RenderWidgetHostImpl::FromID(
|
||||||
|
render_view_host->GetProcess()->GetID(),
|
||||||
|
render_view_host->GetRoutingID());
|
||||||
|
if (impl)
|
||||||
|
impl->disable_hidden_ = !background_throttling_;
|
||||||
|
}
|
||||||
|
|
||||||
void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
|
void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
|
||||||
Emit("render-view-deleted", render_view_host->GetProcess()->GetID());
|
Emit("render-view-deleted", render_view_host->GetProcess()->GetID());
|
||||||
}
|
}
|
||||||
|
@ -897,11 +905,6 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
|
||||||
} else {
|
} else {
|
||||||
view->SetBackgroundColor(SK_ColorTRANSPARENT);
|
view->SetBackgroundColor(SK_ColorTRANSPARENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For the same reason we can only disable hidden here.
|
|
||||||
const auto host = static_cast<content::RenderWidgetHostImpl*>(
|
|
||||||
view->GetRenderWidgetHost());
|
|
||||||
host->disable_hidden_ = !background_throttling_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::DownloadURL(const GURL& url) {
|
void WebContents::DownloadURL(const GURL& url) {
|
||||||
|
|
|
@ -278,6 +278,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
|
|
||||||
// content::WebContentsObserver:
|
// content::WebContentsObserver:
|
||||||
void BeforeUnloadFired(const base::TimeTicks& proceed_time) override;
|
void BeforeUnloadFired(const base::TimeTicks& proceed_time) override;
|
||||||
|
void RenderViewCreated(content::RenderViewHost*) override;
|
||||||
void RenderViewDeleted(content::RenderViewHost*) override;
|
void RenderViewDeleted(content::RenderViewHost*) override;
|
||||||
void RenderProcessGone(base::TerminationStatus status) override;
|
void RenderProcessGone(base::TerminationStatus status) override;
|
||||||
void DocumentLoadedInFrame(
|
void DocumentLoadedInFrame(
|
||||||
|
|
Loading…
Reference in a new issue