mirror of
https://github.com/electron/electron.git
synced 2026-01-09 07:28:12 -05:00
perf: avoid redundant calls to GetView() (#43216)
* perf: avoid double-calls to GetView() There are a lot of places where we call the virtual method GetView() twice in succession: the first to check if the view exists, and the second to use. This PR holds the view in a temp variable instead, e.g.: if (auto* view = foo->GetView()) view->DoSomething(); * perf: avoid discarded GetView() call
This commit is contained in:
@@ -565,10 +565,8 @@ OffScreenRenderWidgetHostView::CreateViewForWidget(
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
content::RenderWidgetHost* embedder_render_widget_host,
|
||||
content::WebContentsView* web_contents_view) {
|
||||
if (render_widget_host->GetView()) {
|
||||
return static_cast<content::RenderWidgetHostViewBase*>(
|
||||
render_widget_host->GetView());
|
||||
}
|
||||
if (auto* rwhv = render_widget_host->GetView())
|
||||
return static_cast<content::RenderWidgetHostViewBase*>(rwhv);
|
||||
|
||||
OffScreenRenderWidgetHostView* embedder_host_view = nullptr;
|
||||
if (embedder_render_widget_host) {
|
||||
|
||||
Reference in New Issue
Block a user