2018-09-20 15:00:14 +02:00
|
|
|
diff --git ui/base/resource/resource_bundle.cc ui/base/resource/resource_bundle.cc
|
2023-08-09 23:17:17 +02:00
|
|
|
index 3604fa07ff1c4..baf2f2d6507df 100644
|
2018-09-20 15:00:14 +02:00
|
|
|
--- ui/base/resource/resource_bundle.cc
|
|
|
|
+++ ui/base/resource/resource_bundle.cc
|
2023-08-09 23:17:17 +02:00
|
|
|
@@ -944,6 +944,12 @@ ResourceBundle::ResourceBundle(Delegate* delegate)
|
2018-09-20 15:00:14 +02:00
|
|
|
: delegate_(delegate),
|
|
|
|
locale_resources_data_lock_(new base::Lock),
|
2021-09-20 11:06:23 +02:00
|
|
|
max_scale_factor_(k100Percent) {
|
2018-09-20 15:00:14 +02:00
|
|
|
+ // 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);
|
|
|
|
}
|
2023-08-09 23:17:17 +02:00
|
|
|
@@ -953,6 +959,11 @@ ResourceBundle::~ResourceBundle() {
|
2018-09-20 15:00:14 +02:00
|
|
|
UnloadLocaleResources();
|
|
|
|
}
|
|
|
|
|
|
|
|
+void ResourceBundle::CleanupOnUIThread() {
|
|
|
|
+ FreeImages();
|
|
|
|
+ font_cache_.clear();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
// static
|
|
|
|
void ResourceBundle::InitSharedInstance(Delegate* delegate) {
|
2020-03-04 01:29:39 +01:00
|
|
|
DCHECK(g_shared_instance_ == nullptr) << "ResourceBundle initialized twice";
|
2018-09-20 15:00:14 +02:00
|
|
|
diff --git ui/base/resource/resource_bundle.h ui/base/resource/resource_bundle.h
|
2023-05-30 10:55:32 +02:00
|
|
|
index c24f5faf14d3f..96d4f6be11588 100644
|
2018-09-20 15:00:14 +02:00
|
|
|
--- ui/base/resource/resource_bundle.h
|
|
|
|
+++ ui/base/resource/resource_bundle.h
|
2023-05-30 10:55:32 +02:00
|
|
|
@@ -219,6 +219,11 @@ class COMPONENT_EXPORT(UI_BASE) ResourceBundle {
|
2021-10-19 00:17:16 +02:00
|
|
|
ResourceBundle(const ResourceBundle&) = delete;
|
|
|
|
ResourceBundle& operator=(const ResourceBundle&) = delete;
|
2018-09-20 15:00:14 +02:00
|
|
|
|
|
|
|
+ // 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,
|