Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Unified Diff: components/html_viewer/global_state.cc

Issue 1341073004: Fix bug in shut down of HTMLViewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge 2 trunk Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/html_viewer/global_state.h ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/html_viewer/global_state.cc
diff --git a/components/html_viewer/global_state.cc b/components/html_viewer/global_state.cc
index e47495b4e1dc712b41cebb4ab4e69b554d410fc2..e847e1c6f6d70ea50c0e3ef0d63f155339774be9 100644
--- a/components/html_viewer/global_state.cc
+++ b/components/html_viewer/global_state.cc
@@ -72,6 +72,15 @@ GlobalState::~GlobalState() {
renderer_scheduler_->Shutdown();
blink::shutdown();
}
+#if defined(OS_LINUX) && !defined(OS_ANDROID)
+ if (font_loader_.get()) {
+ SkFontConfigInterface::SetGlobal(nullptr);
+ // FontLoader is ref counted. We need to explicitly shutdown the background
+ // thread, otherwise the background thread may be shutdown after the app is
+ // torn down, when we're in a bad state.
+ font_loader_->Shutdown();
+ }
+#endif
}
void GlobalState::InitIfNecessary(const gfx::Size& screen_size_in_pixels,
@@ -92,7 +101,8 @@ void GlobalState::InitIfNecessary(const gfx::Size& screen_size_in_pixels,
}
#if defined(OS_LINUX) && !defined(OS_ANDROID)
- SkFontConfigInterface::SetGlobal(new font_service::FontLoader(app_));
+ font_loader_ = skia::AdoptRef(new font_service::FontLoader(app_));
+ SkFontConfigInterface::SetGlobal(font_loader_.get());
#endif
ui_init_.reset(
« no previous file with comments | « components/html_viewer/global_state.h ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698