cef/patch/patches/resource_bundle_2512.patch
Marshall Greenblatt 74db00fc89 Update to Chromium version 90.0.4430.0 (#857950)
- Linux ARM builds require use_vaapi=false (see https://crbug.com/1185348)
- Windows official builds require use_thin_lto=false (see https://crbug.com/1177001)
2021-03-18 11:23:00 -04:00

46 lines
1.9 KiB
Diff

diff --git ui/base/resource/resource_bundle.cc ui/base/resource/resource_bundle.cc
index 910662d25a4f..4323dada7c98 100644
--- ui/base/resource/resource_bundle.cc
+++ ui/base/resource/resource_bundle.cc
@@ -832,6 +832,12 @@ ResourceBundle::ResourceBundle(Delegate* delegate)
: delegate_(delegate),
locale_resources_data_lock_(new base::Lock),
max_scale_factor_(SCALE_FACTOR_100P) {
+ // With CEF's multi-threaded mode the ResourceBundle may be created on the
+ // main thread and then accessed on the UI thread. Allow the SequenceChecker
+ // to re-bind on the UI thread when CalledOnValidSequence() is called for the
+ // first time.
+ DETACH_FROM_SEQUENCE(sequence_checker_);
+
mangle_localized_strings_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kMangleLocalizedStrings);
}
@@ -841,6 +847,11 @@ ResourceBundle::~ResourceBundle() {
UnloadLocaleResources();
}
+void ResourceBundle::CleanupOnUIThread() {
+ FreeImages();
+ font_cache_.clear();
+}
+
// static
void ResourceBundle::InitSharedInstance(Delegate* delegate) {
DCHECK(g_shared_instance_ == nullptr) << "ResourceBundle initialized twice";
diff --git ui/base/resource/resource_bundle.h ui/base/resource/resource_bundle.h
index 48c329f00c3f..a1a0cbc98771 100644
--- ui/base/resource/resource_bundle.h
+++ ui/base/resource/resource_bundle.h
@@ -192,6 +192,11 @@ class COMPONENT_EXPORT(UI_BASE) ResourceBundle {
// Return the global resource loader instance.
static ResourceBundle& GetSharedInstance();
+ // With CEF's multi-threaded mode the ResourceBundle may be created/destroyed
+ // on the main thread but accessed on the UI thread. Call this method on the
+ // UI thread to clean up resources before destruction.
+ void CleanupOnUIThread();
+
// Loads a secondary locale data pack using the given file region.
void LoadSecondaryLocaleDataWithPakFileRegion(
base::File pak_file,