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:
parent
f42331f277
commit
6293bbced0
4 changed files with 20 additions and 28 deletions
|
@ -191,11 +191,8 @@ void AutofillPopup::CreateView(content::RenderFrameHost* frame_host,
|
|||
view_ = new AutofillPopupView(this, parent->GetWidget());
|
||||
|
||||
if (offscreen) {
|
||||
auto* rwhv = frame_host->GetView();
|
||||
if (embedder_frame_host != nullptr) {
|
||||
rwhv = embedder_frame_host->GetView();
|
||||
}
|
||||
|
||||
auto* rwhv = embedder_frame_host ? embedder_frame_host->GetView()
|
||||
: frame_host->GetView();
|
||||
auto* osr_rwhv = static_cast<OffScreenRenderWidgetHostView*>(rwhv);
|
||||
view_->view_proxy_ = std::make_unique<OffscreenViewProxy>(view_);
|
||||
osr_rwhv->AddViewProxy(view_->view_proxy_.get());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue