Index: ui/gfx/native_theme_linux.cc |
diff --git a/ui/gfx/native_theme_linux.cc b/ui/gfx/native_theme_linux.cc |
index 5ab5fb0ebaed71bebd62adea69e2f4b0ae51a144..2a3f6dad68358b48f7c4c909e2bdae471250e568 100644 |
--- a/ui/gfx/native_theme_linux.cc |
+++ b/ui/gfx/native_theme_linux.cc |
@@ -6,6 +6,7 @@ |
#include <limits> |
+#include "base/lazy_instance.h" |
#include "base/logging.h" |
#include "grit/gfx_resources.h" |
#include "third_party/skia/include/effects/SkGradientShader.h" |
@@ -43,19 +44,27 @@ const NativeTheme* NativeTheme::instance() { |
return NativeThemeLinux::instance(); |
} |
+static base::LazyInstance<NativeThemeLinux> g_native_theme( |
+ base::LINKER_INITIALIZED); |
+ |
+NativeThemeLinux::NativeThemeLinux() { |
+} |
+ |
+NativeThemeLinux::~NativeThemeLinux() { |
+} |
+ |
#if !defined(OS_CHROMEOS) |
// Chromeos has a different look. |
// static |
const NativeThemeLinux* NativeThemeLinux::instance() { |
- // The global NativeThemeLinux instance. |
- static NativeThemeLinux s_native_theme; |
- return &s_native_theme; |
+ return g_native_theme.Pointer(); |
} |
#endif |
// Get lightness adjusted color. |
-static SkColor BrightenColor(const color_utils::HSL& hsl, SkAlpha alpha, |
- double lightness_amount) { |
+static SkColor BrightenColor(const color_utils::HSL& hsl, |
+ SkAlpha alpha, |
+ double lightness_amount) { |
color_utils::HSL adjusted = hsl; |
adjusted.l += lightness_amount; |
if (adjusted.l > 1.0) |
@@ -66,12 +75,6 @@ static SkColor BrightenColor(const color_utils::HSL& hsl, SkAlpha alpha, |
return color_utils::HSLToSkColor(adjusted, alpha); |
} |
-NativeThemeLinux::NativeThemeLinux() { |
-} |
- |
-NativeThemeLinux::~NativeThemeLinux() { |
-} |
- |
gfx::Size NativeThemeLinux::GetPartSize(Part part, |
State state, |
const ExtraParams& extra) const { |