Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: ui/base/resource/resource_bundle.h

Issue 1955773002: Enable MD by default on Windows for Canary/Dev and local builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DISALLOW_IMPLICIT_CONSTRUCTORS Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/material_design/material_design_controller_unittest.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/resource/resource_bundle.h
diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h
index df812b1f14c0791a8fa40b508da0aae44666cb61..b2ac9d2bcb706556956dea0266a734752a70d4c4 100644
--- a/ui/base/resource/resource_bundle.h
+++ b/ui/base/resource/resource_bundle.h
@@ -116,6 +116,29 @@ class UI_BASE_EXPORT ResourceBundle {
virtual ~Delegate() {}
};
+ // A class which is designed to be instantiated on the stack during early
+ // startup code that needs access to string resources before the
+ // ResourceBundle may be loaded.
+ //
+ // This incurs a performance hit, so this should only be used in exceptional
+ // circumstances. Most uses of resources should wait until after the
+ // ResourceBundle has been loaded properly.
+ class UI_BASE_EXPORT TemporaryLoader {
+ public:
+ TemporaryLoader();
+ ~TemporaryLoader();
+
+ private:
+ // Mac loads resources earlier than other platforms and thus may have
+ // already initialized the resource bundle when we're constructed. Instead
+ // of trying to ifdef Mac or otherwise define exactly when we should and
+ // shouldn't load, we just set this based on whether the shared instance
+ // exists and then do nothing if it's set.
+ bool already_loaded_;
+
+ DISALLOW_COPY_AND_ASSIGN(TemporaryLoader);
+ };
+
// Initialize the ResourceBundle for this process. Does not take ownership of
// the |delegate| value. Returns the language selected.
// NOTE: Mac ignores this and always loads up resources for the language
« no previous file with comments | « ui/base/material_design/material_design_controller_unittest.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698