0

Fix issue with views_examples_with_content not exiting properly

In ViewsContentClientMainParts::WillRunMainMessageLoop,
ViewsContentClientMainParts::run_loop_ should be set as the main
message loop. This way, calling QuitClosure() when the window is
closed will properly terminate the message loop.

Bug: 1509748
Change-Id: Ia6f4b88acf21a0d4c42d1c4812e6430366a2c1ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5103588
Reviewed-by: Elly FJ <ellyjones@chromium.org>
Commit-Queue: chenguang shao <chenguangshao1@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1236067}
This commit is contained in:
shaochenguang
2023-12-12 00:49:54 +00:00
committed by Chromium LUCI CQ
parent 41964235db
commit f3e9b987d9
2 changed files with 7 additions and 0 deletions

@ -37,6 +37,11 @@ int ViewsContentClientMainParts::PreMainMessageLoopRun() {
return content::RESULT_CODE_NORMAL_EXIT;
}
void ViewsContentClientMainParts::WillRunMainMessageLoop(
std::unique_ptr<base::RunLoop>& run_loop) {
run_loop = std::move(run_loop_);
}
void ViewsContentClientMainParts::PostMainMessageLoopRun() {
browser_context_.reset();
views_delegate_.reset();

@ -47,6 +47,8 @@ class ViewsContentClientMainParts : public content::BrowserMainParts {
// content::BrowserMainParts:
int PreMainMessageLoopRun() override;
void WillRunMainMessageLoop(
std::unique_ptr<base::RunLoop>& run_loop) override;
void PostMainMessageLoopRun() override;
content::ShellBrowserContext* browser_context() {