perf: avoid redundant calls to GetView() (#43231)
* 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(); Co-authored-by: Charles Kerr <charles@charleskerr.com> * perf: avoid discarded GetView() call Co-authored-by: Charles Kerr <charles@charleskerr.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
22b66ee6de
commit
31e6d66c74
4 changed files with 20 additions and 28 deletions
|
@ -37,13 +37,14 @@ void FrameSubscriber::AttachToHost(content::RenderWidgetHost* host) {
|
|||
|
||||
// The view can be null if the renderer process has crashed.
|
||||
// (https://crbug.com/847363)
|
||||
if (!host_->GetView())
|
||||
auto* rwhv = host_->GetView();
|
||||
if (!rwhv)
|
||||
return;
|
||||
|
||||
// Create and configure the video capturer.
|
||||
gfx::Size size = GetRenderViewSize();
|
||||
DCHECK(!size.IsEmpty());
|
||||
video_capturer_ = host_->GetView()->CreateVideoCapturer();
|
||||
video_capturer_ = rwhv->CreateVideoCapturer();
|
||||
video_capturer_->SetResolutionConstraints(size, size, true);
|
||||
video_capturer_->SetAutoThrottlingEnabled(false);
|
||||
video_capturer_->SetMinSizeChangePeriod(base::TimeDelta());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue