mirror of
https://github.com/aphrody-labs/cef.git
synced 2026-10-13 21:07:07 +00:00
- Windows SDK 10.0.28000.2270 is now required - CefRegisterExtension is deprecated due to https://crbug.com/40347662
46 lines
2.1 KiB
Diff
46 lines
2.1 KiB
Diff
diff --git ui/base/resource/resource_bundle.cc ui/base/resource/resource_bundle.cc
|
|
index d1ee6814618c7cdcdb7fda0faa57a94a75dd7c98..e047d2c3bc63b8503eb448f0c2e194d71e7147e7 100644
|
|
--- ui/base/resource/resource_bundle.cc
|
|
+++ ui/base/resource/resource_bundle.cc
|
|
@@ -1022,6 +1022,12 @@ ResourceBundle::ResourceBundle(Delegate* delegate)
|
|
locale_resources_data_lock_(std::make_unique<base::Lock>()),
|
|
resource_handles_lock_(std::make_unique<base::Lock>()),
|
|
max_scale_factor_(k100Percent) {
|
|
+ // 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);
|
|
}
|
|
@@ -1031,6 +1037,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 5b0e6cea9c6206526c11af155a26c8c2477690c4..63da981b5350d6b36afd84cd4c85e1cb6eb7efd3 100644
|
|
--- ui/base/resource/resource_bundle.h
|
|
+++ ui/base/resource/resource_bundle.h
|
|
@@ -266,6 +266,11 @@ class COMPONENT_EXPORT(UI_BASE) ResourceBundle {
|
|
ResourceBundle(const ResourceBundle&) = delete;
|
|
ResourceBundle& operator=(const ResourceBundle&) = delete;
|
|
|
|
+ // 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 LoadAdditionalLocaleDataWithPakFileRegion(
|
|
base::File pak_file,
|