refactor: add SessionPreferences::CreateForBrowserContext() (#38656)

Copy the NativeWindowRelay::CreateForWebContents() idiom
to simplify SessionPreferences's constructor and lifecycle.
This commit is contained in:
Charles Kerr 2023-06-09 11:20:43 -05:00 committed by GitHub
parent 12b85a77a8
commit d95ae19edf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View file

@ -345,7 +345,7 @@ Session::Session(v8::Isolate* isolate, ElectronBrowserContext* browser_context)
// Observe DownloadManager to get download notifications.
browser_context->GetDownloadManager()->AddObserver(this);
new SessionPreferences(browser_context);
SessionPreferences::CreateForBrowserContext(browser_context);
protocol_.Reset(isolate, Protocol::Create(isolate, browser_context).ToV8());