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

Unified Diff: ui/gfx/native_theme_linux.cc

Issue 7778036: ui/gfx: Get rid of a few static variables from NativeTheme* type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use base::LazyInstance Created 9 years, 4 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/gfx/native_theme_linux.h ('k') | ui/gfx/native_theme_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « ui/gfx/native_theme_linux.h ('k') | ui/gfx/native_theme_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698