| Index: chrome/browser/themes/browser_theme_pack.cc
|
| diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc
|
| index 8b72d3c7d82487ad3c957f0f456df4682ffe917a..7227d64ae1ec4539ac674ea551bdc79180bdfe01 100644
|
| --- a/chrome/browser/themes/browser_theme_pack.cc
|
| +++ b/chrome/browser/themes/browser_theme_pack.cc
|
| @@ -537,6 +537,8 @@ class TabBackgroundImageSource: public gfx::CanvasImageSource {
|
| } // namespace
|
|
|
| BrowserThemePack::~BrowserThemePack() {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
| +
|
| if (!data_pack_.get()) {
|
| delete header_;
|
| delete [] tints_;
|
| @@ -544,6 +546,20 @@ BrowserThemePack::~BrowserThemePack() {
|
| delete [] display_properties_;
|
| delete [] source_images_;
|
| }
|
| +
|
| + // |images_| will trigger the thread-checker as the images were built on the
|
| + // UI thread and we are on the FILE thread. As a special case, it is safe to
|
| + // delete them on the FILE thread because there are no remaining references to
|
| + // this BrowserThemePack from the UI thread. Explicitly detach all the images
|
| + // from the UI thread to suppress the error.
|
| + for (auto image : images_)
|
| + image.second.DetachFromThread();
|
| +
|
| + // For the same reason, detach all of the |images_on_file_thread_| from
|
| + // whatever thread they are attached to. (Note that |images_on_file_thread_|
|
| + // is usually accessed on the FILE thread, but not always.)
|
| + for (auto image : images_on_file_thread_)
|
| + image.second.DetachFromThread();
|
| }
|
|
|
| // static
|
| @@ -594,6 +610,9 @@ void BrowserThemePack::BuildFromExtension(
|
| ThemeImageSource* source = new ThemeImageSource(source_image_skia);
|
| // image_skia takes ownership of source.
|
| gfx::ImageSkia image_skia(source, source_image_skia.size());
|
| + // From now on, it->second will only be stored in |images_on_file_thread_|,
|
| + // so detach it from the UI thread.
|
| + it->second.DetachFromThread();
|
| it->second = gfx::Image(image_skia);
|
| }
|
|
|
|
|