cefclient: Fix slow loading of the Views image cache (see issue #2969)

This commit is contained in:
Marshall Greenblatt 2021-04-14 22:29:30 -04:00
parent 34c63a665d
commit a4d71d8fe2
1 changed files with 6 additions and 5 deletions

View File

@ -131,8 +131,9 @@ void ImageCache::LoadImages(const ImageInfoSet& image_info,
}
if (missing_images) {
CefPostTask(TID_FILE, base::Bind(&ImageCache::LoadMissing, this, image_info,
images, callback));
CefPostTask(TID_FILE_USER_BLOCKING,
base::Bind(&ImageCache::LoadMissing, this, image_info, images,
callback));
} else {
callback.Run(images);
}
@ -167,7 +168,7 @@ ImageCache::ImageType ImageCache::GetImageType(const std::string& path) {
void ImageCache::LoadMissing(const ImageInfoSet& image_info,
const ImageSet& images,
const LoadImagesCallback& callback) {
CEF_REQUIRE_FILE_THREAD();
DCHECK(!CefCurrentlyOn(TID_UI) && !CefCurrentlyOn(TID_IO));
DCHECK_EQ(image_info.size(), images.size());
@ -194,7 +195,7 @@ void ImageCache::LoadMissing(const ImageInfoSet& image_info,
// static
bool ImageCache::LoadImageContents(const ImageInfo& info,
ImageContent* content) {
CEF_REQUIRE_FILE_THREAD();
DCHECK(!CefCurrentlyOn(TID_UI) && !CefCurrentlyOn(TID_IO));
ImageRepSet::const_iterator it = info.reps_.begin();
for (; it != info.reps_.end(); ++it) {
@ -219,7 +220,7 @@ bool ImageCache::LoadImageContents(const std::string& path,
bool internal,
ImageType* type,
std::string* contents) {
CEF_REQUIRE_FILE_THREAD();
DCHECK(!CefCurrentlyOn(TID_UI) && !CefCurrentlyOn(TID_IO));
*type = GetImageType(path);
if (*type == TYPE_NONE)