mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	Windows: Fix AtExitManager assertion in SupervisedUserSettingsServiceFactory on shutdown when running with multi-threaded message loop (issue #1680)
This commit is contained in:
		| @@ -112,18 +112,11 @@ patches = [ | ||||
|     'path': '../ui/base/dragdrop/', | ||||
|   }, | ||||
|   { | ||||
|     # Fix AtExitManager assertion on SpellcheckServiceFactory destruction during | ||||
|     # Windows multi-threaded message loop shutdown. | ||||
|     # https://bitbucket.org/chromiumembedded/cef/issues/137 | ||||
|     'name': 'spellcheck_137', | ||||
|     'path': '../chrome/browser/spellchecker/', | ||||
|   }, | ||||
|   { | ||||
|     # Fix AtExitManager assertion on PrefWatcherFactory destruction during | ||||
|     # Windows multi-threaded message loop shutdown. | ||||
|     # Windows: Fix AtExitManager assertion on *ServiceFactory destruction during | ||||
|     # multi-threaded message loop shutdown. | ||||
|     # https://bitbucket.org/chromiumembedded/cef/issues/1680 | ||||
|     'name': 'prefs_tab_helper_1680', | ||||
|     'path': '../chrome/browser/ui/prefs/', | ||||
|     'name': 'service_factory_1680', | ||||
|     'path': '../', | ||||
|   }, | ||||
|   { | ||||
|     # Make URLRequest::set_is_pending() public so that it can be called from | ||||
|   | ||||
							
								
								
									
										146
									
								
								patch/patches/service_factory_1680.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										146
									
								
								patch/patches/service_factory_1680.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,146 @@ | ||||
| diff --git chrome/browser/spellchecker/spellcheck_factory.cc chrome/browser/spellchecker/spellcheck_factory.cc | ||||
| index 3857256..3d1562c 100644 | ||||
| --- chrome/browser/spellchecker/spellcheck_factory.cc | ||||
| +++ chrome/browser/spellchecker/spellcheck_factory.cc | ||||
| @@ -16,6 +16,13 @@ | ||||
|  #include "content/public/browser/render_process_host.h" | ||||
|  #include "ui/base/l10n/l10n_util.h" | ||||
|   | ||||
| +namespace { | ||||
| + | ||||
| +static base::LazyInstance<SpellcheckServiceFactory>::Leaky | ||||
| +    g_spellcheck_service_factory = LAZY_INSTANCE_INITIALIZER; | ||||
| + | ||||
| +}  // namespace | ||||
| + | ||||
|  // static | ||||
|  SpellcheckService* SpellcheckServiceFactory::GetForContext( | ||||
|      content::BrowserContext* context) { | ||||
| @@ -38,7 +45,7 @@ SpellcheckService* SpellcheckServiceFactory::GetForRenderProcessId( | ||||
|   | ||||
|  // static | ||||
|  SpellcheckServiceFactory* SpellcheckServiceFactory::GetInstance() { | ||||
| -  return base::Singleton<SpellcheckServiceFactory>::get(); | ||||
| +  return g_spellcheck_service_factory.Pointer(); | ||||
|  } | ||||
|   | ||||
|  SpellcheckServiceFactory::SpellcheckServiceFactory() | ||||
| diff --git chrome/browser/spellchecker/spellcheck_factory.h chrome/browser/spellchecker/spellcheck_factory.h | ||||
| index e8eb9f7..48126000 100644 | ||||
| --- chrome/browser/spellchecker/spellcheck_factory.h | ||||
| +++ chrome/browser/spellchecker/spellcheck_factory.h | ||||
| @@ -7,7 +7,7 @@ | ||||
|   | ||||
|  #include "base/gtest_prod_util.h" | ||||
|  #include "base/macros.h" | ||||
| -#include "base/memory/singleton.h" | ||||
| +#include "base/lazy_instance.h" | ||||
|  #include "components/keyed_service/content/browser_context_keyed_service_factory.h" | ||||
|   | ||||
|  class SpellcheckService; | ||||
| @@ -26,7 +26,7 @@ class SpellcheckServiceFactory : public BrowserContextKeyedServiceFactory { | ||||
|    static SpellcheckServiceFactory* GetInstance(); | ||||
|   | ||||
|   private: | ||||
| -  friend struct base::DefaultSingletonTraits<SpellcheckServiceFactory>; | ||||
| +  friend struct base::DefaultLazyInstanceTraits<SpellcheckServiceFactory>; | ||||
|   | ||||
|    SpellcheckServiceFactory(); | ||||
|    ~SpellcheckServiceFactory() override; | ||||
| diff --git chrome/browser/supervised_user/supervised_user_settings_service_factory.cc chrome/browser/supervised_user/supervised_user_settings_service_factory.cc | ||||
| index 173ac31..473e561 100644 | ||||
| --- chrome/browser/supervised_user/supervised_user_settings_service_factory.cc | ||||
| +++ chrome/browser/supervised_user/supervised_user_settings_service_factory.cc | ||||
| @@ -9,6 +9,13 @@ | ||||
|  #include "chrome/browser/supervised_user/supervised_user_settings_service.h" | ||||
|  #include "components/keyed_service/content/browser_context_dependency_manager.h" | ||||
|   | ||||
| +namespace { | ||||
| + | ||||
| +base::LazyInstance<SupervisedUserSettingsServiceFactory>::Leaky | ||||
| +    g_service_factory = LAZY_INSTANCE_INITIALIZER; | ||||
| + | ||||
| +}  // namespace | ||||
| + | ||||
|  // static | ||||
|  SupervisedUserSettingsService* | ||||
|  SupervisedUserSettingsServiceFactory::GetForProfile(Profile* profile) { | ||||
| @@ -19,7 +26,7 @@ SupervisedUserSettingsServiceFactory::GetForProfile(Profile* profile) { | ||||
|  // static | ||||
|  SupervisedUserSettingsServiceFactory* | ||||
|  SupervisedUserSettingsServiceFactory::GetInstance() { | ||||
| -  return base::Singleton<SupervisedUserSettingsServiceFactory>::get(); | ||||
| +  return g_service_factory.Pointer(); | ||||
|  } | ||||
|   | ||||
|  SupervisedUserSettingsServiceFactory::SupervisedUserSettingsServiceFactory() | ||||
| diff --git chrome/browser/supervised_user/supervised_user_settings_service_factory.h chrome/browser/supervised_user/supervised_user_settings_service_factory.h | ||||
| index 2907619..c7a36ea 100644 | ||||
| --- chrome/browser/supervised_user/supervised_user_settings_service_factory.h | ||||
| +++ chrome/browser/supervised_user/supervised_user_settings_service_factory.h | ||||
| @@ -5,7 +5,7 @@ | ||||
|  #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SETTINGS_SERVICE_FACTORY_H_ | ||||
|  #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SETTINGS_SERVICE_FACTORY_H_ | ||||
|   | ||||
| -#include "base/memory/singleton.h" | ||||
| +#include "base/lazy_instance.h" | ||||
|  #include "chrome/browser/supervised_user/supervised_users.h" | ||||
|  #include "components/keyed_service/content/browser_context_keyed_service_factory.h" | ||||
|   | ||||
| @@ -20,7 +20,7 @@ class SupervisedUserSettingsServiceFactory | ||||
|    static SupervisedUserSettingsServiceFactory* GetInstance(); | ||||
|   | ||||
|   private: | ||||
| -  friend struct base::DefaultSingletonTraits< | ||||
| +  friend struct base::DefaultLazyInstanceTraits< | ||||
|        SupervisedUserSettingsServiceFactory>; | ||||
|   | ||||
|    SupervisedUserSettingsServiceFactory(); | ||||
| diff --git chrome/browser/ui/prefs/prefs_tab_helper.cc chrome/browser/ui/prefs/prefs_tab_helper.cc | ||||
| index 72267d2..5146b39 100644 | ||||
| --- chrome/browser/ui/prefs/prefs_tab_helper.cc | ||||
| +++ chrome/browser/ui/prefs/prefs_tab_helper.cc | ||||
| @@ -11,8 +11,8 @@ | ||||
|  #include <string> | ||||
|   | ||||
|  #include "base/command_line.h" | ||||
| +#include "base/lazy_instance.h" | ||||
|  #include "base/macros.h" | ||||
| -#include "base/memory/singleton.h" | ||||
|  #include "base/strings/string_number_conversions.h" | ||||
|  #include "base/strings/string_util.h" | ||||
|  #include "base/strings/stringprintf.h" | ||||
| @@ -431,12 +431,10 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { | ||||
|          GetInstance()->GetServiceForBrowserContext(profile, true)); | ||||
|    } | ||||
|   | ||||
| -  static PrefWatcherFactory* GetInstance() { | ||||
| -    return base::Singleton<PrefWatcherFactory>::get(); | ||||
| -  } | ||||
| +  static PrefWatcherFactory* GetInstance(); | ||||
|   | ||||
|   private: | ||||
| -  friend struct base::DefaultSingletonTraits<PrefWatcherFactory>; | ||||
| +  friend struct base::DefaultLazyInstanceTraits<PrefWatcherFactory>; | ||||
|   | ||||
|    PrefWatcherFactory() : BrowserContextKeyedServiceFactory( | ||||
|        "PrefWatcher", | ||||
| @@ -457,6 +455,18 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { | ||||
|    } | ||||
|  }; | ||||
|   | ||||
| +namespace { | ||||
| + | ||||
| +base::LazyInstance<PrefWatcherFactory>::Leaky g_pref_watcher_factory = | ||||
| +    LAZY_INSTANCE_INITIALIZER; | ||||
| + | ||||
| +}  // namespace | ||||
| + | ||||
| +// static | ||||
| +PrefWatcherFactory* PrefWatcherFactory::GetInstance() { | ||||
| +  return g_pref_watcher_factory.Pointer(); | ||||
| +} | ||||
| + | ||||
|  // static | ||||
|  PrefWatcher* PrefWatcher::Get(Profile* profile) { | ||||
|    return PrefWatcherFactory::GetForProfile(profile); | ||||
| @@ -1,49 +0,0 @@ | ||||
| diff --git spellcheck_factory.cc spellcheck_factory.cc | ||||
| index 3857256..3d1562c 100644 | ||||
| --- spellcheck_factory.cc | ||||
| +++ spellcheck_factory.cc | ||||
| @@ -16,6 +16,13 @@ | ||||
|  #include "content/public/browser/render_process_host.h" | ||||
|  #include "ui/base/l10n/l10n_util.h" | ||||
|   | ||||
| +namespace { | ||||
| + | ||||
| +static base::LazyInstance<SpellcheckServiceFactory>::Leaky | ||||
| +    g_spellcheck_service_factory = LAZY_INSTANCE_INITIALIZER; | ||||
| + | ||||
| +}  // namespace | ||||
| + | ||||
|  // static | ||||
|  SpellcheckService* SpellcheckServiceFactory::GetForContext( | ||||
|      content::BrowserContext* context) { | ||||
| @@ -38,7 +45,7 @@ SpellcheckService* SpellcheckServiceFactory::GetForRenderProcessId( | ||||
|   | ||||
|  // static | ||||
|  SpellcheckServiceFactory* SpellcheckServiceFactory::GetInstance() { | ||||
| -  return base::Singleton<SpellcheckServiceFactory>::get(); | ||||
| +  return g_spellcheck_service_factory.Pointer(); | ||||
|  } | ||||
|   | ||||
|  SpellcheckServiceFactory::SpellcheckServiceFactory() | ||||
| diff --git spellcheck_factory.h spellcheck_factory.h | ||||
| index e8eb9f7..48126000 100644 | ||||
| --- spellcheck_factory.h | ||||
| +++ spellcheck_factory.h | ||||
| @@ -7,7 +7,7 @@ | ||||
|   | ||||
|  #include "base/gtest_prod_util.h" | ||||
|  #include "base/macros.h" | ||||
| -#include "base/memory/singleton.h" | ||||
| +#include "base/lazy_instance.h" | ||||
|  #include "components/keyed_service/content/browser_context_keyed_service_factory.h" | ||||
|   | ||||
|  class SpellcheckService; | ||||
| @@ -26,7 +26,7 @@ class SpellcheckServiceFactory : public BrowserContextKeyedServiceFactory { | ||||
|    static SpellcheckServiceFactory* GetInstance(); | ||||
|   | ||||
|   private: | ||||
| -  friend struct base::DefaultSingletonTraits<SpellcheckServiceFactory>; | ||||
| +  friend struct base::DefaultLazyInstanceTraits<SpellcheckServiceFactory>; | ||||
|   | ||||
|    SpellcheckServiceFactory(); | ||||
|    ~SpellcheckServiceFactory() override; | ||||
		Reference in New Issue
	
	Block a user