perf: omit unnecessary work from ElectronRenderFrameObserver::ShouldNotifyClient() (#41347)

perf: omit unnecessary work from ElectronRenderFrameObserver::ShouldNotifyClient()

- (perf) GetBlinkPreferences() returns a const&, so we can use that
  reference instead of making a temporary copy

- (perf) Don't create url object unless it's needed.

- (refactor) Move is_main_world() and is_isolated_world() from the
  header into an anonymous namespace in the .cc file so they can
  be inlined and made constexpr
This commit is contained in:
Charles Kerr 2024-02-20 06:29:11 -06:00 committed by GitHub
parent 995f3dc120
commit 7cd23a4900
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 21 deletions

View file

@ -37,10 +37,9 @@ class ElectronRenderFrameObserver : public content::RenderFrameObserver {
void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
private:
bool ShouldNotifyClient(int world_id);
[[nodiscard]] bool ShouldNotifyClient(int world_id) const;
void CreateIsolatedWorldContext();
bool IsMainWorld(int world_id);
bool IsIsolatedWorld(int world_id);
void OnTakeHeapSnapshot(IPC::PlatformFileForTransit file_handle,
const std::string& channel);